@zelgadis87/utils-core 4.10.0 → 4.11.1
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/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/functions/constant.d.ts +1 -0
- package/dist/utils/functions.d.ts +11 -0
- package/dist/utils/numbers.d.ts +1 -0
- package/dist/utils/promises.d.ts +1 -0
- package/esbuild/index.cjs +88 -34
- package/esbuild/index.cjs.map +3 -3
- package/esbuild/index.mjs +73 -24
- package/esbuild/index.mjs.map +2 -2
- package/package.json +12 -12
- package/src/utils/functions/constant.ts +1 -0
- package/src/utils/functions.ts +25 -0
- package/src/utils/numbers.ts +3 -0
- package/src/utils/promises.ts +2 -1
- package/dist/async/index.d.ts +0 -4
- package/dist/lazy/index.d.ts +0 -2
- package/dist/sorting/index.d.ts +0 -4
- package/dist/time/index.d.ts +0 -7
- package/dist/upgrade/index.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@zelgadis87/utils-core",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.11.1",
|
|
5
5
|
"author": "Zelgadis87",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"private": false,
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@stylistic/eslint-plugin-ts": "2.
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
24
|
-
"@typescript-eslint/parser": "8.
|
|
25
|
-
"@vitest/coverage-v8": "
|
|
26
|
-
"@vitest/ui": "
|
|
27
|
-
"esbuild": "0.
|
|
28
|
-
"eslint": "9.
|
|
29
|
-
"nx": "20.
|
|
22
|
+
"@stylistic/eslint-plugin-ts": "4.2.0",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "8.26.1",
|
|
24
|
+
"@typescript-eslint/parser": "8.26.1",
|
|
25
|
+
"@vitest/coverage-v8": "3.0.8",
|
|
26
|
+
"@vitest/ui": "3.0.8",
|
|
27
|
+
"esbuild": "0.19.2",
|
|
28
|
+
"eslint": "9.22.0",
|
|
29
|
+
"nx": "20.6.0",
|
|
30
30
|
"rimraf": "6.0.1",
|
|
31
|
-
"typescript": "5.
|
|
32
|
-
"typescript-eslint": "8.
|
|
33
|
-
"vitest": "
|
|
31
|
+
"typescript": "5.8.2",
|
|
32
|
+
"typescript-eslint": "8.26.1",
|
|
33
|
+
"vitest": "3.0.8"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"small-date": "^2.0.1"
|
|
@@ -5,6 +5,7 @@ export default constant;
|
|
|
5
5
|
export const constantNull = constant( null );
|
|
6
6
|
export const constantTrue = constant( true );
|
|
7
7
|
export const constantFalse = constant( false );
|
|
8
|
+
export const constantUndefined = constant( void 0 );
|
|
8
9
|
export const alwaysTrue = constantTrue;
|
|
9
10
|
export const alwaysFalse = constantFalse;
|
|
10
11
|
export const constantZero = constant( 0 );
|
package/src/utils/functions.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { identity } from './_index.js';
|
|
1
2
|
import { constantTrue } from './functions.js';
|
|
2
3
|
|
|
3
4
|
export * from './functions/constant.js';
|
|
@@ -61,4 +62,28 @@ export function xor<T>( a: TPredicate<T>, b: TPredicate<T> ): TPredicate<T> {
|
|
|
61
62
|
return ( t: T ) => a( t ) !== b( t );
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
export function pipedInvoke<T, A>( op1: TFunction<T, A> ): TFunction<T, A>;
|
|
66
|
+
export function pipedInvoke<T, A, B>( op1: TFunction<T, A>, op2: TFunction<A, B> ): TFunction<T, B>;
|
|
67
|
+
export function pipedInvoke<T, A, B, C>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C> ): TFunction<T, C>;
|
|
68
|
+
export function pipedInvoke<T, A, B, C, D>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D> ): TFunction<T, D>;
|
|
69
|
+
export function pipedInvoke<T, A, B, C, D, E>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E> ): TFunction<T, E>;
|
|
70
|
+
export function pipedInvoke<T, A, B, C, D, E, F>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F> ): TFunction<T, F>;
|
|
71
|
+
export function pipedInvoke<T, A, B, C, D, E, F, G>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G> ): TFunction<T, G>;
|
|
72
|
+
export function pipedInvoke<T, A, B, C, D, E, F, G, H>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H> ): TFunction<T, H>;
|
|
73
|
+
export function pipedInvoke<T, A, B, C, D, E, F, G, H, I>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H>, op9: TFunction<H, I> ): TFunction<T, I>;
|
|
74
|
+
export function pipedInvoke<T, A, B, C, D, E, F, G, H, I>( op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H>, op9: TFunction<H, I>, ...operations: TFunction<any, any>[] ): TFunction<T, unknown>;
|
|
75
|
+
export function pipedInvoke( ...fns: Array<TFunction<any, any>>): TFunction<any, any> { return pipedInvokeFromArray( fns ) }
|
|
64
76
|
|
|
77
|
+
export function pipedInvokeFromArray<T, R>( fns: Array<TFunction<any, any>>): TFunction<any, any> {
|
|
78
|
+
if ( fns.length === 0 ) {
|
|
79
|
+
return identity as TFunction<any, any>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if ( fns.length === 1 ) {
|
|
83
|
+
return fns[ 0 ];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return function piped( input: T ): R {
|
|
87
|
+
return fns.reduce( ( prev: any, fn: TFunction<T, R> ) => fn( prev ), input as any );
|
|
88
|
+
};
|
|
89
|
+
}
|
package/src/utils/numbers.ts
CHANGED
|
@@ -94,6 +94,9 @@ export function clamp( n: number, min: number, max: number ): number {
|
|
|
94
94
|
return n;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
+
export function clampInt0_100( n: number ) {
|
|
98
|
+
return clamp( Math.round( n ), 0, 100 ) as TNumber0_100;
|
|
99
|
+
}
|
|
97
100
|
|
|
98
101
|
export function tryToParseNumber( numberStr: string ) {
|
|
99
102
|
return withTryCatch( () => {
|
package/src/utils/promises.ts
CHANGED
package/dist/async/index.d.ts
DELETED
package/dist/lazy/index.d.ts
DELETED
package/dist/sorting/index.d.ts
DELETED
package/dist/time/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as RandomTimeDuration } from './RandomTimeDuration';
|
|
2
|
-
export { TPredefinedTimeDuration, TValidTimeDuration, TimeDuration, isAllowedTimeDuration } from './TimeDuration';
|
|
3
|
-
export { default as TimeFrequency } from './TimeFrequency';
|
|
4
|
-
export * from './TimeInstant';
|
|
5
|
-
export * from './TimeRange.js';
|
|
6
|
-
export { default as TimeUnit } from './TimeUnit';
|
|
7
|
-
export * from './types';
|
package/dist/upgrade/index.d.ts
DELETED
package/dist/utils/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './arrays.js';
|
|
2
|
-
export * from './booleans.js';
|
|
3
|
-
export { TCssDeclarationRulesDictionary as TCSSDeclarationRulesDictionary, cssDeclarationRulesDictionaryToCss } from './css.js';
|
|
4
|
-
export * from './empties.js';
|
|
5
|
-
export * from './errors.js';
|
|
6
|
-
export * from './functions.js';
|
|
7
|
-
export * from './json.js';
|
|
8
|
-
export * from './nulls.js';
|
|
9
|
-
export * from './numbers.js';
|
|
10
|
-
export * from './primitives.js';
|
|
11
|
-
export * from './promises.js';
|
|
12
|
-
export * from './random.js';
|
|
13
|
-
export * from './records.js';
|
|
14
|
-
export * from './strings.js';
|