Skip to content

Commit c9841ae

Browse files
♻️ refactor: Improve docstrings and simplify some trivial generators.
1 parent 36a2fb4 commit c9841ae

25 files changed

+38
-44
lines changed

src/_bitreversal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* power of <code>2</code>.
66
*
77
* @param {Array} array The array to fill.
8-
* @param {Number} n The size of the permutation, must be a power of 2.
8+
* @param {number} n The size of the permutation, must be a power of 2.
99
*/
1010
export function _bitreversal(array, n) {
1111
let i = 1;

src/_compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @param {Array} sigma The first input permutation.
66
* @param {Array} tau The second input permutation.
7-
* @returns {Iterator} An iterator over the items of the resulting permutation.
7+
* @returns {IterableIterator} An iterator over the items of the resulting permutation.
88
*/
99
export function* _compose(sigma, tau) {
1010
for (const t of tau) yield sigma[t];

src/_copy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copy an input permutation to an output array.
33
*
44
* @param {Array} sigma The input permutation.
5-
* @param {Number} n The size of the input permutation to copy.
5+
* @param {number} n The size of the input permutation to copy.
66
* @param {Array} tau The output array.
77
*/
88
export function _copy(sigma, n, tau) {

src/_cycles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @param {Array} sigma The input permutation.
1616
* @param {Array} used The helper array.
17-
* @returns {Iterator} The cycles <code>[a, [b, c, ...]]</code> for sigma.
17+
* @returns {IterableIterator} The cycles <code>[a, [b, c, ...]]</code> for sigma.
1818
*/
1919
export function* _cycles(sigma, used) {
2020
for (const s of sigma) {

src/_identity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* elements.
44
*
55
* @param {Array} sigma The input array.
6-
* @param {Number} n The size to use for the permutation.
6+
* @param {number} n The size to use for the permutation.
77
*/
88
export function _identity(sigma, n) {
99
for (let i = 0; i < n; ++i) sigma[i] = i;

src/_invert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* API.
77
*
88
* @param {Array} sigma The input permutation.
9-
* @param {Number} n The size of the input permutation.
9+
* @param {number} n The size of the input permutation.
1010
* @param {Array} tau The array where to put the inverse of the input permutation.
1111
*/
1212
export function _invert(sigma, n, tau) {

src/_itranspositions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @param {Array} sigma Input permutation.
88
* @param {Array} used Helper array.
9-
* @return {Iterator} Iterator over the transpositions.
9+
* @return {IterableIterator} Iterator over the transpositions.
1010
*/
1111
export function* _itranspositions(sigma, used) {
1212
for (const s of sigma) {

src/_next.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {_reverse} from './_reverse.js';
77
* input permutation remains untouched.
88
*
99
* @param {Array} sigma The input permutation (modified in-place).
10-
* @param {Number} n The size of the input permutation.
10+
* @param {number} n The size of the input permutation.
1111
* @returns {Boolean} Whether the input permutation is
1212
* __NOT__ the last for its elements.
1313
*/

src/_permutations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {_next} from './_next.js';
55
* permutation.
66
*
77
* @param {Array} sigma The starting permutation.
8-
* @param {Number} n The size of the permutation.
9-
* @returns {Iterator} Iterator over all permutations between the starting one
8+
* @param {number} n The size of the permutation.
9+
* @returns {IterableIterator} Iterator over all permutations between the starting one
1010
* and the last permutation on its elements.
1111
*/
1212
export function* _permutations(sigma, n) {

src/_reverse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {_transpose} from './_transpose.js';
55
* (include) to input index <code>j</code> (excluded).
66
*
77
* @param {Array} sigma The input permutation to reverse (modified in-place).
8-
* @param {Number} i The left bound (included).
9-
* @param {Number} j The right bound (excluded).
8+
* @param {number} i The left bound (included).
9+
* @param {number} j The right bound (excluded).
1010
*/
1111
export function _reverse(sigma, i, j) {
1212
while (i < --j) _transpose(i++, j, sigma);

0 commit comments

Comments
 (0)