@bbn/bbn 2.0.21 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/object/range.d.ts +26 -0
- package/dist/fn/object/range.js +28 -0
- package/dist/fn.d.ts +2 -0
- package/dist/fn.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new array generated by the execution of a function for each item of the given array.
|
|
3
|
+
*
|
|
4
|
+
* The deepProp argument is the name of property which should contain a nested array on which
|
|
5
|
+
* the function should also be applied recursively.
|
|
6
|
+
*
|
|
7
|
+
* @method map
|
|
8
|
+
* @global
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const hours = bbn.fn.range(0, 23, 1);
|
|
12
|
+
* // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
13
|
+
* ```
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const minsec = bbn.fn.range(0, 59, 1).map(h => ({text: h, value: h}));
|
|
17
|
+
* // [{text: 0, value: 0}, {text: 1, value: 1}, ..., {text: 59, value: 59}]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @memberof bbn.fn
|
|
21
|
+
* @param {Number} start
|
|
22
|
+
* @param {Number} stop
|
|
23
|
+
* @param {Number} step
|
|
24
|
+
* @returns {Array}
|
|
25
|
+
*/
|
|
26
|
+
export default function range(start: number, stop: number, step: number): number[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new array generated by the execution of a function for each item of the given array.
|
|
3
|
+
*
|
|
4
|
+
* The deepProp argument is the name of property which should contain a nested array on which
|
|
5
|
+
* the function should also be applied recursively.
|
|
6
|
+
*
|
|
7
|
+
* @method map
|
|
8
|
+
* @global
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const hours = bbn.fn.range(0, 23, 1);
|
|
12
|
+
* // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
13
|
+
* ```
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const minsec = bbn.fn.range(0, 59, 1).map(h => ({text: h, value: h}));
|
|
17
|
+
* // [{text: 0, value: 0}, {text: 1, value: 1}, ..., {text: 59, value: 59}]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @memberof bbn.fn
|
|
21
|
+
* @param {Number} start
|
|
22
|
+
* @param {Number} stop
|
|
23
|
+
* @param {Number} step
|
|
24
|
+
* @returns {Array}
|
|
25
|
+
*/
|
|
26
|
+
export default function range(start, stop, step) {
|
|
27
|
+
return Array.from({ length: (stop - start) / step + 1 }, (value, index) => start + index * step);
|
|
28
|
+
}
|
package/dist/fn.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ import printf from './fn/string/printf.js';
|
|
|
197
197
|
import quotes2html from './fn/string/quotes2html.js';
|
|
198
198
|
import randomInt from './fn/misc/randomInt.js';
|
|
199
199
|
import randomString from './fn/string/randomString.js';
|
|
200
|
+
import range from './fn/object/range.js';
|
|
200
201
|
import removeAccents from './fn/string/removeAccents.js';
|
|
201
202
|
import removeEmpty from './fn/object/removeEmpty.js';
|
|
202
203
|
import removeExtraSpaces from './fn/string/removeExtraSpaces.js';
|
|
@@ -444,6 +445,7 @@ declare const _default: {
|
|
|
444
445
|
quotes2html: typeof quotes2html;
|
|
445
446
|
randomInt: typeof randomInt;
|
|
446
447
|
randomString: typeof randomString;
|
|
448
|
+
range: typeof range;
|
|
447
449
|
removeAccents: typeof removeAccents;
|
|
448
450
|
removeEmpty: typeof removeEmpty;
|
|
449
451
|
removeExtraSpaces: typeof removeExtraSpaces;
|
package/dist/fn.js
CHANGED
|
@@ -197,6 +197,7 @@ import printf from './fn/string/printf.js';
|
|
|
197
197
|
import quotes2html from './fn/string/quotes2html.js';
|
|
198
198
|
import randomInt from './fn/misc/randomInt.js';
|
|
199
199
|
import randomString from './fn/string/randomString.js';
|
|
200
|
+
import range from './fn/object/range.js';
|
|
200
201
|
import removeAccents from './fn/string/removeAccents.js';
|
|
201
202
|
import removeEmpty from './fn/object/removeEmpty.js';
|
|
202
203
|
import removeExtraSpaces from './fn/string/removeExtraSpaces.js';
|
|
@@ -444,6 +445,7 @@ export default {
|
|
|
444
445
|
quotes2html,
|
|
445
446
|
randomInt,
|
|
446
447
|
randomString,
|
|
448
|
+
range,
|
|
447
449
|
removeAccents,
|
|
448
450
|
removeEmpty,
|
|
449
451
|
removeExtraSpaces,
|