Comparing version 1.0.5 to 1.0.6
20
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.seq = exports.next = void 0; | ||
/** | ||
* put next index into 'current' and returns 'carry-up' position. | ||
* | ||
* the next index are unspecified if; | ||
* - 'ranges.length' were smaller than 'current.length' or smaller than 0, | ||
* - 'ranges' had 0 | ||
* | ||
* the 'current' should not be 'const'/'readonly' and mutable. | ||
* | ||
* returned value of 'carry-up' represents position on 'current' nexts index. | ||
* | ||
* if all ranges has gone, 'carry-up' is -1. | ||
*/ | ||
function next(current, ranges) { | ||
@@ -17,2 +30,9 @@ let cu = current.length - 1; | ||
exports.next = next; | ||
/** | ||
* enumerates all indexes starts from 'initial' to 'ranges'. | ||
* | ||
* all indexes is unspecified if 'initial' was on out of 'ranges'. | ||
* | ||
* @see next | ||
*/ | ||
function seq(initial, ranges) { | ||
@@ -19,0 +39,0 @@ if (!ranges.length || ranges.some(x => x === 0)) { |
21
index.ts
@@ -0,1 +1,15 @@ | ||
/** | ||
* put next index into 'current' and returns 'carry-up' position. | ||
* | ||
* the next index are unspecified if; | ||
* - 'ranges.length' were smaller than 'current.length' or smaller than 0, | ||
* - 'ranges' had 0 | ||
* | ||
* the 'current' should not be 'const'/'readonly' and mutable. | ||
* | ||
* returned value of 'carry-up' represents position on 'current' nexts index. | ||
* | ||
* if all ranges has gone, 'carry-up' is -1. | ||
*/ | ||
export function next(current: number[], ranges: number[]) { | ||
@@ -13,2 +27,9 @@ let cu = current.length - 1; | ||
/** | ||
* enumerates all indexes starts from 'initial' to 'ranges'. | ||
* | ||
* all indexes is unspecified if 'initial' was on out of 'ranges'. | ||
* | ||
* @see next | ||
*/ | ||
export function seq(initial: number[], ranges: number[]) { | ||
@@ -15,0 +36,0 @@ if (!ranges.length || ranges.some(x => x === 0)) { |
{ | ||
"name": "incnum", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "increment numbers in array. this can make multiple depth for-loop single.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
18367
251