@tempots/std 0.11.0 → 0.13.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/array.cjs +1 -1
- package/array.d.ts +325 -35
- package/array.js +148 -152
- package/async-result.cjs +1 -1
- package/async-result.d.ts +152 -13
- package/async-result.js +112 -8
- package/bigint.cjs +1 -1
- package/bigint.d.ts +155 -18
- package/bigint.js +37 -37
- package/boolean.cjs +1 -1
- package/boolean.d.ts +39 -7
- package/boolean.js +10 -10
- package/domain.d.ts +146 -5
- package/equal.d.ts +26 -0
- package/function.cjs +1 -1
- package/function.d.ts +24 -18
- package/function.js +10 -29
- package/index.cjs +1 -0
- package/index.d.ts +13 -0
- package/index.js +179 -0
- package/json.d.ts +20 -1
- package/number.cjs +1 -1
- package/number.d.ts +347 -57
- package/number.js +31 -32
- package/object.cjs +1 -1
- package/object.d.ts +53 -5
- package/object.js +15 -15
- package/package.json +8 -8
- package/regexp.cjs +1 -1
- package/regexp.d.ts +5 -4
- package/regexp.js +8 -8
- package/result-Czm7RKNP.js +230 -0
- package/result-DzdZiQoR.cjs +1 -0
- package/result.cjs +1 -1
- package/result.d.ts +130 -6
- package/result.js +3 -54
- package/string.cjs +4 -4
- package/string.d.ts +532 -95
- package/string.js +192 -205
- package/validation.cjs +1 -1
- package/validation.d.ts +72 -4
- package/validation.js +2 -23
- package/maybe.cjs +0 -1
- package/maybe.d.ts +0 -9
- package/maybe.js +0 -9
package/domain.d.ts
CHANGED
|
@@ -1,25 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a type that can either hold a value of type T or be undefined.
|
|
3
|
+
*
|
|
4
|
+
* @typeParam T - The type of the value that the Maybe type can hold.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type Maybe<T> = T | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Represents a key type that can be used to index any object.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
1
12
|
export type IndexKey = keyof any;
|
|
13
|
+
/**
|
|
14
|
+
* Represents a primitive value that can be of type string, boolean, number, null, or undefined.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
2
17
|
export type Primitive = string | boolean | number | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Represents a value that can be either `undefined` or `null`.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
3
22
|
export type Nothing = undefined | null;
|
|
23
|
+
/**
|
|
24
|
+
* Represents a function that compares two values of type T and returns a number.
|
|
25
|
+
* The returned number indicates the relative order of the two values:
|
|
26
|
+
* - A negative number if `a` is less than `b`.
|
|
27
|
+
* - Zero if `a` is equal to `b`.
|
|
28
|
+
* - A positive number if `a` is greater than `b`.
|
|
29
|
+
*
|
|
30
|
+
* @typeParam T - The type of values being compared.
|
|
31
|
+
*
|
|
32
|
+
* @param a - The first value to compare.
|
|
33
|
+
* @param b - The second value to compare.
|
|
34
|
+
* @returns A number indicating the relative order of the two values.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
4
37
|
export type Compare<T> = (a: T, b: T) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Represents an identity type that preserves the properties of the original type.
|
|
40
|
+
* @typeParam T - The original type.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
5
43
|
export type Id<T> = {} & {
|
|
6
44
|
[P in keyof T]: T[P];
|
|
7
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Represents the type resulting from merging two types `A` and `B`.
|
|
48
|
+
* The resulting type is the intersection of `A` and `B`.
|
|
49
|
+
*
|
|
50
|
+
* @typeParam A - The first type to merge.
|
|
51
|
+
* @typeParam B - The second type to merge.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
8
54
|
export type Merge<A, B> = Id<A & B>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Converts a tuple type to a union type.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam T - The tuple type to convert.
|
|
59
|
+
* @param T - The tuple to convert to a union.
|
|
60
|
+
* @returns The union type.
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
14
63
|
export type TupleToUnion<T extends unknown[]> = T[number];
|
|
64
|
+
/**
|
|
65
|
+
* Represents a function that takes no arguments and returns a value of type `R`.
|
|
66
|
+
* @typeParam R - The return type of the function.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
15
69
|
export type Fun0<R> = () => R;
|
|
70
|
+
/**
|
|
71
|
+
* Represents a function that takes one argument of type `A` and returns a value of type `R`.
|
|
72
|
+
* @typeParam A - The type of the function argument.
|
|
73
|
+
* @typeParam R - The type of the function return value.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
16
76
|
export type Fun1<A, R> = (a: A) => R;
|
|
77
|
+
/**
|
|
78
|
+
* Represents a function that takes two arguments of types `A` and `B`, and returns a value of type `R`.
|
|
79
|
+
* @typeParam A - The type of the first argument.
|
|
80
|
+
* @typeParam B - The type of the second argument.
|
|
81
|
+
* @typeParam R - The type of the return value.
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
17
84
|
export type Fun2<A, B, R> = (a: A, b: B) => R;
|
|
85
|
+
/**
|
|
86
|
+
* Represents a function that takes three arguments of types A, B, and C, and returns a value of type R.
|
|
87
|
+
*
|
|
88
|
+
* @typeParam A - The type of the first argument.
|
|
89
|
+
* @typeParam B - The type of the second argument.
|
|
90
|
+
* @typeParam C - The type of the third argument.
|
|
91
|
+
* @typeParam R - The type of the return value.
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
18
94
|
export type Fun3<A, B, C, R> = (a: A, b: B, c: C) => R;
|
|
95
|
+
/**
|
|
96
|
+
* Represents a function that takes four arguments of types A, B, C, and D,
|
|
97
|
+
* and returns a value of type R.
|
|
98
|
+
*
|
|
99
|
+
* @typeParam A - The type of the first argument.
|
|
100
|
+
* @typeParam B - The type of the second argument.
|
|
101
|
+
* @typeParam C - The type of the third argument.
|
|
102
|
+
* @typeParam D - The type of the fourth argument.
|
|
103
|
+
* @typeParam R - The type of the return value.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
19
106
|
export type Fun4<A, B, C, D, R> = (a: A, b: B, c: C, d: D) => R;
|
|
107
|
+
/**
|
|
108
|
+
* Represents a function that takes five arguments of types A, B, C, D, and E,
|
|
109
|
+
* and returns a value of type R.
|
|
110
|
+
*
|
|
111
|
+
* @typeParam A - The type of the first argument.
|
|
112
|
+
* @typeParam B - The type of the second argument.
|
|
113
|
+
* @typeParam C - The type of the third argument.
|
|
114
|
+
* @typeParam D - The type of the fourth argument.
|
|
115
|
+
* @typeParam E - The type of the fifth argument.
|
|
116
|
+
* @typeParam R - The type of the return value.
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
20
119
|
export type Fun5<A, B, C, D, E, R> = (a: A, b: B, c: C, d: D, e: E) => R;
|
|
120
|
+
/**
|
|
121
|
+
* Represents a function that takes six arguments of types A, B, C, D, E, F and returns a value of type R.
|
|
122
|
+
* @typeParam A - The type of the first argument.
|
|
123
|
+
* @typeParam B - The type of the second argument.
|
|
124
|
+
* @typeParam C - The type of the third argument.
|
|
125
|
+
* @typeParam D - The type of the fourth argument.
|
|
126
|
+
* @typeParam E - The type of the fifth argument.
|
|
127
|
+
* @typeParam F - The type of the sixth argument.
|
|
128
|
+
* @typeParam R - The type of the return value.
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
21
131
|
export type Fun6<A, B, C, D, E, F, R> = (a: A, b: B, c: C, d: D, e: E, f: F) => R;
|
|
132
|
+
/**
|
|
133
|
+
* Extracts the first argument type from a function type.
|
|
134
|
+
* @typeParam F - The function type.
|
|
135
|
+
* @returns The type of the first argument of the function type.
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
22
138
|
export type FirstArgument<F> = F extends Fun1<infer A, unknown> ? A : never;
|
|
139
|
+
/**
|
|
140
|
+
* Filters out elements from a tuple that are equal to the specified type.
|
|
141
|
+
*
|
|
142
|
+
* @typeParam T - The input tuple.
|
|
143
|
+
* @typeParam N - The type to filter out from the tuple.
|
|
144
|
+
* @param T - The input tuple.
|
|
145
|
+
* @returns The filtered tuple.
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
23
148
|
export type FilterTuple<T extends unknown[], N> = T extends [] ? [] : T extends [infer H, ...infer R] ? N extends H ? FilterTuple<R, N> : [H, ...FilterTuple<R, N>] : T;
|
|
149
|
+
/**
|
|
150
|
+
* Splits a string literal type `T` by a specified delimiter `SplitBy`.
|
|
151
|
+
* Returns a tuple containing the split parts of the string.
|
|
152
|
+
*
|
|
153
|
+
* @typeParam T - The string literal type to split.
|
|
154
|
+
* @typeParam SplitBy - The delimiter to split the string by.
|
|
155
|
+
* @returns A tuple containing the split parts of the string.
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
24
158
|
export type SplitLiteral<T extends string, SplitBy extends string> = FilterTuple<T extends `${infer A}${SplitBy}${infer B}` ? [...SplitLiteral<A, SplitBy>, ...SplitLiteral<B, SplitBy>] : [T], ''>;
|
|
159
|
+
/**
|
|
160
|
+
* Converts a string literal type `T` into a union type by splitting it using the specified delimiter `SplitBy`.
|
|
161
|
+
* @typeParam T - The string literal type to split.
|
|
162
|
+
* @typeParam SplitBy - The delimiter used to split the string literal type.
|
|
163
|
+
* @returns A union type representing the split values of the string literal type.
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
25
166
|
export type SplitLiteralToUnion<T extends string, SplitBy extends string> = TupleToUnion<SplitLiteral<T, SplitBy>>;
|
package/equal.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if two values are strictly equal.
|
|
3
|
+
*
|
|
4
|
+
* @typeParam A - The type of the values to compare.
|
|
5
|
+
* @param a - The first value to compare.
|
|
6
|
+
* @param b - The second value to compare.
|
|
7
|
+
* @returns `true` if the values are strictly equal, `false` otherwise.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
1
10
|
export declare function strictEqual<A>(a: A, b: A): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if two values are equal by comparing their contents.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam A - The type of the values being compared.
|
|
15
|
+
* @param a - The first value to compare.
|
|
16
|
+
* @param b - The second value to compare.
|
|
17
|
+
* @returns `true` if the values are deeply equal, `false` otherwise.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
2
20
|
export declare function deepEqual<A>(a: A, b: A): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if two values are loosely equal.
|
|
23
|
+
*
|
|
24
|
+
* @param a - The first value to compare.
|
|
25
|
+
* @param b - The second value to compare.
|
|
26
|
+
* @returns `true` if the values are loosely equal, `false` otherwise.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
3
29
|
export declare function looseEqual<T>(a: T, b: T): boolean;
|
package/function.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(e){return e}function n(e){return t=>(...r)=>e(t,...r)}function u(e){let t;return()=>(t===void 0&&(t=e()),t)}exports.curryLeft=n;exports.identity=i;exports.memoize=u;
|
package/function.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns the input value as is.
|
|
3
|
+
*
|
|
4
|
+
* @param v - The value to be returned.
|
|
5
|
+
* @returns The input value.
|
|
6
|
+
* @typeParam T - The type of the input value.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
8
9
|
export declare function identity<T>(v: T): T;
|
|
10
|
+
/**
|
|
11
|
+
* Curries a function from left to right.
|
|
12
|
+
*
|
|
13
|
+
* @param f - The function to curry.
|
|
14
|
+
* @returns A curried function.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
9
17
|
export declare function curryLeft<A, Rest extends any[], Ret>(f: (a: A, ...rest: Rest) => Ret): (a: A) => (...rest: Rest) => Ret;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare function flip<A, B, C, D, E, F, G>(f: (a: A, b: B, c: C, d: D, e: E, f: F) => G): (f: F, e: E, d: D, c: C, b: B, a: A) => G;
|
|
20
|
-
export declare function id<T>(v: T): T;
|
|
18
|
+
/**
|
|
19
|
+
* Memoizes the result of a function and returns a new function that caches the result.
|
|
20
|
+
* The cached result is returned if available, otherwise the original function is called
|
|
21
|
+
* and the result is cached for future invocations.
|
|
22
|
+
*
|
|
23
|
+
* @param f - The function to memoize.
|
|
24
|
+
* @returns A new function that caches the result of the original function.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
21
27
|
export declare function memoize<T>(f: () => NonNullable<T>): () => NonNullable<T>;
|
package/function.js
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function r(t) {
|
|
2
|
+
return t;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return n;
|
|
4
|
+
function u(t) {
|
|
5
|
+
return (e) => (...n) => t(e, ...n);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function o(n) {
|
|
11
|
-
return (...r) => (
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
(t) => n(...r.concat([t]))
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
function f(n) {
|
|
17
|
-
return (...r) => n(...r.reverse());
|
|
18
|
-
}
|
|
19
|
-
function d(n) {
|
|
20
|
-
return n;
|
|
21
|
-
}
|
|
22
|
-
function l(n) {
|
|
23
|
-
let r;
|
|
24
|
-
return () => (r === void 0 && (r = n()), r);
|
|
7
|
+
function i(t) {
|
|
8
|
+
let e;
|
|
9
|
+
return () => (e === void 0 && (e = t()), e);
|
|
25
10
|
}
|
|
26
11
|
export {
|
|
27
|
-
u as
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
f as flip,
|
|
31
|
-
d as id,
|
|
32
|
-
i as identity,
|
|
33
|
-
l as memoize
|
|
12
|
+
u as curryLeft,
|
|
13
|
+
r as identity,
|
|
14
|
+
i as memoize
|
|
34
15
|
};
|
package/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),l=require("./async-result.cjs"),i=require("./bigint.cjs"),s=require("./equal.cjs"),n=require("./function.cjs"),t=require("./number.cjs"),a=require("./object.cjs"),c=require("./regexp.cjs"),o=require("./result-DzdZiQoR.cjs"),e=require("./string.cjs");exports.allElements=r.allElements;exports.anyElement=r.anyElement;exports.applyArrayDiffOperations=r.applyArrayDiffOperations;exports.areArraysEqual=r.areArraysEqual;exports.arrayDiffOperations=r.arrayDiffOperations;exports.arrayHasValues=r.arrayHasValues;exports.arrayHead=r.arrayHead;exports.arrayOfIterableIterator=r.arrayOfIterableIterator;exports.arrayTail=r.arrayTail;exports.compareArrays=r.compareArrays;exports.concatArrays=r.concatArrays;exports.createFilledArray=r.createFilledArray;exports.filterArray=r.filterArray;exports.filterMapArray=r.filterMapArray;exports.filterNullsFromArray=r.filterNullsFromArray;exports.flatMapArray=r.flatMapArray;exports.flattenArray=r.flattenArray;exports.foldLeftArray=r.foldLeftArray;exports.forEachElement=r.forEachElement;exports.generateArray=r.generateArray;exports.generateSequenceArray=r.generateSequenceArray;exports.isArrayEmpty=r.isArrayEmpty;exports.joinArrayWithConjunction=r.joinArrayWithConjunction;exports.mapArray=r.mapArray;exports.rankArray=r.rankArray;exports.removeAllFromArray=r.removeAllFromArray;exports.removeAllFromArrayByPredicate=r.removeAllFromArrayByPredicate;exports.removeOneFromArray=r.removeOneFromArray;exports.removeOneFromArrayByPredicate=r.removeOneFromArrayByPredicate;exports.sortArray=r.sortArray;exports.uniqueByPredicate=r.uniqueByPredicate;exports.uniquePrimitives=r.uniquePrimitives;exports.AsyncResult=l.AsyncResult;exports.biAbs=i.biAbs;exports.biCeilDiv=i.biCeilDiv;exports.biCompare=i.biCompare;exports.biFloorDiv=i.biFloorDiv;exports.biGcd=i.biGcd;exports.biIsEven=i.biIsEven;exports.biIsNegative=i.biIsNegative;exports.biIsOdd=i.biIsOdd;exports.biIsOne=i.biIsOne;exports.biIsPositive=i.biIsPositive;exports.biIsPrime=i.biIsPrime;exports.biIsZero=i.biIsZero;exports.biLcm=i.biLcm;exports.biMax=i.biMax;exports.biMin=i.biMin;exports.biNextPrime=i.biNextPrime;exports.biPow=i.biPow;exports.biPrevPrime=i.biPrevPrime;exports.deepEqual=s.deepEqual;exports.looseEqual=s.looseEqual;exports.strictEqual=s.strictEqual;exports.curryLeft=n.curryLeft;exports.identity=n.identity;exports.memoize=n.memoize;exports.EPSILON=t.EPSILON;exports.angleDifference=t.angleDifference;exports.ceilTo=t.ceilTo;exports.clamp=t.clamp;exports.clampInt=t.clampInt;exports.clampSym=t.clampSym;exports.compareNumbers=t.compareNumbers;exports.floorTo=t.floorTo;exports.interpolate=t.interpolate;exports.interpolateAngle=t.interpolateAngle;exports.interpolateAngleCCW=t.interpolateAngleCCW;exports.interpolateAngleCW=t.interpolateAngleCW;exports.interpolateWidestAngle=t.interpolateWidestAngle;exports.nearEqualAngles=t.nearEqualAngles;exports.nearEquals=t.nearEquals;exports.nearZero=t.nearZero;exports.root=t.root;exports.roundTo=t.roundTo;exports.sign=t.sign;exports.toHex=t.toHex;exports.widestAngleDifference=t.widestAngleDifference;exports.wrap=t.wrap;exports.wrapCircular=t.wrapCircular;exports.isEmptyObject=a.isEmptyObject;exports.isObject=a.isObject;exports.mergeObjects=a.mergeObjects;exports.objectKeys=a.objectKeys;exports.removeObjectFields=a.removeObjectFields;exports.sameObjectKeys=a.sameObjectKeys;exports.mapRegExp=c.mapRegExp;exports.Result=o.Result;exports.Validation=o.Validation;exports.afterLastText=e.afterLastText;exports.afterText=e.afterText;exports.beforeLastText=e.beforeLastText;exports.beforeText=e.beforeText;exports.canonicalizeNewlines=e.canonicalizeNewlines;exports.capitalize=e.capitalize;exports.capitalizeWords=e.capitalizeWords;exports.chunkText=e.chunkText;exports.compareCaseInsensitive=e.compareCaseInsensitive;exports.compareStrings=e.compareStrings;exports.containsAllText=e.containsAllText;exports.containsAllTextCaseInsensitive=e.containsAllTextCaseInsensitive;exports.containsAnyText=e.containsAnyText;exports.containsAnyTextCaseInsensitive=e.containsAnyTextCaseInsensitive;exports.countTextOccurrences=e.countTextOccurrences;exports.dasherize=e.dasherize;exports.decodeBase64=e.decodeBase64;exports.ellipsis=e.ellipsis;exports.ellipsisMiddle=e.ellipsisMiddle;exports.encodeBase64=e.encodeBase64;exports.endsWithAnyText=e.endsWithAnyText;exports.filterCharcode=e.filterCharcode;exports.filterText=e.filterText;exports.humanize=e.humanize;exports.ifEmptyString=e.ifEmptyString;exports.isAlpha=e.isAlpha;exports.isAlphaNum=e.isAlphaNum;exports.isBreakingWhitespace=e.isBreakingWhitespace;exports.isDigitsOnly=e.isDigitsOnly;exports.isEmptyString=e.isEmptyString;exports.isLowerCase=e.isLowerCase;exports.isSpaceAt=e.isSpaceAt;exports.isUpperCase=e.isUpperCase;exports.jsQuote=e.jsQuote;exports.lowerCaseFirst=e.lowerCaseFirst;exports.lpad=e.lpad;exports.mapChars=e.mapChars;exports.quote=e.quote;exports.randomString=e.randomString;exports.randomStringSequence=e.randomStringSequence;exports.randomStringSequenceBase64=e.randomStringSequenceBase64;exports.removeFirstFromString=e.removeFirstFromString;exports.removeFromString=e.removeFromString;exports.removeFromStringAfter=e.removeFromStringAfter;exports.removeFromStringBefore=e.removeFromStringBefore;exports.removeSliceFromString=e.removeSliceFromString;exports.repeatString=e.repeatString;exports.replaceAll=e.replaceAll;exports.reverseString=e.reverseString;exports.rpad=e.rpad;exports.smartQuote=e.smartQuote;exports.splitOnFirst=e.splitOnFirst;exports.splitOnLast=e.splitOnLast;exports.splitStringOnce=e.splitStringOnce;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringToCharcodes=e.stringToCharcodes;exports.stringToChars=e.stringToChars;exports.stringToLines=e.stringToLines;exports.stringsDifferAtIndex=e.stringsDifferAtIndex;exports.surroundText=e.surroundText;exports.textCollapse=e.textCollapse;exports.textContains=e.textContains;exports.textContainsCaseInsensitive=e.textContainsCaseInsensitive;exports.textEndsWith=e.textEndsWith;exports.textEndsWithAnyCaseInsensitive=e.textEndsWithAnyCaseInsensitive;exports.textEndsWithCaseInsensitive=e.textEndsWithCaseInsensitive;exports.textStartsWith=e.textStartsWith;exports.textStartsWithAny=e.textStartsWithAny;exports.textStartsWithAnyCaseInsensitive=e.textStartsWithAnyCaseInsensitive;exports.textStartsWithCaseInsensitive=e.textStartsWithCaseInsensitive;exports.trimChars=e.trimChars;exports.trimCharsLeft=e.trimCharsLeft;exports.trimCharsRight=e.trimCharsRight;exports.underscore=e.underscore;exports.upperCaseFirst=e.upperCaseFirst;exports.wrapColumns=e.wrapColumns;exports.wrapLine=e.wrapLine;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './array';
|
|
2
|
+
export * from './async-result';
|
|
3
|
+
export * from './bigint';
|
|
4
|
+
export * from './domain';
|
|
5
|
+
export * from './equal';
|
|
6
|
+
export * from './function';
|
|
7
|
+
export * from './json';
|
|
8
|
+
export * from './number';
|
|
9
|
+
export * from './object';
|
|
10
|
+
export * from './regexp';
|
|
11
|
+
export * from './result';
|
|
12
|
+
export * from './string';
|
|
13
|
+
export * from './validation';
|
package/index.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { allElements as t, anyElement as i, applyArrayDiffOperations as a, areArraysEqual as s, arrayDiffOperations as n, arrayHasValues as o, arrayHead as l, arrayOfIterableIterator as m, arrayTail as p, compareArrays as c, concatArrays as y, createFilledArray as A, filterArray as f, filterMapArray as d, filterNullsFromArray as x, flatMapArray as g, flattenArray as u, foldLeftArray as C, forEachElement as b, generateArray as v, generateSequenceArray as h, isArrayEmpty as S, joinArrayWithConjunction as E, mapArray as I, rankArray as T, removeAllFromArray as O, removeAllFromArrayByPredicate as F, removeOneFromArray as W, removeOneFromArrayByPredicate as q, sortArray as L, uniqueByPredicate as P, uniquePrimitives as j } from "./array.js";
|
|
2
|
+
import { AsyncResult as B } from "./async-result.js";
|
|
3
|
+
import { biAbs as N, biCeilDiv as z, biCompare as H, biFloorDiv as M, biGcd as R, biIsEven as k, biIsNegative as V, biIsOdd as K, biIsOne as Q, biIsPositive as Z, biIsPrime as G, biIsZero as U, biLcm as J, biMax as X, biMin as Y, biNextPrime as _, biPow as $, biPrevPrime as ee } from "./bigint.js";
|
|
4
|
+
import { deepEqual as te, looseEqual as ie, strictEqual as ae } from "./equal.js";
|
|
5
|
+
import { curryLeft as ne, identity as oe, memoize as le } from "./function.js";
|
|
6
|
+
import { EPSILON as pe, angleDifference as ce, ceilTo as ye, clamp as Ae, clampInt as fe, clampSym as de, compareNumbers as xe, floorTo as ge, interpolate as ue, interpolateAngle as Ce, interpolateAngleCCW as be, interpolateAngleCW as ve, interpolateWidestAngle as he, nearEqualAngles as Se, nearEquals as Ee, nearZero as Ie, root as Te, roundTo as Oe, sign as Fe, toHex as We, widestAngleDifference as qe, wrap as Le, wrapCircular as Pe } from "./number.js";
|
|
7
|
+
import { isEmptyObject as we, isObject as Be, mergeObjects as De, objectKeys as Ne, removeObjectFields as ze, sameObjectKeys as He } from "./object.js";
|
|
8
|
+
import { mapRegExp as Re } from "./regexp.js";
|
|
9
|
+
import { R as Ve, V as Ke } from "./result-Czm7RKNP.js";
|
|
10
|
+
import { afterLastText as Ze, afterText as Ge, beforeLastText as Ue, beforeText as Je, canonicalizeNewlines as Xe, capitalize as Ye, capitalizeWords as _e, chunkText as $e, compareCaseInsensitive as er, compareStrings as rr, containsAllText as tr, containsAllTextCaseInsensitive as ir, containsAnyText as ar, containsAnyTextCaseInsensitive as sr, countTextOccurrences as nr, dasherize as or, decodeBase64 as lr, ellipsis as mr, ellipsisMiddle as pr, encodeBase64 as cr, endsWithAnyText as yr, filterCharcode as Ar, filterText as fr, humanize as dr, ifEmptyString as xr, isAlpha as gr, isAlphaNum as ur, isBreakingWhitespace as Cr, isDigitsOnly as br, isEmptyString as vr, isLowerCase as hr, isSpaceAt as Sr, isUpperCase as Er, jsQuote as Ir, lowerCaseFirst as Tr, lpad as Or, mapChars as Fr, quote as Wr, randomString as qr, randomStringSequence as Lr, randomStringSequenceBase64 as Pr, removeFirstFromString as jr, removeFromString as wr, removeFromStringAfter as Br, removeFromStringBefore as Dr, removeSliceFromString as Nr, repeatString as zr, replaceAll as Hr, reverseString as Mr, rpad as Rr, smartQuote as kr, splitOnFirst as Vr, splitOnLast as Kr, splitStringOnce as Qr, stringHasContent as Zr, stringHashCode as Gr, stringToCharcodes as Ur, stringToChars as Jr, stringToLines as Xr, stringsDifferAtIndex as Yr, surroundText as _r, textCollapse as $r, textContains as et, textContainsCaseInsensitive as rt, textEndsWith as tt, textEndsWithAnyCaseInsensitive as it, textEndsWithCaseInsensitive as at, textStartsWith as st, textStartsWithAny as nt, textStartsWithAnyCaseInsensitive as ot, textStartsWithCaseInsensitive as lt, trimChars as mt, trimCharsLeft as pt, trimCharsRight as ct, underscore as yt, upperCaseFirst as At, wrapColumns as ft, wrapLine as dt } from "./string.js";
|
|
11
|
+
export {
|
|
12
|
+
B as AsyncResult,
|
|
13
|
+
pe as EPSILON,
|
|
14
|
+
Ve as Result,
|
|
15
|
+
Ke as Validation,
|
|
16
|
+
Ze as afterLastText,
|
|
17
|
+
Ge as afterText,
|
|
18
|
+
t as allElements,
|
|
19
|
+
ce as angleDifference,
|
|
20
|
+
i as anyElement,
|
|
21
|
+
a as applyArrayDiffOperations,
|
|
22
|
+
s as areArraysEqual,
|
|
23
|
+
n as arrayDiffOperations,
|
|
24
|
+
o as arrayHasValues,
|
|
25
|
+
l as arrayHead,
|
|
26
|
+
m as arrayOfIterableIterator,
|
|
27
|
+
p as arrayTail,
|
|
28
|
+
Ue as beforeLastText,
|
|
29
|
+
Je as beforeText,
|
|
30
|
+
N as biAbs,
|
|
31
|
+
z as biCeilDiv,
|
|
32
|
+
H as biCompare,
|
|
33
|
+
M as biFloorDiv,
|
|
34
|
+
R as biGcd,
|
|
35
|
+
k as biIsEven,
|
|
36
|
+
V as biIsNegative,
|
|
37
|
+
K as biIsOdd,
|
|
38
|
+
Q as biIsOne,
|
|
39
|
+
Z as biIsPositive,
|
|
40
|
+
G as biIsPrime,
|
|
41
|
+
U as biIsZero,
|
|
42
|
+
J as biLcm,
|
|
43
|
+
X as biMax,
|
|
44
|
+
Y as biMin,
|
|
45
|
+
_ as biNextPrime,
|
|
46
|
+
$ as biPow,
|
|
47
|
+
ee as biPrevPrime,
|
|
48
|
+
Xe as canonicalizeNewlines,
|
|
49
|
+
Ye as capitalize,
|
|
50
|
+
_e as capitalizeWords,
|
|
51
|
+
ye as ceilTo,
|
|
52
|
+
$e as chunkText,
|
|
53
|
+
Ae as clamp,
|
|
54
|
+
fe as clampInt,
|
|
55
|
+
de as clampSym,
|
|
56
|
+
c as compareArrays,
|
|
57
|
+
er as compareCaseInsensitive,
|
|
58
|
+
xe as compareNumbers,
|
|
59
|
+
rr as compareStrings,
|
|
60
|
+
y as concatArrays,
|
|
61
|
+
tr as containsAllText,
|
|
62
|
+
ir as containsAllTextCaseInsensitive,
|
|
63
|
+
ar as containsAnyText,
|
|
64
|
+
sr as containsAnyTextCaseInsensitive,
|
|
65
|
+
nr as countTextOccurrences,
|
|
66
|
+
A as createFilledArray,
|
|
67
|
+
ne as curryLeft,
|
|
68
|
+
or as dasherize,
|
|
69
|
+
lr as decodeBase64,
|
|
70
|
+
te as deepEqual,
|
|
71
|
+
mr as ellipsis,
|
|
72
|
+
pr as ellipsisMiddle,
|
|
73
|
+
cr as encodeBase64,
|
|
74
|
+
yr as endsWithAnyText,
|
|
75
|
+
f as filterArray,
|
|
76
|
+
Ar as filterCharcode,
|
|
77
|
+
d as filterMapArray,
|
|
78
|
+
x as filterNullsFromArray,
|
|
79
|
+
fr as filterText,
|
|
80
|
+
g as flatMapArray,
|
|
81
|
+
u as flattenArray,
|
|
82
|
+
ge as floorTo,
|
|
83
|
+
C as foldLeftArray,
|
|
84
|
+
b as forEachElement,
|
|
85
|
+
v as generateArray,
|
|
86
|
+
h as generateSequenceArray,
|
|
87
|
+
dr as humanize,
|
|
88
|
+
oe as identity,
|
|
89
|
+
xr as ifEmptyString,
|
|
90
|
+
ue as interpolate,
|
|
91
|
+
Ce as interpolateAngle,
|
|
92
|
+
be as interpolateAngleCCW,
|
|
93
|
+
ve as interpolateAngleCW,
|
|
94
|
+
he as interpolateWidestAngle,
|
|
95
|
+
gr as isAlpha,
|
|
96
|
+
ur as isAlphaNum,
|
|
97
|
+
S as isArrayEmpty,
|
|
98
|
+
Cr as isBreakingWhitespace,
|
|
99
|
+
br as isDigitsOnly,
|
|
100
|
+
we as isEmptyObject,
|
|
101
|
+
vr as isEmptyString,
|
|
102
|
+
hr as isLowerCase,
|
|
103
|
+
Be as isObject,
|
|
104
|
+
Sr as isSpaceAt,
|
|
105
|
+
Er as isUpperCase,
|
|
106
|
+
E as joinArrayWithConjunction,
|
|
107
|
+
Ir as jsQuote,
|
|
108
|
+
ie as looseEqual,
|
|
109
|
+
Tr as lowerCaseFirst,
|
|
110
|
+
Or as lpad,
|
|
111
|
+
I as mapArray,
|
|
112
|
+
Fr as mapChars,
|
|
113
|
+
Re as mapRegExp,
|
|
114
|
+
le as memoize,
|
|
115
|
+
De as mergeObjects,
|
|
116
|
+
Se as nearEqualAngles,
|
|
117
|
+
Ee as nearEquals,
|
|
118
|
+
Ie as nearZero,
|
|
119
|
+
Ne as objectKeys,
|
|
120
|
+
Wr as quote,
|
|
121
|
+
qr as randomString,
|
|
122
|
+
Lr as randomStringSequence,
|
|
123
|
+
Pr as randomStringSequenceBase64,
|
|
124
|
+
T as rankArray,
|
|
125
|
+
O as removeAllFromArray,
|
|
126
|
+
F as removeAllFromArrayByPredicate,
|
|
127
|
+
jr as removeFirstFromString,
|
|
128
|
+
wr as removeFromString,
|
|
129
|
+
Br as removeFromStringAfter,
|
|
130
|
+
Dr as removeFromStringBefore,
|
|
131
|
+
ze as removeObjectFields,
|
|
132
|
+
W as removeOneFromArray,
|
|
133
|
+
q as removeOneFromArrayByPredicate,
|
|
134
|
+
Nr as removeSliceFromString,
|
|
135
|
+
zr as repeatString,
|
|
136
|
+
Hr as replaceAll,
|
|
137
|
+
Mr as reverseString,
|
|
138
|
+
Te as root,
|
|
139
|
+
Oe as roundTo,
|
|
140
|
+
Rr as rpad,
|
|
141
|
+
He as sameObjectKeys,
|
|
142
|
+
Fe as sign,
|
|
143
|
+
kr as smartQuote,
|
|
144
|
+
L as sortArray,
|
|
145
|
+
Vr as splitOnFirst,
|
|
146
|
+
Kr as splitOnLast,
|
|
147
|
+
Qr as splitStringOnce,
|
|
148
|
+
ae as strictEqual,
|
|
149
|
+
Zr as stringHasContent,
|
|
150
|
+
Gr as stringHashCode,
|
|
151
|
+
Ur as stringToCharcodes,
|
|
152
|
+
Jr as stringToChars,
|
|
153
|
+
Xr as stringToLines,
|
|
154
|
+
Yr as stringsDifferAtIndex,
|
|
155
|
+
_r as surroundText,
|
|
156
|
+
$r as textCollapse,
|
|
157
|
+
et as textContains,
|
|
158
|
+
rt as textContainsCaseInsensitive,
|
|
159
|
+
tt as textEndsWith,
|
|
160
|
+
it as textEndsWithAnyCaseInsensitive,
|
|
161
|
+
at as textEndsWithCaseInsensitive,
|
|
162
|
+
st as textStartsWith,
|
|
163
|
+
nt as textStartsWithAny,
|
|
164
|
+
ot as textStartsWithAnyCaseInsensitive,
|
|
165
|
+
lt as textStartsWithCaseInsensitive,
|
|
166
|
+
We as toHex,
|
|
167
|
+
mt as trimChars,
|
|
168
|
+
pt as trimCharsLeft,
|
|
169
|
+
ct as trimCharsRight,
|
|
170
|
+
yt as underscore,
|
|
171
|
+
P as uniqueByPredicate,
|
|
172
|
+
j as uniquePrimitives,
|
|
173
|
+
At as upperCaseFirst,
|
|
174
|
+
qe as widestAngleDifference,
|
|
175
|
+
Le as wrap,
|
|
176
|
+
Pe as wrapCircular,
|
|
177
|
+
ft as wrapColumns,
|
|
178
|
+
dt as wrapLine
|
|
179
|
+
};
|
package/json.d.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { Nothing } from './domain';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a JSON primitive value.
|
|
5
|
+
* It can be a string, boolean, number, or Nothing (null or undefined).
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type JSONPrimitive = string | boolean | number | Nothing;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a JSON object.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
2
13
|
export interface JSONObject {
|
|
3
14
|
[k: string]: JSONValue;
|
|
4
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents an array of JSON values.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
5
20
|
export type JSONArray = JSONValue[];
|
|
21
|
+
/**
|
|
22
|
+
* Represents a JSON value, which can be a primitive, an object, or an array.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
6
25
|
export type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
package/number.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./string.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./string.cjs"),l=1e-9;function u(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function s(e,n){const t=Math.pow(10,n);return Math.ceil(e*t)/t}function f(e,n,t){return Math.min(Math.max(e,n),t)}function p(e,n,t){return Math.trunc(f(e,n,t))}function g(e,n){return f(e,-n,n)}function M(e,n){return e<n?-1:e>n?1:0}function h(e,n){const t=Math.pow(10,n);return Math.floor(e*t)/t}function A(e,n=0){return a.lpad(e.toString(16),"0",n)}function o(e,n,t){return(n-e)*t+e}function d(e,n,t,r=360){return i(o(e,e+u(e,n,r),t),r)}function c(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function w(e,n,t,r=360){return i(o(e,e+c(e,n,r),t),r)}function N(e,n,t,r=360){return e=i(e,r),n=i(n,r),n<e&&(n+=r),i(o(e,n,t),r)}function m(e,n,t,r=360){return e=i(e,r),n=i(n,r),n>e&&(n-=r),i(o(e,n,t),r)}function C(e,n,t=l){return isFinite(e)?isFinite(n)?Math.abs(e-n)<=t:!1:isNaN(e)?isNaN(n):isNaN(n)||isFinite(n)?!1:e>0==n>0}function S(e,n,t=360,r=l){return Math.abs(u(e,n,t))<=r}function T(e,n=l){return Math.abs(e)<=n}function E(e,n){return Math.pow(e,1/n)}function W(e,n){const t=Math.pow(10,n);return Math.round(e*t)/t}function q(e){return e<0?-1:1}function y(e,n,t){const r=t-n+1;return e<n&&(e+=r*((n-e)/r+1)),n+(e-n)%r}function i(e,n){return e=e%n,e<0&&(e+=n),e}exports.EPSILON=l;exports.angleDifference=u;exports.ceilTo=s;exports.clamp=f;exports.clampInt=p;exports.clampSym=g;exports.compareNumbers=M;exports.floorTo=h;exports.interpolate=o;exports.interpolateAngle=d;exports.interpolateAngleCCW=m;exports.interpolateAngleCW=N;exports.interpolateWidestAngle=w;exports.nearEqualAngles=S;exports.nearEquals=C;exports.nearZero=T;exports.root=E;exports.roundTo=W;exports.sign=q;exports.toHex=A;exports.widestAngleDifference=c;exports.wrap=y;exports.wrapCircular=i;
|