@valkyriestudios/utils 12.3.0 → 12.5.0
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/README.md +15 -4
- package/array/dedupe.d.ts +2 -1
- package/array/dedupe.js +3 -1
- package/array/index.d.ts +10 -0
- package/array/index.js +25 -0
- package/array/is.d.ts +2 -1
- package/array/is.js +2 -0
- package/array/isNotEmpty.d.ts +2 -1
- package/array/isNotEmpty.js +2 -0
- package/array/join.d.ts +2 -2
- package/array/join.js +3 -1
- package/array/mapFn.d.ts +4 -7
- package/array/mapFn.js +2 -0
- package/array/mapKey.d.ts +3 -4
- package/array/mapKey.js +2 -0
- package/array/mapPrimitive.d.ts +2 -2
- package/array/mapPrimitive.js +3 -1
- package/array/shuffle.d.ts +2 -1
- package/array/shuffle.js +2 -0
- package/array/sort.d.ts +2 -2
- package/array/sort.js +4 -2
- package/boolean/index.d.ts +2 -0
- package/boolean/index.js +6 -0
- package/boolean/is.d.ts +2 -1
- package/boolean/is.js +2 -0
- package/caching/index.d.ts +2 -0
- package/caching/index.js +5 -0
- package/caching/memoize.d.ts +2 -1
- package/caching/memoize.js +2 -0
- package/date/addUTC.d.ts +2 -1
- package/date/addUTC.js +3 -3
- package/date/diff.d.ts +2 -1
- package/date/diff.js +4 -2
- package/date/endOfUTC.d.ts +2 -1
- package/date/endOfUTC.js +3 -3
- package/date/format.d.ts +2 -1
- package/date/format.js +3 -1
- package/date/index.d.ts +11 -0
- package/date/index.js +24 -0
- package/date/is.d.ts +2 -1
- package/date/is.js +2 -0
- package/date/nowUnix.d.ts +2 -1
- package/date/nowUnix.js +2 -0
- package/date/nowUnixMs.d.ts +2 -1
- package/date/nowUnixMs.js +2 -0
- package/date/startOfUTC.d.ts +2 -1
- package/date/startOfUTC.js +3 -3
- package/date/toUTC.d.ts +2 -1
- package/date/toUTC.js +3 -1
- package/date/toUnix.d.ts +2 -1
- package/date/toUnix.js +3 -1
- package/deep/freeze.d.ts +2 -2
- package/deep/freeze.js +2 -0
- package/deep/get.d.ts +2 -1
- package/deep/get.js +2 -0
- package/deep/index.d.ts +5 -0
- package/deep/index.js +15 -0
- package/deep/seal.d.ts +2 -2
- package/deep/seal.js +2 -0
- package/deep/set.d.ts +2 -1
- package/deep/set.js +2 -0
- package/equal.d.ts +1 -1
- package/equal.js +4 -2
- package/formdata/index.d.ts +2 -0
- package/formdata/index.js +6 -0
- package/formdata/is.d.ts +9 -0
- package/formdata/is.js +8 -0
- package/function/index.d.ts +7 -0
- package/function/index.js +19 -0
- package/function/is.d.ts +2 -1
- package/function/is.js +2 -0
- package/function/isAsync.d.ts +2 -1
- package/function/isAsync.js +2 -0
- package/function/noop.d.ts +2 -1
- package/function/noop.js +2 -0
- package/function/noopresolve.d.ts +2 -1
- package/function/noopresolve.js +2 -0
- package/function/noopreturn.d.ts +2 -1
- package/function/noopreturn.js +2 -0
- package/function/sleep.d.ts +2 -1
- package/function/sleep.js +2 -0
- package/hash/fnv1A.d.ts +2 -1
- package/hash/fnv1A.js +2 -0
- package/hash/guid.d.ts +2 -1
- package/hash/guid.js +2 -0
- package/hash/index.d.ts +3 -0
- package/hash/index.js +7 -0
- package/index.d.ts +386 -238
- package/is.d.ts +52 -66
- package/is.js +61 -73
- package/number/index.d.ts +18 -0
- package/number/index.js +57 -0
- package/number/is.d.ts +2 -1
- package/number/is.js +2 -0
- package/number/isAbove.d.ts +2 -1
- package/number/isAbove.js +2 -0
- package/number/isAboveOrEqual.d.ts +2 -1
- package/number/isAboveOrEqual.js +2 -0
- package/number/isBelow.d.ts +2 -1
- package/number/isBelow.js +2 -0
- package/number/isBelowOrEqual.d.ts +2 -1
- package/number/isBelowOrEqual.js +2 -0
- package/number/isBetween.d.ts +2 -1
- package/number/isBetween.js +2 -0
- package/number/isInteger.d.ts +2 -1
- package/number/isInteger.js +2 -0
- package/number/isIntegerAbove.d.ts +2 -1
- package/number/isIntegerAbove.js +2 -0
- package/number/isIntegerAboveOrEqual.d.ts +2 -1
- package/number/isIntegerAboveOrEqual.js +2 -0
- package/number/isIntegerBelow.d.ts +2 -1
- package/number/isIntegerBelow.js +2 -0
- package/number/isIntegerBelowOrEqual.d.ts +2 -1
- package/number/isIntegerBelowOrEqual.js +2 -0
- package/number/isIntegerBetween.d.ts +2 -1
- package/number/isIntegerBetween.js +2 -0
- package/number/isNumericalNaN.d.ts +2 -1
- package/number/isNumericalNaN.js +2 -0
- package/number/randomBetween.d.ts +2 -1
- package/number/randomBetween.js +2 -0
- package/number/randomIntBetween.d.ts +2 -1
- package/number/randomIntBetween.js +2 -0
- package/number/round.d.ts +2 -1
- package/number/round.js +2 -0
- package/number/toPercentage.d.ts +2 -1
- package/number/toPercentage.js +3 -1
- package/object/define.d.ts +2 -1
- package/object/define.js +2 -0
- package/object/index.d.ts +6 -0
- package/object/index.js +17 -0
- package/object/is.d.ts +2 -1
- package/object/is.js +2 -0
- package/object/isNotEmpty.d.ts +2 -1
- package/object/isNotEmpty.js +2 -0
- package/object/merge.d.ts +1 -1
- package/object/merge.js +2 -0
- package/object/pick.d.ts +2 -1
- package/object/pick.js +4 -2
- package/package.json +1 -1
- package/regexp/index.d.ts +3 -0
- package/regexp/index.js +9 -0
- package/regexp/is.d.ts +2 -1
- package/regexp/is.js +2 -0
- package/regexp/sanitize.d.ts +2 -1
- package/regexp/sanitize.js +2 -0
- package/string/humanizeBytes.d.ts +2 -2
- package/string/humanizeBytes.js +4 -3
- package/string/humanizeNumber.d.ts +2 -2
- package/string/humanizeNumber.js +3 -1
- package/string/index.d.ts +7 -0
- package/string/index.js +20 -0
- package/string/is.d.ts +2 -1
- package/string/is.js +2 -0
- package/string/isBetween.d.ts +2 -1
- package/string/isBetween.js +2 -0
- package/string/isNotEmpty.d.ts +2 -1
- package/string/isNotEmpty.js +2 -0
- package/string/shorten.d.ts +2 -1
- package/string/shorten.js +2 -0
package/date/startOfUTC.d.ts
CHANGED
|
@@ -6,4 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @returns New date set to start of key
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
declare function startOfUTC(val: Date, key?: 'year' | 'quarter' | 'month' | 'week' | 'week_sun' | 'week_mon' | 'week_tue' | 'week_wed' | 'week_thu' | 'week_fri' | 'week_sat' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'): Date;
|
|
10
|
+
export { startOfUTC, startOfUTC as default };
|
package/date/startOfUTC.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.startOfUTC = void 0;
|
|
3
4
|
const is_1 = require("./is");
|
|
4
5
|
const WEEK_START = new Map([
|
|
5
6
|
['week', 1],
|
|
@@ -12,10 +13,8 @@ const WEEK_START = new Map([
|
|
|
12
13
|
['week_sat', 6],
|
|
13
14
|
]);
|
|
14
15
|
function startOfUTC(val, key = 'millisecond') {
|
|
15
|
-
if (!(0, is_1.
|
|
16
|
+
if (!(0, is_1.isDate)(val))
|
|
16
17
|
throw new TypeError('startOfUTC requires a date object');
|
|
17
|
-
if (typeof key !== 'string')
|
|
18
|
-
throw new TypeError('Key needs to be a string with content');
|
|
19
18
|
switch (key) {
|
|
20
19
|
case 'year':
|
|
21
20
|
return new Date(Date.UTC(val.getUTCFullYear(), 0, 1, 0, 0, 0, 0));
|
|
@@ -49,4 +48,5 @@ function startOfUTC(val, key = 'millisecond') {
|
|
|
49
48
|
return new Date(Date.UTC(val.getUTCFullYear(), val.getUTCMonth(), val.getUTCDate(), val.getUTCHours(), val.getUTCMinutes(), val.getUTCSeconds(), val.getUTCMilliseconds()));
|
|
50
49
|
}
|
|
51
50
|
}
|
|
51
|
+
exports.startOfUTC = startOfUTC;
|
|
52
52
|
exports.default = startOfUTC;
|
package/date/toUTC.d.ts
CHANGED
package/date/toUTC.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.toUTC = void 0;
|
|
3
4
|
const is_1 = require("./is");
|
|
4
5
|
function toUTC(val) {
|
|
5
|
-
if (!(0, is_1.
|
|
6
|
+
if (!(0, is_1.isDate)(val))
|
|
6
7
|
throw new TypeError('toUTC requires a date object');
|
|
7
8
|
return new Date(Date.UTC(val.getUTCFullYear(), val.getUTCMonth(), val.getUTCDate(), val.getUTCHours(), val.getUTCMinutes(), val.getUTCSeconds(), val.getUTCMilliseconds()));
|
|
8
9
|
}
|
|
10
|
+
exports.toUTC = toUTC;
|
|
9
11
|
exports.default = toUTC;
|
package/date/toUnix.d.ts
CHANGED
package/date/toUnix.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.toUnix = void 0;
|
|
3
4
|
const is_1 = require("./is");
|
|
4
5
|
function toUnix(val) {
|
|
5
|
-
if (!(0, is_1.
|
|
6
|
+
if (!(0, is_1.isDate)(val))
|
|
6
7
|
throw new TypeError('toUnix requires a date object');
|
|
7
8
|
return Math.floor(val.valueOf() / 1000);
|
|
8
9
|
}
|
|
10
|
+
exports.toUnix = toUnix;
|
|
9
11
|
exports.default = toUnix;
|
package/deep/freeze.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ type Frozen<T> = {
|
|
|
13
13
|
*
|
|
14
14
|
* @returns Deeply frozen object
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
export {};
|
|
16
|
+
declare function deepFreeze<T extends deepInput>(obj: T): Frozen<T>;
|
|
17
|
+
export { deepFreeze, deepFreeze as default };
|
package/deep/freeze.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.deepFreeze = void 0;
|
|
3
4
|
function deep(obj) {
|
|
4
5
|
if (Array.isArray(obj)) {
|
|
5
6
|
for (const el of obj)
|
|
@@ -20,4 +21,5 @@ function deepFreeze(obj) {
|
|
|
20
21
|
throw new TypeError('Only objects/arrays can be frozen');
|
|
21
22
|
return deep(obj);
|
|
22
23
|
}
|
|
24
|
+
exports.deepFreeze = deepFreeze;
|
|
23
25
|
exports.default = deepFreeze;
|
package/deep/get.d.ts
CHANGED
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
* @returns Value stored at property or undefined
|
|
21
21
|
* @throws {TypeError}
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
declare function deepGet(obj: {
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
} | {
|
|
26
26
|
[key: string]: any;
|
|
27
27
|
}[] | any[], path: string, get_parent?: boolean): any | undefined;
|
|
28
|
+
export { deepGet, deepGet as default };
|
package/deep/get.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.deepGet = void 0;
|
|
3
4
|
function deepGet(obj, path, get_parent = false) {
|
|
4
5
|
if (Object.prototype.toString.call(obj) !== '[object Object]' &&
|
|
5
6
|
!Array.isArray(obj))
|
|
@@ -38,4 +39,5 @@ function deepGet(obj, path, get_parent = false) {
|
|
|
38
39
|
}
|
|
39
40
|
return cursor;
|
|
40
41
|
}
|
|
42
|
+
exports.deepGet = deepGet;
|
|
41
43
|
exports.default = deepGet;
|
package/deep/index.d.ts
ADDED
package/deep/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deepSet = exports.set = exports.deepSeal = exports.seal = exports.deepGet = exports.get = exports.deepFreeze = exports.freeze = void 0;
|
|
4
|
+
const freeze_1 = require("./freeze");
|
|
5
|
+
Object.defineProperty(exports, "freeze", { enumerable: true, get: function () { return freeze_1.deepFreeze; } });
|
|
6
|
+
Object.defineProperty(exports, "deepFreeze", { enumerable: true, get: function () { return freeze_1.deepFreeze; } });
|
|
7
|
+
const get_1 = require("./get");
|
|
8
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return get_1.deepGet; } });
|
|
9
|
+
Object.defineProperty(exports, "deepGet", { enumerable: true, get: function () { return get_1.deepGet; } });
|
|
10
|
+
const seal_1 = require("./seal");
|
|
11
|
+
Object.defineProperty(exports, "seal", { enumerable: true, get: function () { return seal_1.deepSeal; } });
|
|
12
|
+
Object.defineProperty(exports, "deepSeal", { enumerable: true, get: function () { return seal_1.deepSeal; } });
|
|
13
|
+
const set_1 = require("./set");
|
|
14
|
+
Object.defineProperty(exports, "set", { enumerable: true, get: function () { return set_1.deepSet; } });
|
|
15
|
+
Object.defineProperty(exports, "deepSet", { enumerable: true, get: function () { return set_1.deepSet; } });
|
package/deep/seal.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ type Sealed<T> = {
|
|
|
13
13
|
*
|
|
14
14
|
* @returns Deeply sealed object
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
export {};
|
|
16
|
+
declare function deepSeal<T extends deepInput>(obj: T): Sealed<T>;
|
|
17
|
+
export { deepSeal, deepSeal as default };
|
package/deep/seal.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.deepSeal = void 0;
|
|
3
4
|
function deep(obj) {
|
|
4
5
|
if (Array.isArray(obj)) {
|
|
5
6
|
for (const el of obj)
|
|
@@ -20,4 +21,5 @@ function deepSeal(obj) {
|
|
|
20
21
|
throw new TypeError('Only objects/arrays can be sealed');
|
|
21
22
|
return deep(obj);
|
|
22
23
|
}
|
|
24
|
+
exports.deepSeal = deepSeal;
|
|
23
25
|
exports.default = deepSeal;
|
package/deep/set.d.ts
CHANGED
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
* @returns True or false depending on whether or not the property was set correctly
|
|
36
36
|
* @throws {TypeError}
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
declare function deepSet(obj: {
|
|
39
39
|
[key: string]: any;
|
|
40
40
|
} | {
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}[] | any[], path: string, value: any, define?: boolean): boolean;
|
|
43
|
+
export { deepSet, deepSet as default };
|
package/deep/set.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.deepSet = void 0;
|
|
3
4
|
const RGX_MALICIOUS = /__proto__|constructor|prototype/;
|
|
4
5
|
function deepSet(obj, path, value, define = false) {
|
|
5
6
|
if (Object.prototype.toString.call(obj) !== '[object Object]' &&
|
|
@@ -51,4 +52,5 @@ function deepSet(obj, path, value, define = false) {
|
|
|
51
52
|
}
|
|
52
53
|
return true;
|
|
53
54
|
}
|
|
55
|
+
exports.deepSet = deepSet;
|
|
54
56
|
exports.default = deepSet;
|
package/equal.d.ts
CHANGED
package/equal.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.equal = void 0;
|
|
3
4
|
const isNumericalNaN_1 = require("./number/isNumericalNaN");
|
|
4
5
|
function isArrayEqual(a, b) {
|
|
5
6
|
if (a.length !== b.length)
|
|
@@ -32,8 +33,9 @@ function equal(a, b) {
|
|
|
32
33
|
if (Object.prototype.toString.call(a) === '[object Object]') {
|
|
33
34
|
return Object.prototype.toString.call(b) === '[object Object]' && isObjectEqual(a, b);
|
|
34
35
|
}
|
|
35
|
-
if ((0, isNumericalNaN_1.
|
|
36
|
-
return (0, isNumericalNaN_1.
|
|
36
|
+
if ((0, isNumericalNaN_1.isNumericalNaN)(a))
|
|
37
|
+
return (0, isNumericalNaN_1.isNumericalNaN)(b);
|
|
37
38
|
return a === b;
|
|
38
39
|
}
|
|
40
|
+
exports.equal = equal;
|
|
39
41
|
exports.default = equal;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.is = exports.isFormData = void 0;
|
|
4
|
+
const is_1 = require("./is");
|
|
5
|
+
Object.defineProperty(exports, "isFormData", { enumerable: true, get: function () { return is_1.isFormData; } });
|
|
6
|
+
Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.isFormData; } });
|
package/formdata/is.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check whether or not a provided value is an instance of FormData
|
|
3
|
+
*
|
|
4
|
+
* @param val - Value to verify
|
|
5
|
+
*
|
|
6
|
+
* @returns Whether or not the value is an instance of FormData
|
|
7
|
+
*/
|
|
8
|
+
declare function isFormData(val: unknown): val is FormData;
|
|
9
|
+
export { isFormData, isFormData as default };
|
package/formdata/is.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isFunction } from './is';
|
|
2
|
+
import { isAsyncFunction } from './isAsync';
|
|
3
|
+
import { noop } from './noop';
|
|
4
|
+
import { noopresolve } from './noopresolve';
|
|
5
|
+
import { noopreturn } from './noopreturn';
|
|
6
|
+
import { sleep } from './sleep';
|
|
7
|
+
export { isFunction, isFunction as is, isFunction as isFn, isAsyncFunction, isAsyncFunction as isAsync, isAsyncFunction as isAsyncFn, noop, noopresolve, noopreturn, sleep };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sleep = exports.noopreturn = exports.noopresolve = exports.noop = exports.isAsyncFn = exports.isAsync = exports.isAsyncFunction = exports.isFn = exports.is = exports.isFunction = void 0;
|
|
4
|
+
const is_1 = require("./is");
|
|
5
|
+
Object.defineProperty(exports, "isFunction", { enumerable: true, get: function () { return is_1.isFunction; } });
|
|
6
|
+
Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.isFunction; } });
|
|
7
|
+
Object.defineProperty(exports, "isFn", { enumerable: true, get: function () { return is_1.isFunction; } });
|
|
8
|
+
const isAsync_1 = require("./isAsync");
|
|
9
|
+
Object.defineProperty(exports, "isAsyncFunction", { enumerable: true, get: function () { return isAsync_1.isAsyncFunction; } });
|
|
10
|
+
Object.defineProperty(exports, "isAsync", { enumerable: true, get: function () { return isAsync_1.isAsyncFunction; } });
|
|
11
|
+
Object.defineProperty(exports, "isAsyncFn", { enumerable: true, get: function () { return isAsync_1.isAsyncFunction; } });
|
|
12
|
+
const noop_1 = require("./noop");
|
|
13
|
+
Object.defineProperty(exports, "noop", { enumerable: true, get: function () { return noop_1.noop; } });
|
|
14
|
+
const noopresolve_1 = require("./noopresolve");
|
|
15
|
+
Object.defineProperty(exports, "noopresolve", { enumerable: true, get: function () { return noopresolve_1.noopresolve; } });
|
|
16
|
+
const noopreturn_1 = require("./noopreturn");
|
|
17
|
+
Object.defineProperty(exports, "noopreturn", { enumerable: true, get: function () { return noopreturn_1.noopreturn; } });
|
|
18
|
+
const sleep_1 = require("./sleep");
|
|
19
|
+
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_1.sleep; } });
|
package/function/is.d.ts
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @returns Whether or not the value is a Function
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
declare function isFunction(val: unknown): val is (...args: unknown[]) => unknown;
|
|
9
|
+
export { isFunction, isFunction as default };
|
package/function/is.js
CHANGED
package/function/isAsync.d.ts
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @returns Whether or not the value is an async function
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
declare function isAsyncFunction(val: unknown): val is (...args: unknown[]) => Promise<unknown>;
|
|
9
|
+
export { isAsyncFunction, isAsyncFunction as default };
|
package/function/isAsync.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.isAsyncFunction = void 0;
|
|
3
4
|
function isAsyncFunction(val) {
|
|
4
5
|
return typeof val === 'function' && val.constructor.name === 'AsyncFunction';
|
|
5
6
|
}
|
|
7
|
+
exports.isAsyncFunction = isAsyncFunction;
|
|
6
8
|
exports.default = isAsyncFunction;
|
package/function/noop.d.ts
CHANGED
package/function/noop.js
CHANGED
package/function/noopresolve.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.noopresolve = void 0;
|
|
3
4
|
function noopresolve(val) {
|
|
4
5
|
return new Promise(resolve => resolve(val));
|
|
5
6
|
}
|
|
7
|
+
exports.noopresolve = noopresolve;
|
|
6
8
|
exports.default = noopresolve;
|
package/function/noopreturn.d.ts
CHANGED
package/function/noopreturn.js
CHANGED
package/function/sleep.d.ts
CHANGED
package/function/sleep.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.sleep = void 0;
|
|
3
4
|
function sleep(ms = 1000) {
|
|
4
5
|
return new Promise(resolve => {
|
|
5
6
|
setTimeout(() => resolve(), Number.isFinite(ms) && ms > 0 ? Math.round(ms) : 0);
|
|
6
7
|
});
|
|
7
8
|
}
|
|
9
|
+
exports.sleep = sleep;
|
|
8
10
|
exports.default = sleep;
|
package/hash/fnv1A.d.ts
CHANGED
package/hash/fnv1A.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.fnv1A = void 0;
|
|
3
4
|
const FNV_32 = 2166136261;
|
|
4
5
|
const REPL_NAN = 'nan';
|
|
5
6
|
const REPL_TRUE = 'true';
|
|
@@ -49,4 +50,5 @@ function fnv1A(data, offset = FNV_32) {
|
|
|
49
50
|
}
|
|
50
51
|
return hash >>> 0;
|
|
51
52
|
}
|
|
53
|
+
exports.fnv1A = fnv1A;
|
|
52
54
|
exports.default = fnv1A;
|
package/hash/guid.d.ts
CHANGED
package/hash/guid.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.guid = void 0;
|
|
3
4
|
const HEX = [];
|
|
4
5
|
for (let i = 0; i < 256; i++) {
|
|
5
6
|
HEX[i] = (i < 16 ? '0' : '') + i.toString(16);
|
|
@@ -30,4 +31,5 @@ function guid() {
|
|
|
30
31
|
HEX[(d3 >> 16) & 0xff] +
|
|
31
32
|
HEX[(d3 >> 24) & 0xff];
|
|
32
33
|
}
|
|
34
|
+
exports.guid = guid;
|
|
33
35
|
exports.default = guid;
|
package/hash/index.d.ts
ADDED
package/hash/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guid = exports.fnv1A = void 0;
|
|
4
|
+
const fnv1A_1 = require("./fnv1A");
|
|
5
|
+
Object.defineProperty(exports, "fnv1A", { enumerable: true, get: function () { return fnv1A_1.fnv1A; } });
|
|
6
|
+
const guid_1 = require("./guid");
|
|
7
|
+
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return guid_1.guid; } });
|