@tempots/std 0.24.0 → 0.25.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/async-result.js CHANGED
@@ -1,4 +1,4 @@
1
- const u = {
1
+ const s = {
2
2
  /**
3
3
  * Creates a loading state.
4
4
  * @param previousValue - The previous value.
@@ -76,8 +76,8 @@ const u = {
76
76
  * @returns The value if the result is a success; otherwise, the alternative value.
77
77
  * @public
78
78
  */
79
- getOrElse(e, s) {
80
- return u.isSuccess(e) ? e.value : s;
79
+ getOrElse(e, r) {
80
+ return s.isSuccess(e) ? e.value : r;
81
81
  },
82
82
  /**
83
83
  * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
@@ -87,8 +87,8 @@ const u = {
87
87
  * @public
88
88
  * function.
89
89
  */
90
- getOrElseLazy(e, s) {
91
- return u.isSuccess(e) ? e.value : s();
90
+ getOrElseLazy(e, r) {
91
+ return s.isSuccess(e) ? e.value : r();
92
92
  },
93
93
  /**
94
94
  * Gets the value if the result is a success; otherwise, returns `null`.
@@ -97,7 +97,7 @@ const u = {
97
97
  * @public
98
98
  */
99
99
  getOrNull(e) {
100
- return u.isSuccess(e) ? e.value : null;
100
+ return s.isSuccess(e) ? e.value : null;
101
101
  },
102
102
  /**
103
103
  * Gets the value if the result is a success; otherwise, returns `undefined`.
@@ -106,7 +106,7 @@ const u = {
106
106
  * @public
107
107
  */
108
108
  getOrUndefined(e) {
109
- return u.isSuccess(e) ? e.value : void 0;
109
+ return s.isSuccess(e) ? e.value : void 0;
110
110
  },
111
111
  /**
112
112
  * Gets the value of a `AsyncResult` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
@@ -114,9 +114,9 @@ const u = {
114
114
  * @returns The value of the `AsyncResult` if it is a `Success`.
115
115
  */
116
116
  getUnsafe: (e) => {
117
- if (u.isSuccess(e))
117
+ if (s.isSuccess(e))
118
118
  return e.value;
119
- throw u.isFailure(e) ? e.error : new Error("Cannot get value from a not-asked or loading result");
119
+ throw s.isFailure(e) ? e.error : new Error("Cannot get value from a not-asked or loading result");
120
120
  },
121
121
  /**
122
122
  * Based on the state of the result, it picks the appropriate function to call and returns the result.
@@ -128,11 +128,11 @@ const u = {
128
128
  * @public
129
129
  */
130
130
  match: (e, {
131
- success: s,
132
- failure: r,
133
- loading: t,
134
- notAsked: n = t
135
- }) => u.isSuccess(e) ? s(e.value) : u.isFailure(e) ? r(e.error) : u.isNotAsked(e) ? n() : t(e.previousValue),
131
+ success: r,
132
+ failure: u,
133
+ loading: a,
134
+ notAsked: i = a
135
+ }) => s.isSuccess(e) ? r(e.value) : s.isFailure(e) ? u(e.error) : s.isNotAsked(e) ? i() : a(e.previousValue),
136
136
  /**
137
137
  * When the result is a success, it applies the function to the value.
138
138
  *
@@ -141,7 +141,7 @@ const u = {
141
141
  * @returns The result that was passed in.
142
142
  * @public
143
143
  */
144
- whenSuccess: (e, s) => (u.isSuccess(e) && s(e.value), e),
144
+ whenSuccess: (e, r) => (s.isSuccess(e) && r(e.value), e),
145
145
  /**
146
146
  * When the result is a failure, it applies the function to the error.
147
147
  *
@@ -150,7 +150,7 @@ const u = {
150
150
  * @returns The result that was passed in.
151
151
  * @public
152
152
  */
153
- whenFailure: (e, s) => (u.isFailure(e) && s(e.error), e),
153
+ whenFailure: (e, r) => (s.isFailure(e) && r(e.error), e),
154
154
  /**
155
155
  * Compares two results for equality.
156
156
  * @param r1 - The first result.
@@ -158,23 +158,23 @@ const u = {
158
158
  * @param options - The options to use for comparison. By default, uses strict equality.
159
159
  * @returns `true` if the results are equal, `false` otherwise.
160
160
  */
161
- equals: (e, s, r = {
162
- valueEquals: (t, n) => t === n,
163
- errorEquals: (t, n) => t === n
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",
161
+ equals: (e, r, u = {
162
+ valueEquals: (a, i) => a === i,
163
+ errorEquals: (a, i) => a === i
164
+ }) => e.type === "AsyncSuccess" && r.type === "AsyncSuccess" ? u.valueEquals(e.value, r.value) : e.type === "AsyncFailure" && r.type === "AsyncFailure" ? u.errorEquals(e.error, r.error) : e.type === "Loading" && r.type === "Loading" ? u.valueEquals(e.previousValue, r.previousValue) : e.type === "NotAsked" && r.type === "NotAsked",
165
165
  /**
166
166
  * Combines multiple results into a single result.
167
167
  * @param results - The results to combine.
168
168
  * @returns A single result that is a success if all the input results are successes, otherwise a failure.
169
169
  */
170
170
  all: (e) => {
171
- const s = [];
172
- for (const r of e)
173
- if (u.isSuccess(r))
174
- s.push(r.value);
171
+ const r = [];
172
+ for (const u of e)
173
+ if (s.isSuccess(u))
174
+ r.push(u.value);
175
175
  else
176
- return r;
177
- return u.success(s);
176
+ return u;
177
+ return s.success(r);
178
178
  },
179
179
  /**
180
180
  * Converts a Promise to an AsyncResult.
@@ -183,13 +183,170 @@ const u = {
183
183
  */
184
184
  ofPromise: async (e) => {
185
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)));
186
+ const r = await e;
187
+ return s.success(r);
188
+ } catch (r) {
189
+ return s.failure(r instanceof Error ? r : new Error(String(r)));
190
190
  }
191
- }
191
+ },
192
+ /**
193
+ * Maps the value of a successful `AsyncResult` to a new value using the provided function.
194
+ * For other states (NotAsked, Loading, Failure), the state is preserved.
195
+ * When mapping a Loading state with a previous value, the previous value is also mapped.
196
+ * @param result - The `AsyncResult` to map.
197
+ * @param fn - The mapping function to apply to the success value.
198
+ * @returns A new `AsyncResult` with the mapped value if successful, otherwise the original state.
199
+ * @public
200
+ */
201
+ map: (e, r) => {
202
+ switch (e.type) {
203
+ case "AsyncSuccess":
204
+ return s.success(r(e.value));
205
+ case "NotAsked":
206
+ return s.notAsked;
207
+ case "AsyncFailure":
208
+ return s.failure(e.error);
209
+ case "Loading":
210
+ return s.loading(
211
+ e.previousValue != null ? r(e.previousValue) : void 0
212
+ );
213
+ }
214
+ },
215
+ /**
216
+ * Maps the value of a successful `AsyncResult` to a new `AsyncResult` using the provided function.
217
+ * This is useful for chaining operations that may also fail.
218
+ * @param result - The `AsyncResult` to flat map.
219
+ * @param fn - The mapping function that returns a new `AsyncResult`.
220
+ * @returns The result of the mapping function if successful, otherwise the original state.
221
+ * @public
222
+ */
223
+ flatMap: (e, r) => {
224
+ switch (e.type) {
225
+ case "AsyncSuccess":
226
+ return r(e.value);
227
+ case "NotAsked":
228
+ return s.notAsked;
229
+ case "AsyncFailure":
230
+ return s.failure(e.error);
231
+ case "Loading":
232
+ return s.loading();
233
+ }
234
+ },
235
+ /**
236
+ * Maps the error of a failed `AsyncResult` to a new error using the provided function.
237
+ * For other states, the state is preserved.
238
+ * @param result - The `AsyncResult` to map the error of.
239
+ * @param fn - The mapping function to apply to the error.
240
+ * @returns A new `AsyncResult` with the mapped error if failed, otherwise the original state.
241
+ * @public
242
+ */
243
+ mapError: (e, r) => {
244
+ switch (e.type) {
245
+ case "AsyncSuccess":
246
+ return s.success(e.value);
247
+ case "NotAsked":
248
+ return s.notAsked;
249
+ case "AsyncFailure":
250
+ return s.failure(r(e.error));
251
+ case "Loading":
252
+ return s.loading(e.previousValue);
253
+ }
254
+ },
255
+ /**
256
+ * Maps the error of a failed `AsyncResult` to a new `AsyncResult` using the provided function.
257
+ * This allows recovery from errors by returning a new successful result.
258
+ * @param result - The `AsyncResult` to recover from.
259
+ * @param fn - The recovery function that returns a new `AsyncResult`.
260
+ * @returns The result of the recovery function if failed, otherwise the original state.
261
+ * @public
262
+ */
263
+ flatMapError: (e, r) => {
264
+ switch (e.type) {
265
+ case "AsyncSuccess":
266
+ return s.success(e.value);
267
+ case "NotAsked":
268
+ return s.notAsked;
269
+ case "AsyncFailure":
270
+ return r(e.error);
271
+ case "Loading":
272
+ return s.loading(e.previousValue);
273
+ }
274
+ },
275
+ /**
276
+ * Converts an `AsyncResult` to a `Result`, discarding the loading and not-asked states.
277
+ * Returns `undefined` if the result is not settled (i.e., NotAsked or Loading).
278
+ * @param result - The `AsyncResult` to convert.
279
+ * @returns A `Result` if the `AsyncResult` is settled, otherwise `undefined`.
280
+ * @public
281
+ */
282
+ toResult: (e) => {
283
+ switch (e.type) {
284
+ case "AsyncSuccess":
285
+ return { type: "Success", value: e.value };
286
+ case "AsyncFailure":
287
+ return { type: "Failure", error: e.error };
288
+ case "NotAsked":
289
+ case "Loading":
290
+ return;
291
+ }
292
+ },
293
+ /**
294
+ * Checks if the result is settled (either success or failure).
295
+ * @param r - The result.
296
+ * @returns `true` if the result is settled; otherwise, `false`.
297
+ * @public
298
+ */
299
+ isSettled(e) {
300
+ return e.type === "AsyncSuccess" || e.type === "AsyncFailure";
301
+ },
302
+ /**
303
+ * Recovers from a failure by providing an alternative value.
304
+ * @param result - The `AsyncResult` to recover from.
305
+ * @param fn - The function that provides an alternative value given the error.
306
+ * @returns A successful `AsyncResult` with the alternative value if failed, otherwise the original state.
307
+ * @public
308
+ */
309
+ recover: (e, r) => {
310
+ switch (e.type) {
311
+ case "AsyncSuccess":
312
+ return s.success(e.value);
313
+ case "NotAsked":
314
+ return s.notAsked;
315
+ case "AsyncFailure":
316
+ return s.success(r(e.error));
317
+ case "Loading":
318
+ return s.loading(e.previousValue);
319
+ }
320
+ },
321
+ /**
322
+ * Applies a function wrapped in an `AsyncResult` to a value wrapped in an `AsyncResult`.
323
+ * Useful for applying multiple arguments to a function in a safe way.
324
+ * @param resultFn - The `AsyncResult` containing the function.
325
+ * @param resultVal - The `AsyncResult` containing the value.
326
+ * @returns A new `AsyncResult` with the result of applying the function to the value.
327
+ * @public
328
+ */
329
+ ap: (e, r) => s.isSuccess(e) && s.isSuccess(r) ? s.success(e.value(r.value)) : s.isFailure(e) ? s.failure(e.error) : s.isFailure(r) ? s.failure(r.error) : s.isLoading(e) || s.isLoading(r) ? s.loading() : s.notAsked,
330
+ /**
331
+ * Maps two `AsyncResult` values using a function.
332
+ * @param r1 - The first `AsyncResult`.
333
+ * @param r2 - The second `AsyncResult`.
334
+ * @param fn - The function to apply to both values.
335
+ * @returns A new `AsyncResult` with the result of applying the function to both values.
336
+ * @public
337
+ */
338
+ map2: (e, r, u) => s.isSuccess(e) && s.isSuccess(r) ? s.success(u(e.value, r.value)) : s.isFailure(e) ? s.failure(e.error) : s.isFailure(r) ? s.failure(r.error) : s.isLoading(e) || s.isLoading(r) ? s.loading() : s.notAsked,
339
+ /**
340
+ * Maps three `AsyncResult` values using a function.
341
+ * @param r1 - The first `AsyncResult`.
342
+ * @param r2 - The second `AsyncResult`.
343
+ * @param r3 - The third `AsyncResult`.
344
+ * @param fn - The function to apply to all three values.
345
+ * @returns A new `AsyncResult` with the result of applying the function to all three values.
346
+ * @public
347
+ */
348
+ map3: (e, r, u, a) => s.isSuccess(e) && s.isSuccess(r) && s.isSuccess(u) ? s.success(a(e.value, r.value, u.value)) : s.isFailure(e) ? s.failure(e.error) : s.isFailure(r) ? s.failure(r.error) : s.isFailure(u) ? s.failure(u.error) : s.isLoading(e) || s.isLoading(r) || s.isLoading(u) ? s.loading() : s.notAsked
192
349
  };
193
350
  export {
194
- u as AsyncResult
351
+ s as AsyncResult
195
352
  };
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),b=require("./async-result.cjs"),a=require("./bigint.cjs"),u=require("./boolean.cjs"),t=require("./date.cjs"),A=require("./deferred.cjs"),g=require("./equal.cjs"),p=require("./function.cjs"),l=require("./iterator.cjs"),y=require("./json.cjs"),m=require("./map.cjs"),i=require("./number.cjs"),s=require("./object.cjs"),S=require("./promise.cjs"),c=require("./random.cjs"),C=require("./regexp.cjs"),f=require("./result-CdwVhaAc.cjs"),n=require("./set.cjs"),e=require("./string.cjs"),d=require("./timer.cjs"),o=require("./url.cjs");exports.applyArrayDiffOperations=r.applyArrayDiffOperations;exports.areArraysEqual=r.areArraysEqual;exports.arrayDiffOperations=r.arrayDiffOperations;exports.arrayHasValues=r.arrayHasValues;exports.arrayHead=r.arrayHead;exports.arrayTail=r.arrayTail;exports.buildArray=r.buildArray;exports.chunk=r.chunk;exports.compareArrays=r.compareArrays;exports.fillArray=r.fillArray;exports.filterMapArray=r.filterMapArray;exports.filterNullsFromArray=r.filterNullsFromArray;exports.groupBy=r.groupBy;exports.isArrayEmpty=r.isArrayEmpty;exports.joinArrayWithConjunction=r.joinArrayWithConjunction;exports.partition=r.partition;exports.range=r.range;exports.rankArray=r.rankArray;exports.removeAllFromArray=r.removeAllFromArray;exports.removeAllFromArrayByPredicate=r.removeAllFromArrayByPredicate;exports.removeOneFromArray=r.removeOneFromArray;exports.removeOneFromArrayByPredicate=r.removeOneFromArrayByPredicate;exports.uniqueByPrimitive=r.uniqueByPrimitive;exports.AsyncResult=b.AsyncResult;exports.biAbs=a.biAbs;exports.biCeilDiv=a.biCeilDiv;exports.biCompare=a.biCompare;exports.biFloorDiv=a.biFloorDiv;exports.biGcd=a.biGcd;exports.biIsEven=a.biIsEven;exports.biIsNegative=a.biIsNegative;exports.biIsOdd=a.biIsOdd;exports.biIsOne=a.biIsOne;exports.biIsPositive=a.biIsPositive;exports.biIsPrime=a.biIsPrime;exports.biIsZero=a.biIsZero;exports.biLcm=a.biLcm;exports.biMax=a.biMax;exports.biMin=a.biMin;exports.biNextPrime=a.biNextPrime;exports.biPow=a.biPow;exports.biPrevPrime=a.biPrevPrime;exports.booleanToInt=u.booleanToInt;exports.canParseBoolean=u.canParseBoolean;exports.compareBooleans=u.compareBooleans;exports.parseBoolean=u.parseBoolean;exports.xorBoolean=u.xorBoolean;exports.addDays=t.addDays;exports.addHours=t.addHours;exports.addMinutes=t.addMinutes;exports.compareDates=t.compareDates;exports.diffInDays=t.diffInDays;exports.diffInHours=t.diffInHours;exports.endOfDay=t.endOfDay;exports.endOfWeek=t.endOfWeek;exports.isSameDay=t.isSameDay;exports.isSameHour=t.isSameHour;exports.isSameMinute=t.isSameMinute;exports.isSameMonth=t.isSameMonth;exports.isSameSecond=t.isSameSecond;exports.isSameWeek=t.isSameWeek;exports.isSameYear=t.isSameYear;exports.isValidDate=t.isValidDate;exports.isWeekend=t.isWeekend;exports.startOfDay=t.startOfDay;exports.startOfWeek=t.startOfWeek;exports.deferred=A.deferred;exports.deepEqual=g.deepEqual;exports.looseEqual=g.looseEqual;exports.strictEqual=g.strictEqual;exports.compose=p.compose;exports.curryLeft=p.curryLeft;exports.flip=p.flip;exports.identity=p.identity;exports.memoize=p.memoize;exports.negate=p.negate;exports.once=p.once;exports.partial=p.partial;exports.pipe=p.pipe;exports.chain=l.chain;exports.every=l.every;exports.filter=l.filter;exports.find=l.find;exports.map=l.map;exports.reduce=l.reduce;exports.skip=l.skip;exports.some=l.some;exports.take=l.take;exports.toArray=l.toArray;exports.isJSON=y.isJSON;exports.isJSONArray=y.isJSONArray;exports.isJSONObject=y.isJSONObject;exports.isJSONPrimitive=y.isJSONPrimitive;exports.parseJSON=y.parseJSON;exports.mapEntries=m.mapEntries;exports.mapFilter=m.mapFilter;exports.mapFromEntries=m.mapFromEntries;exports.mapGroupBy=m.mapGroupBy;exports.mapIsEmpty=m.mapIsEmpty;exports.mapKeys=m.mapKeys;exports.mapMap=m.mapMap;exports.mapMerge=m.mapMerge;exports.mapToObject=m.mapToObject;exports.mapValues=m.mapValues;exports.EPSILON=i.EPSILON;exports.angleDifference=i.angleDifference;exports.ceilTo=i.ceilTo;exports.clamp=i.clamp;exports.clampInt=i.clampInt;exports.clampSym=i.clampSym;exports.compareNumbers=i.compareNumbers;exports.floorTo=i.floorTo;exports.interpolate=i.interpolate;exports.interpolateAngle=i.interpolateAngle;exports.interpolateAngleCCW=i.interpolateAngleCCW;exports.interpolateAngleCW=i.interpolateAngleCW;exports.interpolateWidestAngle=i.interpolateWidestAngle;exports.nearEqual=i.nearEqual;exports.nearEqualAngles=i.nearEqualAngles;exports.nearZero=i.nearZero;exports.root=i.root;exports.roundTo=i.roundTo;exports.toHex=i.toHex;exports.widestAngleDifference=i.widestAngleDifference;exports.wrap=i.wrap;exports.wrapCircular=i.wrapCircular;exports.deepClone=s.deepClone;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.omit=s.omit;exports.pick=s.pick;exports.removeObjectFields=s.removeObjectFields;exports.sameObjectKeys=s.sameObjectKeys;exports.sleep=S.sleep;exports.randomBytes=c.randomBytes;exports.randomChoice=c.randomChoice;exports.randomChoices=c.randomChoices;exports.randomFloat=c.randomFloat;exports.randomHex=c.randomHex;exports.randomInt=c.randomInt;exports.randomUuid=c.randomUuid;exports.seedRandom=c.seedRandom;exports.shuffle=c.shuffle;exports.shuffled=c.shuffled;exports.mapRegExp=C.mapRegExp;exports.Result=f.Result;exports.Validation=f.Validation;exports.setDifference=n.setDifference;exports.setFilter=n.setFilter;exports.setFromArray=n.setFromArray;exports.setIntersection=n.setIntersection;exports.setIsEmpty=n.setIsEmpty;exports.setIsSubset=n.setIsSubset;exports.setIsSuperset=n.setIsSuperset;exports.setMap=n.setMap;exports.setSymmetricDifference=n.setSymmetricDifference;exports.setToArray=n.setToArray;exports.setUnion=n.setUnion;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.randomStringSequence=e.randomStringSequence;exports.randomStringSequenceBase64=e.randomStringSequenceBase64;exports.randomSubString=e.randomSubString;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.stringEndsWithAny=e.stringEndsWithAny;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringStartsWithAny=e.stringStartsWithAny;exports.stringToCharcodes=e.stringToCharcodes;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;exports.debounce=d.debounce;exports.delayed=d.delayed;exports.delayedAnimationFrame=d.delayedAnimationFrame;exports.interval=d.interval;exports.intervalAnimationFrame=d.intervalAnimationFrame;exports.throttle=d.throttle;exports.buildUrl=o.buildUrl;exports.getBaseName=o.getBaseName;exports.getFileExtension=o.getFileExtension;exports.getFileName=o.getFileName;exports.getQueryParams=o.getQueryParams;exports.isValidUrl=o.isValidUrl;exports.joinPaths=o.joinPaths;exports.normalizePath=o.normalizePath;exports.parseUrl=o.parseUrl;exports.removeQueryParam=o.removeQueryParam;exports.setQueryParam=o.setQueryParam;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),b=require("./async-result.cjs"),a=require("./bigint.cjs"),u=require("./boolean.cjs"),t=require("./date.cjs"),A=require("./deferred.cjs"),g=require("./equal.cjs"),p=require("./function.cjs"),l=require("./iterator.cjs"),y=require("./json.cjs"),m=require("./map.cjs"),i=require("./number.cjs"),s=require("./object.cjs"),S=require("./promise.cjs"),c=require("./random.cjs"),C=require("./regexp.cjs"),f=require("./result-cY1uEC-G.cjs"),n=require("./set.cjs"),e=require("./string.cjs"),d=require("./timer.cjs"),o=require("./url.cjs");exports.applyArrayDiffOperations=r.applyArrayDiffOperations;exports.areArraysEqual=r.areArraysEqual;exports.arrayDiffOperations=r.arrayDiffOperations;exports.arrayHasValues=r.arrayHasValues;exports.arrayHead=r.arrayHead;exports.arrayTail=r.arrayTail;exports.buildArray=r.buildArray;exports.chunk=r.chunk;exports.compareArrays=r.compareArrays;exports.fillArray=r.fillArray;exports.filterMapArray=r.filterMapArray;exports.filterNullsFromArray=r.filterNullsFromArray;exports.groupBy=r.groupBy;exports.isArrayEmpty=r.isArrayEmpty;exports.joinArrayWithConjunction=r.joinArrayWithConjunction;exports.partition=r.partition;exports.range=r.range;exports.rankArray=r.rankArray;exports.removeAllFromArray=r.removeAllFromArray;exports.removeAllFromArrayByPredicate=r.removeAllFromArrayByPredicate;exports.removeOneFromArray=r.removeOneFromArray;exports.removeOneFromArrayByPredicate=r.removeOneFromArrayByPredicate;exports.uniqueByPrimitive=r.uniqueByPrimitive;exports.AsyncResult=b.AsyncResult;exports.biAbs=a.biAbs;exports.biCeilDiv=a.biCeilDiv;exports.biCompare=a.biCompare;exports.biFloorDiv=a.biFloorDiv;exports.biGcd=a.biGcd;exports.biIsEven=a.biIsEven;exports.biIsNegative=a.biIsNegative;exports.biIsOdd=a.biIsOdd;exports.biIsOne=a.biIsOne;exports.biIsPositive=a.biIsPositive;exports.biIsPrime=a.biIsPrime;exports.biIsZero=a.biIsZero;exports.biLcm=a.biLcm;exports.biMax=a.biMax;exports.biMin=a.biMin;exports.biNextPrime=a.biNextPrime;exports.biPow=a.biPow;exports.biPrevPrime=a.biPrevPrime;exports.booleanToInt=u.booleanToInt;exports.canParseBoolean=u.canParseBoolean;exports.compareBooleans=u.compareBooleans;exports.parseBoolean=u.parseBoolean;exports.xorBoolean=u.xorBoolean;exports.addDays=t.addDays;exports.addHours=t.addHours;exports.addMinutes=t.addMinutes;exports.compareDates=t.compareDates;exports.diffInDays=t.diffInDays;exports.diffInHours=t.diffInHours;exports.endOfDay=t.endOfDay;exports.endOfWeek=t.endOfWeek;exports.isSameDay=t.isSameDay;exports.isSameHour=t.isSameHour;exports.isSameMinute=t.isSameMinute;exports.isSameMonth=t.isSameMonth;exports.isSameSecond=t.isSameSecond;exports.isSameWeek=t.isSameWeek;exports.isSameYear=t.isSameYear;exports.isValidDate=t.isValidDate;exports.isWeekend=t.isWeekend;exports.startOfDay=t.startOfDay;exports.startOfWeek=t.startOfWeek;exports.deferred=A.deferred;exports.deepEqual=g.deepEqual;exports.looseEqual=g.looseEqual;exports.strictEqual=g.strictEqual;exports.compose=p.compose;exports.curryLeft=p.curryLeft;exports.flip=p.flip;exports.identity=p.identity;exports.memoize=p.memoize;exports.negate=p.negate;exports.once=p.once;exports.partial=p.partial;exports.pipe=p.pipe;exports.chain=l.chain;exports.every=l.every;exports.filter=l.filter;exports.find=l.find;exports.map=l.map;exports.reduce=l.reduce;exports.skip=l.skip;exports.some=l.some;exports.take=l.take;exports.toArray=l.toArray;exports.isJSON=y.isJSON;exports.isJSONArray=y.isJSONArray;exports.isJSONObject=y.isJSONObject;exports.isJSONPrimitive=y.isJSONPrimitive;exports.parseJSON=y.parseJSON;exports.mapEntries=m.mapEntries;exports.mapFilter=m.mapFilter;exports.mapFromEntries=m.mapFromEntries;exports.mapGroupBy=m.mapGroupBy;exports.mapIsEmpty=m.mapIsEmpty;exports.mapKeys=m.mapKeys;exports.mapMap=m.mapMap;exports.mapMerge=m.mapMerge;exports.mapToObject=m.mapToObject;exports.mapValues=m.mapValues;exports.EPSILON=i.EPSILON;exports.angleDifference=i.angleDifference;exports.ceilTo=i.ceilTo;exports.clamp=i.clamp;exports.clampInt=i.clampInt;exports.clampSym=i.clampSym;exports.compareNumbers=i.compareNumbers;exports.floorTo=i.floorTo;exports.interpolate=i.interpolate;exports.interpolateAngle=i.interpolateAngle;exports.interpolateAngleCCW=i.interpolateAngleCCW;exports.interpolateAngleCW=i.interpolateAngleCW;exports.interpolateWidestAngle=i.interpolateWidestAngle;exports.nearEqual=i.nearEqual;exports.nearEqualAngles=i.nearEqualAngles;exports.nearZero=i.nearZero;exports.root=i.root;exports.roundTo=i.roundTo;exports.toHex=i.toHex;exports.widestAngleDifference=i.widestAngleDifference;exports.wrap=i.wrap;exports.wrapCircular=i.wrapCircular;exports.deepClone=s.deepClone;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.omit=s.omit;exports.pick=s.pick;exports.removeObjectFields=s.removeObjectFields;exports.sameObjectKeys=s.sameObjectKeys;exports.sleep=S.sleep;exports.randomBytes=c.randomBytes;exports.randomChoice=c.randomChoice;exports.randomChoices=c.randomChoices;exports.randomFloat=c.randomFloat;exports.randomHex=c.randomHex;exports.randomInt=c.randomInt;exports.randomUuid=c.randomUuid;exports.seedRandom=c.seedRandom;exports.shuffle=c.shuffle;exports.shuffled=c.shuffled;exports.mapRegExp=C.mapRegExp;exports.Result=f.Result;exports.Validation=f.Validation;exports.setDifference=n.setDifference;exports.setFilter=n.setFilter;exports.setFromArray=n.setFromArray;exports.setIntersection=n.setIntersection;exports.setIsEmpty=n.setIsEmpty;exports.setIsSubset=n.setIsSubset;exports.setIsSuperset=n.setIsSuperset;exports.setMap=n.setMap;exports.setSymmetricDifference=n.setSymmetricDifference;exports.setToArray=n.setToArray;exports.setUnion=n.setUnion;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.randomStringSequence=e.randomStringSequence;exports.randomStringSequenceBase64=e.randomStringSequenceBase64;exports.randomSubString=e.randomSubString;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.stringEndsWithAny=e.stringEndsWithAny;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringStartsWithAny=e.stringStartsWithAny;exports.stringToCharcodes=e.stringToCharcodes;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;exports.debounce=d.debounce;exports.delayed=d.delayed;exports.delayedAnimationFrame=d.delayedAnimationFrame;exports.interval=d.interval;exports.intervalAnimationFrame=d.intervalAnimationFrame;exports.throttle=d.throttle;exports.buildUrl=o.buildUrl;exports.getBaseName=o.getBaseName;exports.getFileExtension=o.getFileExtension;exports.getFileName=o.getFileName;exports.getQueryParams=o.getQueryParams;exports.isValidUrl=o.isValidUrl;exports.joinPaths=o.joinPaths;exports.normalizePath=o.normalizePath;exports.parseUrl=o.parseUrl;exports.removeQueryParam=o.removeQueryParam;exports.setQueryParam=o.setQueryParam;
package/index.js CHANGED
@@ -14,7 +14,7 @@ import { deepClone as jr, isEmptyObject as Nr, isObject as Tr, mergeObjects as k
14
14
  import { sleep as Jr } from "./promise.js";
15
15
  import { randomBytes as Kr, randomChoice as Gr, randomChoices as Zr, randomFloat as Yr, randomHex as Xr, randomInt as _r, randomUuid as $r, seedRandom as et, shuffle as rt, shuffled as tt } from "./random.js";
16
16
  import { mapRegExp as at } from "./regexp.js";
17
- import { R as nt, V as ot } from "./result-CGd0jCdl.js";
17
+ import { R as nt, V as ot } from "./result-BrVFeaNO.js";
18
18
  import { setDifference as lt, setFilter as pt, setFromArray as dt, setIntersection as ct, setIsEmpty as ft, setIsSubset as yt, setIsSuperset as ut, setMap as gt, setSymmetricDifference as At, setToArray as St, setUnion as bt } from "./set.js";
19
19
  import { canonicalizeNewlines as Ct, capitalize as ht, capitalizeWords as Ot, chunkString as It, collapseText as vt, compareCaseInsensitive as Et, compareStrings as Ft, containsAllText as Bt, containsAllTextCaseInsensitive as Dt, containsAnyText as Pt, containsAnyTextCaseInsensitive as Wt, countStringOccurrences as jt, dasherize as Nt, decodeBase64 as Tt, deleteFirstFromString as kt, deleteStringAfter as qt, deleteStringBefore as Lt, deleteSubstring as Mt, ellipsis as wt, ellipsisMiddle as Ht, encodeBase64 as zt, filterCharcodes as Vt, filterChars as Rt, humanize as Ut, ifEmptyString as Jt, isAlpha as Qt, isAlphaNum as Kt, isBreakingWhitespace as Gt, isDigitsOnly as Zt, isEmptyString as Yt, isLowerCase as Xt, isSpaceAt as _t, isUpperCase as $t, jsQuote as ei, lowerCaseFirst as ri, lpad as ti, mapChars as ii, quote as ai, randomStringSequence as si, randomStringSequenceBase64 as ni, randomSubString as oi, reverseString as mi, rpad as li, smartQuote as pi, splitStringOnFirst as di, splitStringOnLast as ci, splitStringOnce as fi, stringEndsWithAny as yi, stringHasContent as ui, stringHashCode as gi, stringStartsWithAny as Ai, stringToCharcodes as Si, stringsDifferAtIndex as bi, substringAfter as xi, substringAfterLast as Ci, substringBefore as hi, substringBeforeLast as Oi, surroundString as Ii, textContainsCaseInsensitive as vi, textEndsWithAnyCaseInsensitive as Ei, textEndsWithCaseInsensitive as Fi, textStartsWithAnyCaseInsensitive as Bi, textStartsWithCaseInsensitive as Di, textToLines as Pi, trimChars as Wi, trimCharsLeft as ji, trimCharsRight as Ni, trimStringSlice as Ti, underscore as ki, upperCaseFirst as qi, wrapColumns as Li, wrapLine as Mi } from "./string.js";
20
20
  import { debounce as Hi, delayed as zi, delayedAnimationFrame as Vi, interval as Ri, intervalAnimationFrame as Ui, throttle as Ji } from "./timer.js";
package/json.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./result-CdwVhaAc.cjs"),e=r=>typeof r=="object"&&!Array.isArray(r)&&r!=null&&Object.values(r).every(t),i=r=>Array.isArray(r)&&r.every(t),t=r=>o(r)||e(r)||i(r),o=r=>typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r==null,n=r=>{try{return s.Result.success(JSON.parse(r))}catch(c){return s.Result.failure(c)}};exports.isJSON=t;exports.isJSONArray=i;exports.isJSONObject=e;exports.isJSONPrimitive=o;exports.parseJSON=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./result-cY1uEC-G.cjs"),e=r=>typeof r=="object"&&!Array.isArray(r)&&r!=null&&Object.values(r).every(t),i=r=>Array.isArray(r)&&r.every(t),t=r=>o(r)||e(r)||i(r),o=r=>typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r==null,n=r=>{try{return s.Result.success(JSON.parse(r))}catch(c){return s.Result.failure(c)}};exports.isJSON=t;exports.isJSONArray=i;exports.isJSONObject=e;exports.isJSONPrimitive=o;exports.parseJSON=n;
package/json.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as t } from "./result-CGd0jCdl.js";
1
+ import { R as t } from "./result-BrVFeaNO.js";
2
2
  const e = (r) => typeof r == "object" && !Array.isArray(r) && r != null && Object.values(r).every(s), c = (r) => Array.isArray(r) && r.every(s), s = (r) => i(r) || e(r) || c(r), i = (r) => typeof r == "string" || typeof r == "boolean" || typeof r == "number" || r == null, y = (r) => {
3
3
  try {
4
4
  return t.success(JSON.parse(r));
package/object.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>Object.keys(e),i=e=>Object.values(e),l=e=>Object.entries(e),f=e=>Object.fromEntries(e),u=(e,t)=>{const n=r(e),s=r(t);if(n.length!==s.length)return!1;for(const c of n)if(!(c in t))return!1;return!0},O=e=>e!=null&&Object.getPrototypeOf(e)===Object.prototype,a=(e,...t)=>r(e).reduce((s,c)=>(t.includes(c)||(s[c]=e[c]),s),{}),y=(e,t)=>Object.assign({},e,t),b=e=>Object.keys(e).length===0,j=(e,t)=>{const n={};for(const s of t)s in e&&(n[s]=e[s]);return n},m=(e,t)=>{const n={...e};for(const s of t)delete n[s];return n},o=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array)return e.map(t=>o(t));if(typeof e=="object"){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}return e};exports.deepClone=o;exports.isEmptyObject=b;exports.isObject=O;exports.mergeObjects=y;exports.objectEntries=l;exports.objectFromEntries=f;exports.objectKeys=r;exports.objectValues=i;exports.omit=m;exports.pick=j;exports.removeObjectFields=a;exports.sameObjectKeys=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>Object.keys(e),f=e=>Object.values(e),l=e=>Object.entries(e),u=e=>Object.fromEntries(e),O=(e,t)=>{const s=r(e),n=r(t);if(s.length!==n.length)return!1;for(const c of s)if(!(c in t))return!1;return!0},a=e=>e!=null&&Object.getPrototypeOf(e)===Object.prototype,y=(e,...t)=>{const s=new Set(t);return r(e).reduce((c,o)=>(s.has(o)||(c[o]=e[o]),c),{})},b=(e,t)=>Object.assign({},e,t),j=e=>Object.keys(e).length===0,m=(e,t)=>{const s={};for(const n of t)n in e&&(s[n]=e[n]);return s},p=(e,t)=>{const s={...e};for(const n of t)delete s[n];return s},i=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array)return e.map(t=>i(t));if(typeof e=="object"){const t={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=i(e[s]));return t}return e};exports.deepClone=i;exports.isEmptyObject=j;exports.isObject=a;exports.mergeObjects=b;exports.objectEntries=l;exports.objectFromEntries=u;exports.objectKeys=r;exports.objectValues=f;exports.omit=p;exports.pick=m;exports.removeObjectFields=y;exports.sameObjectKeys=O;
package/object.js CHANGED
@@ -1,45 +1,48 @@
1
- const c = (e) => Object.keys(e), i = (e) => Object.values(e), f = (e) => Object.entries(e), u = (e) => Object.fromEntries(e), l = (e, t) => {
2
- const n = c(e), s = c(t);
1
+ const o = (e) => Object.keys(e), f = (e) => Object.values(e), l = (e) => Object.entries(e), u = (e) => Object.fromEntries(e), O = (e, t) => {
2
+ const n = o(e), s = o(t);
3
3
  if (n.length !== s.length) return !1;
4
4
  for (const r of n)
5
5
  if (!(r in t)) return !1;
6
6
  return !0;
7
- }, O = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, a = (e, ...t) => c(e).reduce((s, r) => (t.includes(r) || (s[r] = e[r]), s), {}), p = (e, t) => Object.assign({}, e, t), y = (e) => Object.keys(e).length === 0, k = (e, t) => {
7
+ }, a = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, p = (e, ...t) => {
8
+ const n = new Set(t);
9
+ return o(e).reduce((r, c) => (n.has(c) || (r[c] = e[c]), r), {});
10
+ }, y = (e, t) => Object.assign({}, e, t), k = (e) => Object.keys(e).length === 0, m = (e, t) => {
8
11
  const n = {};
9
12
  for (const s of t)
10
13
  s in e && (n[s] = e[s]);
11
14
  return n;
12
- }, m = (e, t) => {
15
+ }, g = (e, t) => {
13
16
  const n = { ...e };
14
17
  for (const s of t)
15
18
  delete n[s];
16
19
  return n;
17
- }, o = (e) => {
20
+ }, i = (e) => {
18
21
  if (e === null || typeof e != "object")
19
22
  return e;
20
23
  if (e instanceof Date)
21
24
  return new Date(e.getTime());
22
25
  if (e instanceof Array)
23
- return e.map((t) => o(t));
26
+ return e.map((t) => i(t));
24
27
  if (typeof e == "object") {
25
28
  const t = {};
26
29
  for (const n in e)
27
- Object.prototype.hasOwnProperty.call(e, n) && (t[n] = o(e[n]));
30
+ Object.prototype.hasOwnProperty.call(e, n) && (t[n] = i(e[n]));
28
31
  return t;
29
32
  }
30
33
  return e;
31
34
  };
32
35
  export {
33
- o as deepClone,
34
- y as isEmptyObject,
35
- O as isObject,
36
- p as mergeObjects,
37
- f as objectEntries,
36
+ i as deepClone,
37
+ k as isEmptyObject,
38
+ a as isObject,
39
+ y as mergeObjects,
40
+ l as objectEntries,
38
41
  u as objectFromEntries,
39
- c as objectKeys,
40
- i as objectValues,
41
- m as omit,
42
- k as pick,
43
- a as removeObjectFields,
44
- l as sameObjectKeys
42
+ o as objectKeys,
43
+ f as objectValues,
44
+ g as omit,
45
+ m as pick,
46
+ p as removeObjectFields,
47
+ O as sameObjectKeys
45
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/std",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "priority": 8,
5
5
  "description": "Std library for TypeScript. Natural complement to the Tempo libraries.",
6
6
  "keywords": [
package/regexp.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=(n,i,u)=>{const s=[];let l=0,e;if(i.global)for(i.lastIndex=0;(e=i.exec(n))!==null;)s.push(n.substring(l,e.index)),s.push(u(...e)),l=e.index+e[0].length;else for(;(e=i.exec(n.substring(l)))!==null;)s.push(n.substring(l,l+e.index)),s.push(u(...e)),l+=e.index+e[0].length;return s.push(n.substring(l)),s.join("")};exports.mapRegExp=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(s,n,i)=>{const l=[];let g=0,e;if(n.global)for(n.lastIndex=0;(e=n.exec(s))!==null;)l.push(s.substring(g,e.index)),l.push(i(...e)),g=e.index+e[0].length;else{const u=new RegExp(n.source,n.flags+"g");for(;(e=u.exec(s))!==null;)l.push(s.substring(g,e.index)),l.push(i(...e)),g=e.index+e[0].length}return l.push(s.substring(g)),l.join("")};exports.mapRegExp=o;
package/regexp.js CHANGED
@@ -1,14 +1,16 @@
1
- const h = (n, i, u) => {
1
+ const x = (s, n, i) => {
2
2
  const e = [];
3
- let s = 0, l;
4
- if (i.global)
5
- for (i.lastIndex = 0; (l = i.exec(n)) !== null; )
6
- e.push(n.substring(s, l.index)), e.push(u(...l)), s = l.index + l[0].length;
7
- else
8
- for (; (l = i.exec(n.substring(s))) !== null; )
9
- e.push(n.substring(s, s + l.index)), e.push(u(...l)), s += l.index + l[0].length;
10
- return e.push(n.substring(s)), e.join("");
3
+ let g = 0, l;
4
+ if (n.global)
5
+ for (n.lastIndex = 0; (l = n.exec(s)) !== null; )
6
+ e.push(s.substring(g, l.index)), e.push(i(...l)), g = l.index + l[0].length;
7
+ else {
8
+ const u = new RegExp(n.source, n.flags + "g");
9
+ for (; (l = u.exec(s)) !== null; )
10
+ e.push(s.substring(g, l.index)), e.push(i(...l)), g = l.index + l[0].length;
11
+ }
12
+ return e.push(s.substring(g)), e.join("");
11
13
  };
12
14
  export {
13
- h as mapRegExp
15
+ x as mapRegExp
14
16
  };