@bbn/bbn 2.0.20 → 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/date.js +21 -0
- 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
package/dist/date.js
CHANGED
|
@@ -850,6 +850,9 @@ class bbnDateTool {
|
|
|
850
850
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f") ? this.format() : '';
|
|
851
851
|
}
|
|
852
852
|
year(v) {
|
|
853
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
854
|
+
return undefined;
|
|
855
|
+
}
|
|
853
856
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
854
857
|
const d = this.copy();
|
|
855
858
|
d.setFullYear(v);
|
|
@@ -858,6 +861,9 @@ class bbnDateTool {
|
|
|
858
861
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getFullYear();
|
|
859
862
|
}
|
|
860
863
|
month(v) {
|
|
864
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
865
|
+
return undefined;
|
|
866
|
+
}
|
|
861
867
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
862
868
|
const d = this.copy();
|
|
863
869
|
d.setMonth(v - 1);
|
|
@@ -866,6 +872,9 @@ class bbnDateTool {
|
|
|
866
872
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getMonth() + 1;
|
|
867
873
|
}
|
|
868
874
|
day(v) {
|
|
875
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
876
|
+
return undefined;
|
|
877
|
+
}
|
|
869
878
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
870
879
|
const d = this.copy();
|
|
871
880
|
d.setDate(v);
|
|
@@ -874,6 +883,9 @@ class bbnDateTool {
|
|
|
874
883
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getDate();
|
|
875
884
|
}
|
|
876
885
|
hour(v) {
|
|
886
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
887
|
+
return undefined;
|
|
888
|
+
}
|
|
877
889
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
878
890
|
const d = this.copy();
|
|
879
891
|
d.setHours(v);
|
|
@@ -882,6 +894,9 @@ class bbnDateTool {
|
|
|
882
894
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getHours();
|
|
883
895
|
}
|
|
884
896
|
minute(v) {
|
|
897
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
898
|
+
return undefined;
|
|
899
|
+
}
|
|
885
900
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
886
901
|
const d = this.copy();
|
|
887
902
|
d.setMinutes(v);
|
|
@@ -890,6 +905,9 @@ class bbnDateTool {
|
|
|
890
905
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getMinutes();
|
|
891
906
|
}
|
|
892
907
|
second(v) {
|
|
908
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
909
|
+
return undefined;
|
|
910
|
+
}
|
|
893
911
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
894
912
|
const d = this.copy();
|
|
895
913
|
d.setSeconds(v);
|
|
@@ -898,6 +916,9 @@ class bbnDateTool {
|
|
|
898
916
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getSeconds();
|
|
899
917
|
}
|
|
900
918
|
weekday(v, past = false) {
|
|
919
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
920
|
+
return undefined;
|
|
921
|
+
}
|
|
901
922
|
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
902
923
|
return this.setWeekday(v, past);
|
|
903
924
|
}
|
|
@@ -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,
|