@tempots/std 0.15.0 → 0.16.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.d.ts +0 -1
- package/async-result.cjs +1 -1
- package/async-result.d.ts +6 -1
- package/async-result.js +17 -4
- package/domain.d.ts +16 -0
- package/index.cjs +1 -1
- package/index.js +156 -149
- package/json.cjs +1 -1
- package/json.d.ts +24 -1
- package/json.js +6 -1
- package/object.cjs +1 -1
- package/object.d.ts +24 -1
- package/object.js +14 -11
- package/package.json +1 -1
- package/result.d.ts +0 -1
- package/validation.d.ts +0 -1
package/array.d.ts
CHANGED
package/async-result.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,s){return u.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return u.isSuccess(e)?e.value:s()},getOrNull(e){return u.isSuccess(e)?e.value:null},getOrUndefined(e){return u.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(u.isSuccess(e))return e.value;throw u.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:s,failure:r,loading:t,notAsked:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,s){return u.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return u.isSuccess(e)?e.value:s()},getOrNull(e){return u.isSuccess(e)?e.value:null},getOrUndefined(e){return u.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(u.isSuccess(e))return e.value;throw u.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:s,failure:r,loading:t,notAsked:n=t})=>u.isSuccess(e)?s(e.value):u.isFailure(e)?r(e.error):u.isNotAsked(e)?n():t(e.previousValue),whenSuccess:(e,s)=>(u.isSuccess(e)&&s(e.value),e),whenFailure:(e,s)=>(u.isFailure(e)&&s(e.error),e),equals:(e,s,r={valueEquals:(t,n)=>t===n,errorEquals:(t,n)=>t===n})=>e.type==="AsyncSuccess"&&s.type==="AsyncSuccess"?r.valueEquals(e.value,s.value):e.type==="AsyncFailure"&&s.type==="AsyncFailure"?r.errorEquals(e.error,s.error):e.type==="Loading"&&s.type==="Loading"?r.valueEquals(e.previousValue,s.previousValue):e.type==="NotAsked"&&s.type==="NotAsked",all:e=>{const s=[];for(const r of e)if(u.isSuccess(r))s.push(r.value);else return r;return u.success(s)},ofPromise:async e=>{try{const s=await e;return u.success(s)}catch(s){return u.failure(s instanceof Error?s:new Error(String(s)))}}};exports.AsyncResult=u;
|
package/async-result.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Maybe } from './domain';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Represents the state when a result has not been requested yet.
|
|
5
4
|
* @public
|
|
@@ -195,4 +194,10 @@ export declare const AsyncResult: {
|
|
|
195
194
|
* @returns A single result that is a success if all the input results are successes, otherwise a failure.
|
|
196
195
|
*/
|
|
197
196
|
all: <V, E>(results: AsyncResult<V, E>[]) => AsyncResult<V[], E>;
|
|
197
|
+
/**
|
|
198
|
+
* Converts a Promise to an AsyncResult.
|
|
199
|
+
* @param p - The Promise to convert.
|
|
200
|
+
* @returns A Promise that resolves to an AsyncResult.
|
|
201
|
+
*/
|
|
202
|
+
ofPromise: <V>(p: Promise<V>) => Promise<AsyncResult<V, Error>>;
|
|
198
203
|
};
|
package/async-result.js
CHANGED
|
@@ -131,8 +131,8 @@ const u = {
|
|
|
131
131
|
success: s,
|
|
132
132
|
failure: r,
|
|
133
133
|
loading: t,
|
|
134
|
-
notAsked:
|
|
135
|
-
}) => u.isSuccess(e) ? s(e.value) : u.isFailure(e) ? r(e.error) : u.isNotAsked(e) ?
|
|
134
|
+
notAsked: n = t
|
|
135
|
+
}) => u.isSuccess(e) ? s(e.value) : u.isFailure(e) ? r(e.error) : u.isNotAsked(e) ? n() : t(e.previousValue),
|
|
136
136
|
/**
|
|
137
137
|
* When the result is a success, it applies the function to the value.
|
|
138
138
|
*
|
|
@@ -159,8 +159,8 @@ const u = {
|
|
|
159
159
|
* @returns `true` if the results are equal, `false` otherwise.
|
|
160
160
|
*/
|
|
161
161
|
equals: (e, s, r = {
|
|
162
|
-
valueEquals: (t,
|
|
163
|
-
errorEquals: (t,
|
|
162
|
+
valueEquals: (t, n) => t === n,
|
|
163
|
+
errorEquals: (t, n) => t === n
|
|
164
164
|
}) => e.type === "AsyncSuccess" && s.type === "AsyncSuccess" ? r.valueEquals(e.value, s.value) : e.type === "AsyncFailure" && s.type === "AsyncFailure" ? r.errorEquals(e.error, s.error) : e.type === "Loading" && s.type === "Loading" ? r.valueEquals(e.previousValue, s.previousValue) : e.type === "NotAsked" && s.type === "NotAsked",
|
|
165
165
|
/**
|
|
166
166
|
* Combines multiple results into a single result.
|
|
@@ -175,6 +175,19 @@ const u = {
|
|
|
175
175
|
else
|
|
176
176
|
return r;
|
|
177
177
|
return u.success(s);
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Converts a Promise to an AsyncResult.
|
|
181
|
+
* @param p - The Promise to convert.
|
|
182
|
+
* @returns A Promise that resolves to an AsyncResult.
|
|
183
|
+
*/
|
|
184
|
+
ofPromise: async (e) => {
|
|
185
|
+
try {
|
|
186
|
+
const s = await e;
|
|
187
|
+
return u.success(s);
|
|
188
|
+
} catch (s) {
|
|
189
|
+
return u.failure(s instanceof Error ? s : new Error(String(s)));
|
|
190
|
+
}
|
|
178
191
|
}
|
|
179
192
|
};
|
|
180
193
|
export {
|
package/domain.d.ts
CHANGED
|
@@ -164,3 +164,19 @@ export type SplitLiteral<T extends string, SplitBy extends string> = FilterTuple
|
|
|
164
164
|
* @public
|
|
165
165
|
*/
|
|
166
166
|
export type SplitLiteralToUnion<T extends string, SplitBy extends string> = TupleToUnion<SplitLiteral<T, SplitBy>>;
|
|
167
|
+
/**
|
|
168
|
+
* Creates a new type by making the specified key `K` of `T` optional.
|
|
169
|
+
* @typeParam T - The type to create a new type from.
|
|
170
|
+
* @typeParam K - The key of `T` to make optional.
|
|
171
|
+
* @returns A new type with the specified key made optional.
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
export type PartialBy<T, K extends keyof T> = Merge<Omit<T, K>, Partial<Pick<T, K>>>;
|
|
175
|
+
/**
|
|
176
|
+
* Creates a new type by making the specified key `K` of `T` required.
|
|
177
|
+
* @typeParam T - The type to create a new type from.
|
|
178
|
+
* @typeParam K - The key of `T` to make required.
|
|
179
|
+
* @returns A new type with the specified key made required.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export type RequiredBy<T, K extends keyof T> = Merge<Omit<T, K>, Required<Pick<T, K>>>;
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),c=require("./async-result.cjs"),i=require("./bigint.cjs"),a=require("./equal.cjs"),n=require("./function.cjs"),o=require("./json.cjs"),t=require("./number.cjs"),s=require("./object.cjs"),m=require("./promise.cjs"),p=require("./regexp.cjs"),l=require("./result-CdwVhaAc.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.uniqueByPrimitive=r.uniqueByPrimitive;exports.uniquePrimitives=r.uniquePrimitives;exports.AsyncResult=c.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=a.deepEqual;exports.looseEqual=a.looseEqual;exports.strictEqual=a.strictEqual;exports.curryLeft=n.curryLeft;exports.identity=n.identity;exports.memoize=n.memoize;exports.isJSONArray=o.isJSONArray;exports.isJSONObject=o.isJSONObject;exports.isJSONPrimitive=o.isJSONPrimitive;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=s.isEmptyObject;exports.isObject=s.isObject;exports.mergeObjects=s.mergeObjects;exports.objectEntries=s.objectEntries;exports.objectFromEntries=s.objectFromEntries;exports.objectKeys=s.objectKeys;exports.objectValues=s.objectValues;exports.removeObjectFields=s.removeObjectFields;exports.sameObjectKeys=s.sameObjectKeys;exports.sleep=m.sleep;exports.mapRegExp=p.mapRegExp;exports.Result=l.Result;exports.Validation=l.Validation;exports.canonicalizeNewlines=e.canonicalizeNewlines;exports.capitalize=e.capitalize;exports.capitalizeWords=e.capitalizeWords;exports.chunkString=e.chunkString;exports.collapseText=e.collapseText;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.countStringOccurrences=e.countStringOccurrences;exports.dasherize=e.dasherize;exports.decodeBase64=e.decodeBase64;exports.deleteFirstFromString=e.deleteFirstFromString;exports.deleteStringAfter=e.deleteStringAfter;exports.deleteStringBefore=e.deleteStringBefore;exports.deleteSubstring=e.deleteSubstring;exports.ellipsis=e.ellipsis;exports.ellipsisMiddle=e.ellipsisMiddle;exports.encodeBase64=e.encodeBase64;exports.filterCharcodes=e.filterCharcodes;exports.filterChars=e.filterChars;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.repeatString=e.repeatString;exports.replaceAll=e.replaceAll;exports.reverseString=e.reverseString;exports.rpad=e.rpad;exports.smartQuote=e.smartQuote;exports.splitStringOnFirst=e.splitStringOnFirst;exports.splitStringOnLast=e.splitStringOnLast;exports.splitStringOnce=e.splitStringOnce;exports.stringContains=e.stringContains;exports.stringEndsWith=e.stringEndsWith;exports.stringEndsWithAny=e.stringEndsWithAny;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringStartsWith=e.stringStartsWith;exports.stringStartsWithAny=e.stringStartsWithAny;exports.stringToCharcodes=e.stringToCharcodes;exports.stringToChars=e.stringToChars;exports.stringsDifferAtIndex=e.stringsDifferAtIndex;exports.substringAfter=e.substringAfter;exports.substringAfterLast=e.substringAfterLast;exports.substringBefore=e.substringBefore;exports.substringBeforeLast=e.substringBeforeLast;exports.surroundString=e.surroundString;exports.textContainsCaseInsensitive=e.textContainsCaseInsensitive;exports.textEndsWithAnyCaseInsensitive=e.textEndsWithAnyCaseInsensitive;exports.textEndsWithCaseInsensitive=e.textEndsWithCaseInsensitive;exports.textStartsWithAnyCaseInsensitive=e.textStartsWithAnyCaseInsensitive;exports.textStartsWithCaseInsensitive=e.textStartsWithCaseInsensitive;exports.textToLines=e.textToLines;exports.trimChars=e.trimChars;exports.trimCharsLeft=e.trimCharsLeft;exports.trimCharsRight=e.trimCharsRight;exports.trimStringSlice=e.trimStringSlice;exports.underscore=e.underscore;exports.upperCaseFirst=e.upperCaseFirst;exports.wrapColumns=e.wrapColumns;exports.wrapLine=e.wrapLine;
|
package/index.js
CHANGED
|
@@ -1,181 +1,188 @@
|
|
|
1
|
-
import { allElements as t, anyElement as i, applyArrayDiffOperations as
|
|
2
|
-
import { AsyncResult as
|
|
3
|
-
import { biAbs as
|
|
4
|
-
import { deepEqual as te, looseEqual as ie, strictEqual as
|
|
1
|
+
import { allElements as t, anyElement as i, applyArrayDiffOperations as s, areArraysEqual as a, arrayDiffOperations as n, arrayHasValues as o, arrayHead as l, arrayOfIterableIterator as m, arrayTail as p, compareArrays as c, concatArrays as y, createFilledArray as g, filterArray as A, filterMapArray as f, filterNullsFromArray as d, flatMapArray as u, flattenArray as b, foldLeftArray as S, forEachElement as C, generateArray as x, generateSequenceArray as h, isArrayEmpty as v, joinArrayWithConjunction as E, mapArray as O, rankArray as I, removeAllFromArray as F, removeAllFromArrayByPredicate as W, removeOneFromArray as j, removeOneFromArrayByPredicate as q, sortArray as P, uniqueByPrimitive as T, uniquePrimitives as L } from "./array.js";
|
|
2
|
+
import { AsyncResult as N } from "./async-result.js";
|
|
3
|
+
import { biAbs as D, biCeilDiv as z, biCompare as H, biFloorDiv as M, biGcd as R, biIsEven as V, biIsNegative as k, biIsOdd as J, biIsOne as K, biIsPositive as Q, biIsPrime as Z, biIsZero as G, biLcm as U, 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 se } from "./equal.js";
|
|
5
5
|
import { curryLeft as ne, identity as oe, memoize as le } from "./function.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { isJSONArray as pe, isJSONObject as ce, isJSONPrimitive as ye } from "./json.js";
|
|
7
|
+
import { EPSILON as Ae, angleDifference as fe, ceilTo as de, clamp as ue, clampInt as be, clampSym as Se, compareNumbers as Ce, floorTo as xe, interpolate as he, interpolateAngle as ve, interpolateAngleCCW as Ee, interpolateAngleCW as Oe, interpolateWidestAngle as Ie, nearEqualAngles as Fe, nearEquals as We, nearZero as je, root as qe, roundTo as Pe, sign as Te, toHex as Le, widestAngleDifference as Be, wrap as Ne, wrapCircular as we } from "./number.js";
|
|
8
|
+
import { isEmptyObject as ze, isObject as He, mergeObjects as Me, objectEntries as Re, objectFromEntries as Ve, objectKeys as ke, objectValues as Je, removeObjectFields as Ke, sameObjectKeys as Qe } from "./object.js";
|
|
9
|
+
import { sleep as Ge } from "./promise.js";
|
|
10
|
+
import { mapRegExp as Xe } from "./regexp.js";
|
|
11
|
+
import { R as _e, V as $e } from "./result-CGd0jCdl.js";
|
|
12
|
+
import { canonicalizeNewlines as rr, capitalize as tr, capitalizeWords as ir, chunkString as sr, collapseText as ar, compareCaseInsensitive as nr, compareStrings as or, containsAllText as lr, containsAllTextCaseInsensitive as mr, containsAnyText as pr, containsAnyTextCaseInsensitive as cr, countStringOccurrences as yr, dasherize as gr, decodeBase64 as Ar, deleteFirstFromString as fr, deleteStringAfter as dr, deleteStringBefore as ur, deleteSubstring as br, ellipsis as Sr, ellipsisMiddle as Cr, encodeBase64 as xr, filterCharcodes as hr, filterChars as vr, humanize as Er, ifEmptyString as Or, isAlpha as Ir, isAlphaNum as Fr, isBreakingWhitespace as Wr, isDigitsOnly as jr, isEmptyString as qr, isLowerCase as Pr, isSpaceAt as Tr, isUpperCase as Lr, jsQuote as Br, lowerCaseFirst as Nr, lpad as wr, mapChars as Dr, quote as zr, randomString as Hr, randomStringSequence as Mr, randomStringSequenceBase64 as Rr, repeatString as Vr, replaceAll as kr, reverseString as Jr, rpad as Kr, smartQuote as Qr, splitStringOnFirst as Zr, splitStringOnLast as Gr, splitStringOnce as Ur, stringContains as Xr, stringEndsWith as Yr, stringEndsWithAny as _r, stringHasContent as $r, stringHashCode as et, stringStartsWith as rt, stringStartsWithAny as tt, stringToCharcodes as it, stringToChars as st, stringsDifferAtIndex as at, substringAfter as nt, substringAfterLast as ot, substringBefore as lt, substringBeforeLast as mt, surroundString as pt, textContainsCaseInsensitive as ct, textEndsWithAnyCaseInsensitive as yt, textEndsWithCaseInsensitive as gt, textStartsWithAnyCaseInsensitive as At, textStartsWithCaseInsensitive as ft, textToLines as dt, trimChars as ut, trimCharsLeft as bt, trimCharsRight as St, trimStringSlice as Ct, underscore as xt, upperCaseFirst as ht, wrapColumns as vt, wrapLine as Et } from "./string.js";
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
N as AsyncResult,
|
|
15
|
+
Ae as EPSILON,
|
|
16
|
+
_e as Result,
|
|
17
|
+
$e as Validation,
|
|
17
18
|
t as allElements,
|
|
18
|
-
|
|
19
|
+
fe as angleDifference,
|
|
19
20
|
i as anyElement,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
s as applyArrayDiffOperations,
|
|
22
|
+
a as areArraysEqual,
|
|
22
23
|
n as arrayDiffOperations,
|
|
23
24
|
o as arrayHasValues,
|
|
24
25
|
l as arrayHead,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
m as arrayOfIterableIterator,
|
|
27
|
+
p as arrayTail,
|
|
28
|
+
D as biAbs,
|
|
28
29
|
z as biCeilDiv,
|
|
29
30
|
H as biCompare,
|
|
30
31
|
M as biFloorDiv,
|
|
31
32
|
R as biGcd,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
V as biIsEven,
|
|
34
|
+
k as biIsNegative,
|
|
35
|
+
J as biIsOdd,
|
|
36
|
+
K as biIsOne,
|
|
37
|
+
Q as biIsPositive,
|
|
38
|
+
Z as biIsPrime,
|
|
39
|
+
G as biIsZero,
|
|
40
|
+
U as biLcm,
|
|
40
41
|
X as biMax,
|
|
41
42
|
Y as biMin,
|
|
42
43
|
_ as biNextPrime,
|
|
43
44
|
$ as biPow,
|
|
44
45
|
ee as biPrevPrime,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
rr as canonicalizeNewlines,
|
|
47
|
+
tr as capitalize,
|
|
48
|
+
ir as capitalizeWords,
|
|
49
|
+
de as ceilTo,
|
|
50
|
+
sr as chunkString,
|
|
51
|
+
ue as clamp,
|
|
52
|
+
be as clampInt,
|
|
53
|
+
Se as clampSym,
|
|
54
|
+
ar as collapseText,
|
|
54
55
|
c as compareArrays,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
nr as compareCaseInsensitive,
|
|
57
|
+
Ce as compareNumbers,
|
|
58
|
+
or as compareStrings,
|
|
59
|
+
y as concatArrays,
|
|
60
|
+
lr as containsAllText,
|
|
61
|
+
mr as containsAllTextCaseInsensitive,
|
|
62
|
+
pr as containsAnyText,
|
|
63
|
+
cr as containsAnyTextCaseInsensitive,
|
|
64
|
+
yr as countStringOccurrences,
|
|
65
|
+
g as createFilledArray,
|
|
65
66
|
ne as curryLeft,
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
gr as dasherize,
|
|
68
|
+
Ar as decodeBase64,
|
|
68
69
|
te as deepEqual,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
fr as deleteFirstFromString,
|
|
71
|
+
dr as deleteStringAfter,
|
|
72
|
+
ur as deleteStringBefore,
|
|
73
|
+
br as deleteSubstring,
|
|
74
|
+
Sr as ellipsis,
|
|
75
|
+
Cr as ellipsisMiddle,
|
|
76
|
+
xr as encodeBase64,
|
|
76
77
|
A as filterArray,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
hr as filterCharcodes,
|
|
79
|
+
vr as filterChars,
|
|
79
80
|
f as filterMapArray,
|
|
80
81
|
d as filterNullsFromArray,
|
|
81
82
|
u as flatMapArray,
|
|
82
83
|
b as flattenArray,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
xe as floorTo,
|
|
85
|
+
S as foldLeftArray,
|
|
86
|
+
C as forEachElement,
|
|
86
87
|
x as generateArray,
|
|
87
88
|
h as generateSequenceArray,
|
|
88
|
-
|
|
89
|
+
Er as humanize,
|
|
89
90
|
oe as identity,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
Or as ifEmptyString,
|
|
92
|
+
he as interpolate,
|
|
93
|
+
ve as interpolateAngle,
|
|
94
|
+
Ee as interpolateAngleCCW,
|
|
95
|
+
Oe as interpolateAngleCW,
|
|
96
|
+
Ie as interpolateWidestAngle,
|
|
97
|
+
Ir as isAlpha,
|
|
98
|
+
Fr as isAlphaNum,
|
|
98
99
|
v as isArrayEmpty,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
Wr as isBreakingWhitespace,
|
|
101
|
+
jr as isDigitsOnly,
|
|
102
|
+
ze as isEmptyObject,
|
|
103
|
+
qr as isEmptyString,
|
|
104
|
+
pe as isJSONArray,
|
|
105
|
+
ce as isJSONObject,
|
|
106
|
+
ye as isJSONPrimitive,
|
|
107
|
+
Pr as isLowerCase,
|
|
108
|
+
He as isObject,
|
|
109
|
+
Tr as isSpaceAt,
|
|
110
|
+
Lr as isUpperCase,
|
|
107
111
|
E as joinArrayWithConjunction,
|
|
108
|
-
|
|
112
|
+
Br as jsQuote,
|
|
109
113
|
ie as looseEqual,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
Nr as lowerCaseFirst,
|
|
115
|
+
wr as lpad,
|
|
116
|
+
O as mapArray,
|
|
117
|
+
Dr as mapChars,
|
|
118
|
+
Xe as mapRegExp,
|
|
115
119
|
le as memoize,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
120
|
+
Me as mergeObjects,
|
|
121
|
+
Fe as nearEqualAngles,
|
|
122
|
+
We as nearEquals,
|
|
123
|
+
je as nearZero,
|
|
124
|
+
Re as objectEntries,
|
|
125
|
+
Ve as objectFromEntries,
|
|
126
|
+
ke as objectKeys,
|
|
127
|
+
Je as objectValues,
|
|
128
|
+
zr as quote,
|
|
129
|
+
Hr as randomString,
|
|
130
|
+
Mr as randomStringSequence,
|
|
131
|
+
Rr as randomStringSequenceBase64,
|
|
132
|
+
I as rankArray,
|
|
133
|
+
F as removeAllFromArray,
|
|
134
|
+
W as removeAllFromArrayByPredicate,
|
|
135
|
+
Ke as removeObjectFields,
|
|
136
|
+
j as removeOneFromArray,
|
|
137
|
+
q as removeOneFromArrayByPredicate,
|
|
138
|
+
Vr as repeatString,
|
|
139
|
+
kr as replaceAll,
|
|
140
|
+
Jr as reverseString,
|
|
141
|
+
qe as root,
|
|
142
|
+
Pe as roundTo,
|
|
143
|
+
Kr as rpad,
|
|
144
|
+
Qe as sameObjectKeys,
|
|
145
|
+
Te as sign,
|
|
146
|
+
Ge as sleep,
|
|
147
|
+
Qr as smartQuote,
|
|
148
|
+
P as sortArray,
|
|
149
|
+
Zr as splitStringOnFirst,
|
|
150
|
+
Gr as splitStringOnLast,
|
|
151
|
+
Ur as splitStringOnce,
|
|
152
|
+
se as strictEqual,
|
|
153
|
+
Xr as stringContains,
|
|
154
|
+
Yr as stringEndsWith,
|
|
155
|
+
_r as stringEndsWithAny,
|
|
156
|
+
$r as stringHasContent,
|
|
157
|
+
et as stringHashCode,
|
|
158
|
+
rt as stringStartsWith,
|
|
159
|
+
tt as stringStartsWithAny,
|
|
160
|
+
it as stringToCharcodes,
|
|
161
|
+
st as stringToChars,
|
|
162
|
+
at as stringsDifferAtIndex,
|
|
163
|
+
nt as substringAfter,
|
|
164
|
+
ot as substringAfterLast,
|
|
165
|
+
lt as substringBefore,
|
|
166
|
+
mt as substringBeforeLast,
|
|
167
|
+
pt as surroundString,
|
|
168
|
+
ct as textContainsCaseInsensitive,
|
|
169
|
+
yt as textEndsWithAnyCaseInsensitive,
|
|
170
|
+
gt as textEndsWithCaseInsensitive,
|
|
171
|
+
At as textStartsWithAnyCaseInsensitive,
|
|
172
|
+
ft as textStartsWithCaseInsensitive,
|
|
173
|
+
dt as textToLines,
|
|
174
|
+
Le as toHex,
|
|
175
|
+
ut as trimChars,
|
|
176
|
+
bt as trimCharsLeft,
|
|
177
|
+
St as trimCharsRight,
|
|
178
|
+
Ct as trimStringSlice,
|
|
179
|
+
xt as underscore,
|
|
180
|
+
T as uniqueByPrimitive,
|
|
181
|
+
L as uniquePrimitives,
|
|
182
|
+
ht as upperCaseFirst,
|
|
183
|
+
Be as widestAngleDifference,
|
|
184
|
+
Ne as wrap,
|
|
185
|
+
we as wrapCircular,
|
|
186
|
+
vt as wrapColumns,
|
|
187
|
+
Et as wrapLine
|
|
181
188
|
};
|
package/json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=r=>typeof r=="object"&&!Array.isArray(r)&&r!=null,i=r=>Array.isArray(r),o=r=>typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r==null;exports.isJSONArray=i;exports.isJSONObject=t;exports.isJSONPrimitive=o;
|
package/json.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Nothing } from './domain';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Represents a JSON primitive value.
|
|
5
4
|
* It can be a string, boolean, number, or Nothing (null or undefined).
|
|
@@ -23,3 +22,27 @@ export type JSONArray = JSONValue[];
|
|
|
23
22
|
* @public
|
|
24
23
|
*/
|
|
25
24
|
export type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the value is a JSON object.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The value to check.
|
|
29
|
+
* @returns `true` if the value is a JSON object; otherwise, `false`.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare const isJSONObject: (value: JSONValue) => value is JSONObject;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the value is a JSON array.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The value to check.
|
|
37
|
+
* @returns `true` if the value is a JSON array; otherwise, `false`.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare const isJSONArray: (value: JSONValue) => value is JSONArray;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the value is a JSON primitive.
|
|
43
|
+
*
|
|
44
|
+
* @param value - The value to check.
|
|
45
|
+
* @returns `true` if the value is a JSON primitive; otherwise, `false`.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare const isJSONPrimitive: (value: JSONValue) => value is JSONPrimitive;
|
package/json.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const t = (r) => typeof r == "object" && !Array.isArray(r) && r != null, o = (r) => Array.isArray(r), i = (r) => typeof r == "string" || typeof r == "boolean" || typeof r == "number" || r == null;
|
|
2
|
+
export {
|
|
3
|
+
o as isJSONArray,
|
|
4
|
+
t as isJSONObject,
|
|
5
|
+
i as isJSONPrimitive
|
|
6
|
+
};
|
package/object.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>Object.keys(e),r=e=>Object.values(e),b=e=>Object.entries(e),j=e=>Object.fromEntries(e),i=(e,t)=>{const n=o(e),c=o(t);if(n.length!==c.length)return!1;for(const s of n)if(!(s in t))return!1;return!0},O=e=>e!=null&&Object.getPrototypeOf(e)===Object.prototype,l=(e,...t)=>o(e).reduce((c,s)=>(t.includes(s)||(c[s]=e[s]),c),{}),u=(e,t)=>Object.assign({},e,t),m=e=>Object.keys(e).length===0;exports.isEmptyObject=m;exports.isObject=O;exports.mergeObjects=u;exports.objectEntries=b;exports.objectFromEntries=j;exports.objectKeys=o;exports.objectValues=r;exports.removeObjectFields=l;exports.sameObjectKeys=i;
|
package/object.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IndexKey, Merge, TupleToUnion } from './domain';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Returns an array of keys from the given object.
|
|
5
4
|
*
|
|
@@ -8,6 +7,30 @@ import { IndexKey, Merge, TupleToUnion } from './domain';
|
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
9
|
export declare const objectKeys: <T extends object>(obj: T) => Array<keyof T>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns an array of values from the given object.
|
|
12
|
+
*
|
|
13
|
+
* @param obj - The object from which to extract values.
|
|
14
|
+
* @returns An array of values from the object.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const objectValues: <T extends object>(obj: T) => Array<T[keyof T]>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns an array of entries (key-value pairs) from the given object.
|
|
20
|
+
*
|
|
21
|
+
* @param obj - The object from which to extract entries.
|
|
22
|
+
* @returns An array of tuples, where each tuple contains a key and its corresponding value from the object.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const objectEntries: <T extends object>(obj: T) => [keyof T, T[keyof T]][];
|
|
26
|
+
/**
|
|
27
|
+
* Creates an object from an array of entries.
|
|
28
|
+
*
|
|
29
|
+
* @param entries - The array of entries to create an object from.
|
|
30
|
+
* @returns The created object.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare const objectFromEntries: <T extends object>(entries: [keyof T, T[keyof T]][]) => T;
|
|
11
34
|
/**
|
|
12
35
|
* Checks if two objects have the same keys.
|
|
13
36
|
*
|
package/object.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
if (
|
|
4
|
-
for (const s of
|
|
1
|
+
const o = (e) => Object.keys(e), r = (e) => Object.values(e), j = (e) => Object.entries(e), b = (e) => Object.fromEntries(e), O = (e, t) => {
|
|
2
|
+
const n = o(e), c = o(t);
|
|
3
|
+
if (n.length !== c.length) return !1;
|
|
4
|
+
for (const s of n)
|
|
5
5
|
if (!(s in t)) return !1;
|
|
6
6
|
return !0;
|
|
7
|
-
},
|
|
7
|
+
}, i = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, l = (e, ...t) => o(e).reduce((c, s) => (t.includes(s) || (c[s] = e[s]), c), {}), u = (e, t) => Object.assign({}, e, t), f = (e) => Object.keys(e).length === 0;
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
o as
|
|
9
|
+
f as isEmptyObject,
|
|
10
|
+
i as isObject,
|
|
11
|
+
u as mergeObjects,
|
|
12
|
+
j as objectEntries,
|
|
13
|
+
b as objectFromEntries,
|
|
14
|
+
o as objectKeys,
|
|
15
|
+
r as objectValues,
|
|
16
|
+
l as removeObjectFields,
|
|
17
|
+
O as sameObjectKeys
|
|
15
18
|
};
|
package/package.json
CHANGED
package/result.d.ts
CHANGED