aureooms/js-permutation

View on GitHub
src/identity.js

Summary

Maintainability
A
0 mins
Test Coverage
import {_identity} from './_identity.js';
import {permutation} from './permutation.js';

/**
 * Returns the identity permutation of a given size.
 *
 * @param {number} n The size of the permutation to return.
 * @returns {Array} The identity permutation on <code>n</code> elements.
 */
export function identity(n) {
    const rho = permutation(n);

    _identity(rho, n);

    return rho;
}