@valkyriestudios/utils 11.2.0 → 11.4.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 +4 -1
- package/array/dedupe.d.ts +1 -1
- package/array/is.d.ts +1 -1
- package/array/isNotEmpty.d.ts +1 -1
- package/array/join.d.ts +1 -1
- package/array/mapPrimitive.d.ts +1 -1
- package/array/mapPrimitive.js +2 -2
- package/array/shuffle.d.ts +1 -1
- package/boolean/is.d.ts +1 -1
- package/date/is.d.ts +1 -1
- package/function/is.d.ts +1 -1
- package/function/isAsync.d.ts +8 -0
- package/function/isAsync.js +6 -0
- package/function/noopresolve.d.ts +1 -1
- package/function/noopreturn.d.ts +1 -1
- package/hash/fnv1A.d.ts +1 -1
- package/index.d.ts +36 -31
- package/is.d.ts +2 -0
- package/is.js +2 -0
- package/number/is.d.ts +1 -1
- package/number/isAbove.d.ts +1 -1
- package/number/isAboveOrEqual.d.ts +1 -1
- package/number/isBelow.d.ts +1 -1
- package/number/isBelowOrEqual.d.ts +1 -1
- package/number/isBetween.d.ts +1 -1
- package/number/isInteger.d.ts +1 -1
- package/number/isIntegerAbove.d.ts +1 -1
- package/number/isIntegerAboveOrEqual.d.ts +1 -1
- package/number/isIntegerBelow.d.ts +1 -1
- package/number/isIntegerBelowOrEqual.d.ts +1 -1
- package/number/isIntegerBetween.d.ts +1 -1
- package/number/isNumericalNaN.d.ts +1 -1
- package/object/is.d.ts +1 -1
- package/object/isNotEmpty.d.ts +1 -1
- package/package.json +1 -1
- package/regexp/is.d.ts +1 -1
- package/string/is.d.ts +1 -1
- package/string/isBetween.d.ts +1 -1
- package/string/isNotEmpty.d.ts +1 -1
package/README.md
CHANGED
|
@@ -478,9 +478,12 @@ equal(new RegExp(/ab+c/, 'i'), /ab+c/i); // TRUE
|
|
|
478
478
|
```
|
|
479
479
|
|
|
480
480
|
### function
|
|
481
|
-
- **isFunction(val:
|
|
481
|
+
- **isFunction(val:unknown)**
|
|
482
482
|
Check if a variable is a Function
|
|
483
483
|
|
|
484
|
+
- **isAsyncFunction(val:unknown):boolean**
|
|
485
|
+
Check if a variable is an async function
|
|
486
|
+
|
|
484
487
|
- **noop()**
|
|
485
488
|
An empty function that can be used in (for example) piping
|
|
486
489
|
|
package/array/dedupe.d.ts
CHANGED
package/array/is.d.ts
CHANGED
package/array/isNotEmpty.d.ts
CHANGED
package/array/join.d.ts
CHANGED
package/array/mapPrimitive.d.ts
CHANGED
package/array/mapPrimitive.js
CHANGED
|
@@ -14,8 +14,8 @@ function mapPrimitive(arr, opts = {}) {
|
|
|
14
14
|
if (typeof el === 'string' && el.trim().length > 0) {
|
|
15
15
|
map[el.trim()] = OPTS.valtrim ? el.trim() : el;
|
|
16
16
|
}
|
|
17
|
-
else if (Number.isFinite(el)) {
|
|
18
|
-
map[OPTS.keyround === true ? Math.round(el) : el] = OPTS.valround === false
|
|
17
|
+
else if (typeof el === 'number' && Number.isFinite(el)) {
|
|
18
|
+
map[`${OPTS.keyround === true ? Math.round(el) : el}`] = OPTS.valround === false
|
|
19
19
|
? el
|
|
20
20
|
: OPTS.valround === true
|
|
21
21
|
? Math.round(el)
|
package/array/shuffle.d.ts
CHANGED
package/boolean/is.d.ts
CHANGED
package/date/is.d.ts
CHANGED
package/function/is.d.ts
CHANGED
package/function/noopreturn.d.ts
CHANGED
package/hash/fnv1A.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,78 +1,81 @@
|
|
|
1
1
|
declare module "number/isNumericalNaN" {
|
|
2
|
-
export default function isNumericalNaN(val:
|
|
2
|
+
export default function isNumericalNaN(val: unknown): boolean;
|
|
3
3
|
}
|
|
4
4
|
declare module "equal" {
|
|
5
5
|
function equal(a: any, b: any): boolean;
|
|
6
6
|
export default equal;
|
|
7
7
|
}
|
|
8
8
|
declare module "array/isNotEmpty" {
|
|
9
|
-
export default function isNotEmptyArray(val:
|
|
9
|
+
export default function isNotEmptyArray(val: unknown): boolean;
|
|
10
10
|
}
|
|
11
11
|
declare module "array/is" {
|
|
12
|
-
export default function isArray(val:
|
|
12
|
+
export default function isArray(val: unknown): boolean;
|
|
13
13
|
}
|
|
14
14
|
declare module "boolean/is" {
|
|
15
|
-
export default function isBoolean(val:
|
|
15
|
+
export default function isBoolean(val: unknown): boolean;
|
|
16
16
|
}
|
|
17
17
|
declare module "date/is" {
|
|
18
|
-
export default function isDate(val:
|
|
18
|
+
export default function isDate(val: unknown): boolean;
|
|
19
19
|
}
|
|
20
20
|
declare module "function/is" {
|
|
21
|
-
export default function isFunction(val:
|
|
21
|
+
export default function isFunction(val: unknown): boolean;
|
|
22
|
+
}
|
|
23
|
+
declare module "function/isAsync" {
|
|
24
|
+
export default function isAsyncFunction(val: unknown): boolean;
|
|
22
25
|
}
|
|
23
26
|
declare module "number/is" {
|
|
24
|
-
export default function isNumber(val:
|
|
27
|
+
export default function isNumber(val: unknown): boolean;
|
|
25
28
|
}
|
|
26
29
|
declare module "number/isBetween" {
|
|
27
|
-
export default function isNumberBetween(val:
|
|
30
|
+
export default function isNumberBetween(val: unknown, min: number, max: number): boolean;
|
|
28
31
|
}
|
|
29
32
|
declare module "number/isBelow" {
|
|
30
|
-
export default function isNumberBelow(val:
|
|
33
|
+
export default function isNumberBelow(val: unknown, ref: number): boolean;
|
|
31
34
|
}
|
|
32
35
|
declare module "number/isBelowOrEqual" {
|
|
33
|
-
export default function isNumberBelowOrEqual(val:
|
|
36
|
+
export default function isNumberBelowOrEqual(val: unknown, ref: number): boolean;
|
|
34
37
|
}
|
|
35
38
|
declare module "number/isAbove" {
|
|
36
|
-
export default function isNumberAbove(val:
|
|
39
|
+
export default function isNumberAbove(val: unknown, ref: number): boolean;
|
|
37
40
|
}
|
|
38
41
|
declare module "number/isAboveOrEqual" {
|
|
39
|
-
export default function isNumberAboveOrEqual(val:
|
|
42
|
+
export default function isNumberAboveOrEqual(val: unknown, ref: number): boolean;
|
|
40
43
|
}
|
|
41
44
|
declare module "number/isInteger" {
|
|
42
|
-
export default function isInteger(val:
|
|
45
|
+
export default function isInteger(val: unknown): boolean;
|
|
43
46
|
}
|
|
44
47
|
declare module "number/isIntegerBetween" {
|
|
45
|
-
export default function isIntegerBetween(val:
|
|
48
|
+
export default function isIntegerBetween(val: unknown, min: number, max: number): boolean;
|
|
46
49
|
}
|
|
47
50
|
declare module "number/isIntegerBelow" {
|
|
48
|
-
export default function isIntegerBelow(val:
|
|
51
|
+
export default function isIntegerBelow(val: unknown, ref: number): boolean;
|
|
49
52
|
}
|
|
50
53
|
declare module "number/isIntegerBelowOrEqual" {
|
|
51
|
-
export default function isIntegerBelowOrEqual(val:
|
|
54
|
+
export default function isIntegerBelowOrEqual(val: unknown, ref: number): boolean;
|
|
52
55
|
}
|
|
53
56
|
declare module "number/isIntegerAbove" {
|
|
54
|
-
export default function isIntegerAbove(val:
|
|
57
|
+
export default function isIntegerAbove(val: unknown, ref: number): boolean;
|
|
55
58
|
}
|
|
56
59
|
declare module "number/isIntegerAboveOrEqual" {
|
|
57
|
-
export default function isIntegerAboveOrEqual(val:
|
|
60
|
+
export default function isIntegerAboveOrEqual(val: unknown, ref: number): boolean;
|
|
58
61
|
}
|
|
59
62
|
declare module "regexp/is" {
|
|
60
|
-
export default function isRegExp(val:
|
|
63
|
+
export default function isRegExp(val: unknown): boolean;
|
|
61
64
|
}
|
|
62
65
|
declare module "object/is" {
|
|
63
|
-
export default function isObject(val:
|
|
66
|
+
export default function isObject(val: unknown): boolean;
|
|
64
67
|
}
|
|
65
68
|
declare module "object/isNotEmpty" {
|
|
66
|
-
export default function isNotEmptyObject(val:
|
|
69
|
+
export default function isNotEmptyObject(val: unknown): boolean;
|
|
67
70
|
}
|
|
68
71
|
declare module "string/is" {
|
|
69
|
-
export default function isString(val:
|
|
72
|
+
export default function isString(val: unknown): boolean;
|
|
70
73
|
}
|
|
71
74
|
declare module "string/isBetween" {
|
|
72
|
-
export default function isStringBetween(val:
|
|
75
|
+
export default function isStringBetween(val: unknown, min: number, max: number, trimmed?: boolean): boolean;
|
|
73
76
|
}
|
|
74
77
|
declare module "string/isNotEmpty" {
|
|
75
|
-
export default function isNotEmptyString(val:
|
|
78
|
+
export default function isNotEmptyString(val: unknown, trimmed?: boolean): boolean;
|
|
76
79
|
}
|
|
77
80
|
declare module "is" {
|
|
78
81
|
import equal from "equal";
|
|
@@ -81,6 +84,7 @@ declare module "is" {
|
|
|
81
84
|
import isBoolean from "boolean/is";
|
|
82
85
|
import isDate from "date/is";
|
|
83
86
|
import isFunction from "function/is";
|
|
87
|
+
import isAsyncFunction from "function/isAsync";
|
|
84
88
|
import isNumber from "number/is";
|
|
85
89
|
import isNumberBetween from "number/isBetween";
|
|
86
90
|
import isNumberBelow from "number/isBelow";
|
|
@@ -106,6 +110,7 @@ declare module "is" {
|
|
|
106
110
|
Boolean: typeof isBoolean;
|
|
107
111
|
Date: typeof isDate;
|
|
108
112
|
Function: typeof isFunction;
|
|
113
|
+
AsyncFunction: typeof isAsyncFunction;
|
|
109
114
|
Num: typeof isNumber;
|
|
110
115
|
NumBetween: typeof isNumberBetween;
|
|
111
116
|
NumAbove: typeof isNumberAbove;
|
|
@@ -152,10 +157,10 @@ declare module "is" {
|
|
|
152
157
|
export default Is;
|
|
153
158
|
}
|
|
154
159
|
declare module "hash/fnv1A" {
|
|
155
|
-
export default function fnv1A(data:
|
|
160
|
+
export default function fnv1A(data: unknown, offset?: number): number;
|
|
156
161
|
}
|
|
157
162
|
declare module "array/dedupe" {
|
|
158
|
-
export default function dedupe(val:
|
|
163
|
+
export default function dedupe<T>(val: T[]): T[];
|
|
159
164
|
}
|
|
160
165
|
declare module "number/round" {
|
|
161
166
|
export default function round(val: number, precision?: number): number;
|
|
@@ -167,7 +172,7 @@ declare module "array/join" {
|
|
|
167
172
|
valtrim?: boolean;
|
|
168
173
|
valround?: number;
|
|
169
174
|
}
|
|
170
|
-
export default function join(val:
|
|
175
|
+
export default function join(val: unknown[], opts?: joinOptions): string;
|
|
171
176
|
}
|
|
172
177
|
declare module "array/mapFn" {
|
|
173
178
|
interface mapOptions {
|
|
@@ -206,10 +211,10 @@ declare module "array/mapPrimitive" {
|
|
|
206
211
|
interface mapReturn {
|
|
207
212
|
[key: string]: string | number;
|
|
208
213
|
}
|
|
209
|
-
export default function mapPrimitive(arr:
|
|
214
|
+
export default function mapPrimitive(arr: unknown[], opts?: mapOptions): mapReturn;
|
|
210
215
|
}
|
|
211
216
|
declare module "array/shuffle" {
|
|
212
|
-
export default function shuffle(arr:
|
|
217
|
+
export default function shuffle(arr: unknown[]): void;
|
|
213
218
|
}
|
|
214
219
|
declare module "array/sort" {
|
|
215
220
|
interface sortOptions {
|
|
@@ -284,10 +289,10 @@ declare module "function/noop" {
|
|
|
284
289
|
export default function noop(): void;
|
|
285
290
|
}
|
|
286
291
|
declare module "function/noopresolve" {
|
|
287
|
-
export default function noopresolve(val?:
|
|
292
|
+
export default function noopresolve<T>(val?: T): Promise<T>;
|
|
288
293
|
}
|
|
289
294
|
declare module "function/noopreturn" {
|
|
290
|
-
export default function noopreturn(val?:
|
|
295
|
+
export default function noopreturn<T>(val?: T): T;
|
|
291
296
|
}
|
|
292
297
|
declare module "function/sleep" {
|
|
293
298
|
export default function sleep(ms?: number): Promise<void>;
|
package/is.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import isArray from './array/is';
|
|
|
4
4
|
import isBoolean from './boolean/is';
|
|
5
5
|
import isDate from './date/is';
|
|
6
6
|
import isFunction from './function/is';
|
|
7
|
+
import isAsyncFunction from './function/isAsync';
|
|
7
8
|
import isNumber from './number/is';
|
|
8
9
|
import isNumberBetween from './number/isBetween';
|
|
9
10
|
import isNumberBelow from './number/isBelow';
|
|
@@ -29,6 +30,7 @@ declare const Is: Readonly<{
|
|
|
29
30
|
Boolean: typeof isBoolean;
|
|
30
31
|
Date: typeof isDate;
|
|
31
32
|
Function: typeof isFunction;
|
|
33
|
+
AsyncFunction: typeof isAsyncFunction;
|
|
32
34
|
Num: typeof isNumber;
|
|
33
35
|
NumBetween: typeof isNumberBetween;
|
|
34
36
|
NumAbove: typeof isNumberAbove;
|
package/is.js
CHANGED
|
@@ -6,6 +6,7 @@ const is_1 = require("./array/is");
|
|
|
6
6
|
const is_2 = require("./boolean/is");
|
|
7
7
|
const is_3 = require("./date/is");
|
|
8
8
|
const is_4 = require("./function/is");
|
|
9
|
+
const isAsync_1 = require("./function/isAsync");
|
|
9
10
|
const is_5 = require("./number/is");
|
|
10
11
|
const isBetween_1 = require("./number/isBetween");
|
|
11
12
|
const isBelow_1 = require("./number/isBelow");
|
|
@@ -31,6 +32,7 @@ const Is = Object.freeze({
|
|
|
31
32
|
Boolean: is_2.default,
|
|
32
33
|
Date: is_3.default,
|
|
33
34
|
Function: is_4.default,
|
|
35
|
+
AsyncFunction: isAsync_1.default,
|
|
34
36
|
Num: is_5.default,
|
|
35
37
|
NumBetween: isBetween_1.default,
|
|
36
38
|
NumAbove: isAbove_1.default,
|
package/number/is.d.ts
CHANGED
package/number/isAbove.d.ts
CHANGED
package/number/isBelow.d.ts
CHANGED
package/number/isBetween.d.ts
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @returns Whether or not the value is a number between min and max inclusive
|
|
11
11
|
*/
|
|
12
|
-
export default function isNumberBetween(val:
|
|
12
|
+
export default function isNumberBetween(val: unknown, min: number, max: number): boolean;
|
package/number/isInteger.d.ts
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @returns Whether or not the value is an integer between min and max inclusive
|
|
11
11
|
*/
|
|
12
|
-
export default function isIntegerBetween(val:
|
|
12
|
+
export default function isIntegerBetween(val: unknown, min: number, max: number): boolean;
|
package/object/is.d.ts
CHANGED
package/object/isNotEmpty.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@valkyriestudios/utils", "version": "11.
|
|
1
|
+
{ "name": "@valkyriestudios/utils", "version": "11.4.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "email": "contact@valkyriestudios.be", "url": "www.valkyriestudios.be" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
|
package/regexp/is.d.ts
CHANGED
package/string/is.d.ts
CHANGED
package/string/isBetween.d.ts
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @returns Whether or not the value is a string of length between min and max inclusive
|
|
12
12
|
*/
|
|
13
|
-
export default function isStringBetween(val:
|
|
13
|
+
export default function isStringBetween(val: unknown, min: number, max: number, trimmed?: boolean): boolean;
|
package/string/isNotEmpty.d.ts
CHANGED