@tempots/std 0.26.1 → 0.27.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/index.cjs +1 -1
- package/index.js +146 -145
- package/number.cjs +1 -1
- package/number.d.ts +15 -0
- package/number.js +32 -31
- package/package.json +1 -1
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-DBJ3htTg.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-DBJ3htTg.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.snapToGrid=i.snapToGrid;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
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { applyArrayDiffOperations as t, areArraysEqual as i, arrayDiffOperations as a, arrayHasValues as s, arrayHead as n, arrayTail as o, buildArray as m, chunk as l, compareArrays as p, fillArray as d, filterMapArray as c, filterNullsFromArray as f, groupBy as y, isArrayEmpty as u, joinArrayWithConjunction as g, partition as A, range as S, rankArray as b, removeAllFromArray as x, removeAllFromArrayByPredicate as C, removeOneFromArray as h, removeOneFromArrayByPredicate as O, uniqueByPrimitive as I } from "./array.js";
|
|
2
2
|
import { AsyncResult as E } from "./async-result.js";
|
|
3
|
-
import { biAbs as B, biCeilDiv as D, biCompare as P, biFloorDiv as W, biGcd as j, biIsEven as
|
|
4
|
-
import { booleanToInt as
|
|
3
|
+
import { biAbs as B, biCeilDiv as D, biCompare as P, biFloorDiv as W, biGcd as j, biIsEven as T, biIsNegative as N, biIsOdd as k, biIsOne as q, biIsPositive as L, biIsPrime as M, biIsZero as w, biLcm as H, biMax as z, biMin as V, biNextPrime as R, biPow as U, biPrevPrime as J } from "./bigint.js";
|
|
4
|
+
import { booleanToInt as G, canParseBoolean as K, compareBooleans as Z, parseBoolean as Y, xorBoolean as X } from "./boolean.js";
|
|
5
5
|
import { addDays as $, addHours as ee, addMinutes as re, compareDates as te, diffInDays as ie, diffInHours as ae, endOfDay as se, endOfWeek as ne, isSameDay as oe, isSameHour as me, isSameMinute as le, isSameMonth as pe, isSameSecond as de, isSameWeek as ce, isSameYear as fe, isValidDate as ye, isWeekend as ue, startOfDay as ge, startOfWeek as Ae } from "./date.js";
|
|
6
6
|
import { deferred as be } from "./deferred.js";
|
|
7
7
|
import { deepEqual as Ce, looseEqual as he, strictEqual as Oe } from "./equal.js";
|
|
8
|
-
import { compose as ve, curryLeft as Ee, flip as Fe, identity as Be, memoize as De, negate as Pe, once as We, partial as je, pipe as
|
|
8
|
+
import { compose as ve, curryLeft as Ee, flip as Fe, identity as Be, memoize as De, negate as Pe, once as We, partial as je, pipe as Te } from "./function.js";
|
|
9
9
|
import { chain as ke, every as qe, filter as Le, find as Me, map as we, reduce as He, skip as ze, some as Ve, take as Re, toArray as Ue } from "./iterator.js";
|
|
10
|
-
import { isJSON as Qe, isJSONArray as
|
|
10
|
+
import { isJSON as Qe, isJSONArray as Ge, isJSONObject as Ke, isJSONPrimitive as Ze, parseJSON as Ye } from "./json.js";
|
|
11
11
|
import { mapEntries as _e, mapFilter as $e, mapFromEntries as er, mapGroupBy as rr, mapIsEmpty as tr, mapKeys as ir, mapMap as ar, mapMerge as sr, mapToObject as nr, mapValues as or } from "./map.js";
|
|
12
|
-
import { EPSILON as lr, angleDifference as pr, ceilTo as dr, clamp as cr, clampInt as fr, clampSym as yr, compareNumbers as ur, floorTo as gr, interpolate as Ar, interpolateAngle as Sr, interpolateAngleCCW as br, interpolateAngleCW as xr, interpolateWidestAngle as Cr, nearEqual as hr, nearEqualAngles as Or, nearZero as Ir, root as vr, roundTo as Er,
|
|
13
|
-
import { deepClone as
|
|
14
|
-
import { sleep as
|
|
15
|
-
import { randomBytes as Kr, randomChoice as
|
|
16
|
-
import { mapRegExp as
|
|
17
|
-
import { R as
|
|
18
|
-
import { setDifference as
|
|
19
|
-
import { canonicalizeNewlines as
|
|
20
|
-
import { debounce as
|
|
21
|
-
import { buildUrl as Ki, getBaseName as
|
|
12
|
+
import { EPSILON as lr, angleDifference as pr, ceilTo as dr, clamp as cr, clampInt as fr, clampSym as yr, compareNumbers as ur, floorTo as gr, interpolate as Ar, interpolateAngle as Sr, interpolateAngleCCW as br, interpolateAngleCW as xr, interpolateWidestAngle as Cr, nearEqual as hr, nearEqualAngles as Or, nearZero as Ir, root as vr, roundTo as Er, snapToGrid as Fr, toHex as Br, widestAngleDifference as Dr, wrap as Pr, wrapCircular as Wr } from "./number.js";
|
|
13
|
+
import { deepClone as Tr, isEmptyObject as Nr, isObject as kr, mergeObjects as qr, objectEntries as Lr, objectFromEntries as Mr, objectKeys as wr, objectValues as Hr, omit as zr, pick as Vr, removeObjectFields as Rr, sameObjectKeys as Ur } from "./object.js";
|
|
14
|
+
import { sleep as Qr } from "./promise.js";
|
|
15
|
+
import { randomBytes as Kr, randomChoice as Zr, randomChoices as Yr, randomFloat as Xr, randomHex as _r, randomInt as $r, randomUuid as et, seedRandom as rt, shuffle as tt, shuffled as it } from "./random.js";
|
|
16
|
+
import { mapRegExp as st } from "./regexp.js";
|
|
17
|
+
import { R as ot, V as mt } from "./result-BYto972d.js";
|
|
18
|
+
import { setDifference as pt, setFilter as dt, setFromArray as ct, setIntersection as ft, setIsEmpty as yt, setIsSubset as ut, setIsSuperset as gt, setMap as At, setSymmetricDifference as St, setToArray as bt, setUnion as xt } from "./set.js";
|
|
19
|
+
import { canonicalizeNewlines as ht, capitalize as Ot, capitalizeWords as It, chunkString as vt, collapseText as Et, compareCaseInsensitive as Ft, compareStrings as Bt, containsAllText as Dt, containsAllTextCaseInsensitive as Pt, containsAnyText as Wt, containsAnyTextCaseInsensitive as jt, countStringOccurrences as Tt, dasherize as Nt, decodeBase64 as kt, deleteFirstFromString as qt, deleteStringAfter as Lt, deleteStringBefore as Mt, deleteSubstring as wt, ellipsis as Ht, ellipsisMiddle as zt, encodeBase64 as Vt, filterCharcodes as Rt, filterChars as Ut, humanize as Jt, ifEmptyString as Qt, isAlpha as Gt, isAlphaNum as Kt, isBreakingWhitespace as Zt, isDigitsOnly as Yt, isEmptyString as Xt, isLowerCase as _t, isSpaceAt as $t, isUpperCase as ei, jsQuote as ri, lowerCaseFirst as ti, lpad as ii, mapChars as ai, quote as si, randomStringSequence as ni, randomStringSequenceBase64 as oi, randomSubString as mi, reverseString as li, rpad as pi, smartQuote as di, splitStringOnFirst as ci, splitStringOnLast as fi, splitStringOnce as yi, stringEndsWithAny as ui, stringHasContent as gi, stringHashCode as Ai, stringStartsWithAny as Si, stringToCharcodes as bi, stringsDifferAtIndex as xi, substringAfter as Ci, substringAfterLast as hi, substringBefore as Oi, substringBeforeLast as Ii, surroundString as vi, textContainsCaseInsensitive as Ei, textEndsWithAnyCaseInsensitive as Fi, textEndsWithCaseInsensitive as Bi, textStartsWithAnyCaseInsensitive as Di, textStartsWithCaseInsensitive as Pi, textToLines as Wi, trimChars as ji, trimCharsLeft as Ti, trimCharsRight as Ni, trimStringSlice as ki, underscore as qi, upperCaseFirst as Li, wrapColumns as Mi, wrapLine as wi } from "./string.js";
|
|
20
|
+
import { debounce as zi, delayed as Vi, delayedAnimationFrame as Ri, interval as Ui, intervalAnimationFrame as Ji, throttle as Qi } from "./timer.js";
|
|
21
|
+
import { buildUrl as Ki, getBaseName as Zi, getFileExtension as Yi, getFileName as Xi, getQueryParams as _i, isValidUrl as $i, joinPaths as ea, normalizePath as ra, parseUrl as ta, removeQueryParam as ia, setQueryParam as aa } from "./url.js";
|
|
22
22
|
export {
|
|
23
23
|
E as AsyncResult,
|
|
24
24
|
lr as EPSILON,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
ot as Result,
|
|
26
|
+
mt as Validation,
|
|
27
27
|
$ as addDays,
|
|
28
28
|
ee as addHours,
|
|
29
29
|
re as addMinutes,
|
|
@@ -39,8 +39,8 @@ export {
|
|
|
39
39
|
P as biCompare,
|
|
40
40
|
W as biFloorDiv,
|
|
41
41
|
j as biGcd,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
T as biIsEven,
|
|
43
|
+
N as biIsNegative,
|
|
44
44
|
k as biIsOdd,
|
|
45
45
|
q as biIsOne,
|
|
46
46
|
L as biIsPositive,
|
|
@@ -52,91 +52,91 @@ export {
|
|
|
52
52
|
R as biNextPrime,
|
|
53
53
|
U as biPow,
|
|
54
54
|
J as biPrevPrime,
|
|
55
|
-
|
|
55
|
+
G as booleanToInt,
|
|
56
56
|
m as buildArray,
|
|
57
57
|
Ki as buildUrl,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
K as canParseBoolean,
|
|
59
|
+
ht as canonicalizeNewlines,
|
|
60
|
+
Ot as capitalize,
|
|
61
|
+
It as capitalizeWords,
|
|
62
62
|
dr as ceilTo,
|
|
63
63
|
ke as chain,
|
|
64
64
|
l as chunk,
|
|
65
|
-
|
|
65
|
+
vt as chunkString,
|
|
66
66
|
cr as clamp,
|
|
67
67
|
fr as clampInt,
|
|
68
68
|
yr as clampSym,
|
|
69
|
-
|
|
69
|
+
Et as collapseText,
|
|
70
70
|
p as compareArrays,
|
|
71
71
|
Z as compareBooleans,
|
|
72
|
-
|
|
72
|
+
Ft as compareCaseInsensitive,
|
|
73
73
|
te as compareDates,
|
|
74
74
|
ur as compareNumbers,
|
|
75
|
-
|
|
75
|
+
Bt as compareStrings,
|
|
76
76
|
ve as compose,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
Dt as containsAllText,
|
|
78
|
+
Pt as containsAllTextCaseInsensitive,
|
|
79
|
+
Wt as containsAnyText,
|
|
80
|
+
jt as containsAnyTextCaseInsensitive,
|
|
81
|
+
Tt as countStringOccurrences,
|
|
82
82
|
Ee as curryLeft,
|
|
83
83
|
Nt as dasherize,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
zi as debounce,
|
|
85
|
+
kt as decodeBase64,
|
|
86
|
+
Tr as deepClone,
|
|
87
87
|
Ce as deepEqual,
|
|
88
88
|
be as deferred,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
Vi as delayed,
|
|
90
|
+
Ri as delayedAnimationFrame,
|
|
91
|
+
qt as deleteFirstFromString,
|
|
92
|
+
Lt as deleteStringAfter,
|
|
93
|
+
Mt as deleteStringBefore,
|
|
94
|
+
wt as deleteSubstring,
|
|
95
95
|
ie as diffInDays,
|
|
96
96
|
ae as diffInHours,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
Ht as ellipsis,
|
|
98
|
+
zt as ellipsisMiddle,
|
|
99
|
+
Vt as encodeBase64,
|
|
100
100
|
se as endOfDay,
|
|
101
101
|
ne as endOfWeek,
|
|
102
102
|
qe as every,
|
|
103
103
|
d as fillArray,
|
|
104
104
|
Le as filter,
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
Rt as filterCharcodes,
|
|
106
|
+
Ut as filterChars,
|
|
107
107
|
c as filterMapArray,
|
|
108
108
|
f as filterNullsFromArray,
|
|
109
109
|
Me as find,
|
|
110
110
|
Fe as flip,
|
|
111
111
|
gr as floorTo,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
Zi as getBaseName,
|
|
113
|
+
Yi as getFileExtension,
|
|
114
|
+
Xi as getFileName,
|
|
115
|
+
_i as getQueryParams,
|
|
116
116
|
y as groupBy,
|
|
117
|
-
|
|
117
|
+
Jt as humanize,
|
|
118
118
|
Be as identity,
|
|
119
|
-
|
|
119
|
+
Qt as ifEmptyString,
|
|
120
120
|
Ar as interpolate,
|
|
121
121
|
Sr as interpolateAngle,
|
|
122
122
|
br as interpolateAngleCCW,
|
|
123
123
|
xr as interpolateAngleCW,
|
|
124
124
|
Cr as interpolateWidestAngle,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
Ui as interval,
|
|
126
|
+
Ji as intervalAnimationFrame,
|
|
127
|
+
Gt as isAlpha,
|
|
128
128
|
Kt as isAlphaNum,
|
|
129
129
|
u as isArrayEmpty,
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
Zt as isBreakingWhitespace,
|
|
131
|
+
Yt as isDigitsOnly,
|
|
132
132
|
Nr as isEmptyObject,
|
|
133
|
-
|
|
133
|
+
Xt as isEmptyString,
|
|
134
134
|
Qe as isJSON,
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
Ge as isJSONArray,
|
|
136
|
+
Ke as isJSONObject,
|
|
137
137
|
Ze as isJSONPrimitive,
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
_t as isLowerCase,
|
|
139
|
+
kr as isObject,
|
|
140
140
|
oe as isSameDay,
|
|
141
141
|
me as isSameHour,
|
|
142
142
|
le as isSameMinute,
|
|
@@ -144,19 +144,19 @@ export {
|
|
|
144
144
|
de as isSameSecond,
|
|
145
145
|
ce as isSameWeek,
|
|
146
146
|
fe as isSameYear,
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
$t as isSpaceAt,
|
|
148
|
+
ei as isUpperCase,
|
|
149
149
|
ye as isValidDate,
|
|
150
|
-
|
|
150
|
+
$i as isValidUrl,
|
|
151
151
|
ue as isWeekend,
|
|
152
152
|
g as joinArrayWithConjunction,
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
ea as joinPaths,
|
|
154
|
+
ri as jsQuote,
|
|
155
155
|
he as looseEqual,
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
ti as lowerCaseFirst,
|
|
157
|
+
ii as lpad,
|
|
158
158
|
we as map,
|
|
159
|
-
|
|
159
|
+
ai as mapChars,
|
|
160
160
|
_e as mapEntries,
|
|
161
161
|
$e as mapFilter,
|
|
162
162
|
er as mapFromEntries,
|
|
@@ -165,111 +165,112 @@ export {
|
|
|
165
165
|
ir as mapKeys,
|
|
166
166
|
ar as mapMap,
|
|
167
167
|
sr as mapMerge,
|
|
168
|
-
|
|
168
|
+
st as mapRegExp,
|
|
169
169
|
nr as mapToObject,
|
|
170
170
|
or as mapValues,
|
|
171
171
|
De as memoize,
|
|
172
|
-
|
|
172
|
+
qr as mergeObjects,
|
|
173
173
|
hr as nearEqual,
|
|
174
174
|
Or as nearEqualAngles,
|
|
175
175
|
Ir as nearZero,
|
|
176
176
|
Pe as negate,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
ra as normalizePath,
|
|
178
|
+
Lr as objectEntries,
|
|
179
|
+
Mr as objectFromEntries,
|
|
180
|
+
wr as objectKeys,
|
|
181
|
+
Hr as objectValues,
|
|
182
|
+
zr as omit,
|
|
183
183
|
We as once,
|
|
184
184
|
Y as parseBoolean,
|
|
185
185
|
Ye as parseJSON,
|
|
186
|
-
|
|
186
|
+
ta as parseUrl,
|
|
187
187
|
je as partial,
|
|
188
188
|
A as partition,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
Vr as pick,
|
|
190
|
+
Te as pipe,
|
|
191
|
+
si as quote,
|
|
192
192
|
Kr as randomBytes,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
Zr as randomChoice,
|
|
194
|
+
Yr as randomChoices,
|
|
195
|
+
Xr as randomFloat,
|
|
196
|
+
_r as randomHex,
|
|
197
|
+
$r as randomInt,
|
|
198
|
+
ni as randomStringSequence,
|
|
199
|
+
oi as randomStringSequenceBase64,
|
|
200
|
+
mi as randomSubString,
|
|
201
|
+
et as randomUuid,
|
|
202
202
|
S as range,
|
|
203
203
|
b as rankArray,
|
|
204
204
|
He as reduce,
|
|
205
205
|
x as removeAllFromArray,
|
|
206
206
|
C as removeAllFromArrayByPredicate,
|
|
207
|
-
|
|
207
|
+
Rr as removeObjectFields,
|
|
208
208
|
h as removeOneFromArray,
|
|
209
209
|
O as removeOneFromArrayByPredicate,
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
ia as removeQueryParam,
|
|
211
|
+
li as reverseString,
|
|
212
212
|
vr as root,
|
|
213
213
|
Er as roundTo,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
214
|
+
pi as rpad,
|
|
215
|
+
Ur as sameObjectKeys,
|
|
216
|
+
rt as seedRandom,
|
|
217
|
+
pt as setDifference,
|
|
218
|
+
dt as setFilter,
|
|
219
|
+
ct as setFromArray,
|
|
220
|
+
ft as setIntersection,
|
|
221
|
+
yt as setIsEmpty,
|
|
222
|
+
ut as setIsSubset,
|
|
223
|
+
gt as setIsSuperset,
|
|
224
|
+
At as setMap,
|
|
225
|
+
aa as setQueryParam,
|
|
226
|
+
St as setSymmetricDifference,
|
|
227
|
+
bt as setToArray,
|
|
228
|
+
xt as setUnion,
|
|
229
|
+
tt as shuffle,
|
|
230
|
+
it as shuffled,
|
|
231
231
|
ze as skip,
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
Qr as sleep,
|
|
233
|
+
di as smartQuote,
|
|
234
|
+
Fr as snapToGrid,
|
|
234
235
|
Ve as some,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
ci as splitStringOnFirst,
|
|
237
|
+
fi as splitStringOnLast,
|
|
238
|
+
yi as splitStringOnce,
|
|
238
239
|
ge as startOfDay,
|
|
239
240
|
Ae as startOfWeek,
|
|
240
241
|
Oe as strictEqual,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
242
|
+
ui as stringEndsWithAny,
|
|
243
|
+
gi as stringHasContent,
|
|
244
|
+
Ai as stringHashCode,
|
|
245
|
+
Si as stringStartsWithAny,
|
|
246
|
+
bi as stringToCharcodes,
|
|
247
|
+
xi as stringsDifferAtIndex,
|
|
248
|
+
Ci as substringAfter,
|
|
249
|
+
hi as substringAfterLast,
|
|
250
|
+
Oi as substringBefore,
|
|
251
|
+
Ii as substringBeforeLast,
|
|
252
|
+
vi as surroundString,
|
|
252
253
|
Re as take,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
Ei as textContainsCaseInsensitive,
|
|
255
|
+
Fi as textEndsWithAnyCaseInsensitive,
|
|
256
|
+
Bi as textEndsWithCaseInsensitive,
|
|
257
|
+
Di as textStartsWithAnyCaseInsensitive,
|
|
258
|
+
Pi as textStartsWithCaseInsensitive,
|
|
259
|
+
Wi as textToLines,
|
|
260
|
+
Qi as throttle,
|
|
260
261
|
Ue as toArray,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
Br as toHex,
|
|
263
|
+
ji as trimChars,
|
|
264
|
+
Ti as trimCharsLeft,
|
|
264
265
|
Ni as trimCharsRight,
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
ki as trimStringSlice,
|
|
267
|
+
qi as underscore,
|
|
267
268
|
I as uniqueByPrimitive,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
Li as upperCaseFirst,
|
|
270
|
+
Dr as widestAngleDifference,
|
|
271
|
+
Pr as wrap,
|
|
272
|
+
Wr as wrapCircular,
|
|
273
|
+
Mi as wrapColumns,
|
|
274
|
+
wi as wrapLine,
|
|
274
275
|
X as xorBoolean
|
|
275
276
|
};
|
package/number.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./string.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./string.cjs"),i=1e-9,l=(e,t,n=360)=>{let r=(t-e)%n;return r<0&&(r+=n),r>n/2&&(r-=n),r},f=(e,t)=>{const n=Math.pow(10,t);return Math.ceil(e*n)/n},a=(e,t,n)=>Math.min(Math.max(e,t),n),u=(e,t,n)=>Math.trunc(a(e,t,n)),g=(e,t)=>a(e,-t,t),M=(e,t)=>e<t?-1:e>t?1:0,h=(e,t)=>{const n=Math.pow(10,t);return Math.floor(e*n)/n},d=(e,t=0)=>p.lpad(e.toString(16),"0",t),s=(e,t,n)=>(t-e)*n+e,A=(e,t,n,r=360)=>o(s(e,e+l(e,t,r),n),r),c=(e,t,n=360)=>{let r=(t-e)%n;return r<0&&(r+=n),r>n/2&&(r-=n),r},N=(e,t,n,r=360)=>o(s(e,e+c(e,t,r),n),r),w=(e,t,n,r=360)=>(e=o(e,r),t=o(t,r),t<e&&(t+=r),o(s(e,t,n),r)),m=(e,t,n,r=360)=>(e=o(e,r),t=o(t,r),t>e&&(t-=r),o(s(e,t,n),r)),T=(e,t,n=i)=>isFinite(e)?isFinite(t)?Math.abs(e-t)<=n:!1:isNaN(e)&&isNaN(t)?!0:isNaN(e)||isNaN(t)||isFinite(t)?!1:e>0==t>0,C=(e,t,n=360,r=i)=>Math.abs(l(e,t,n))<=r,E=(e,t=i)=>Math.abs(e)<=t,S=(e,t)=>Math.pow(e,1/t),W=(e,t)=>{const n=Math.pow(10,t);return Math.round(e*n)/n},q=(e,t,n)=>{const r=n-t+1;return e<t&&(e+=r*((t-e)/r+1)),t+(e-t)%r},o=(e,t)=>(e=e%t,e<0&&(e+=t),e),y=(e,t)=>Math.round(e/t)*t;exports.EPSILON=i;exports.angleDifference=l;exports.ceilTo=f;exports.clamp=a;exports.clampInt=u;exports.clampSym=g;exports.compareNumbers=M;exports.floorTo=h;exports.interpolate=s;exports.interpolateAngle=A;exports.interpolateAngleCCW=m;exports.interpolateAngleCW=w;exports.interpolateWidestAngle=N;exports.nearEqual=T;exports.nearEqualAngles=C;exports.nearZero=E;exports.root=S;exports.roundTo=W;exports.snapToGrid=y;exports.toHex=d;exports.widestAngleDifference=c;exports.wrap=q;exports.wrapCircular=o;
|
package/number.d.ts
CHANGED
|
@@ -359,3 +359,18 @@ export declare const wrap: (v: number, min: number, max: number) => number;
|
|
|
359
359
|
* ```
|
|
360
360
|
**/
|
|
361
361
|
export declare const wrapCircular: (v: number, max: number) => number;
|
|
362
|
+
/**
|
|
363
|
+
* Snaps a value to the nearest multiple of `gridSize`.
|
|
364
|
+
*
|
|
365
|
+
* @param value - The value to snap.
|
|
366
|
+
* @param gridSize - The grid increment to snap to.
|
|
367
|
+
* @returns The snapped value.
|
|
368
|
+
* @public
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* snapToGrid(7, 5) // returns 5
|
|
372
|
+
* snapToGrid(8, 5) // returns 10
|
|
373
|
+
* snapToGrid(2.3, 0.5) // returns 2.5
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export declare const snapToGrid: (value: number, gridSize: number) => number;
|
package/number.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { lpad as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
return
|
|
1
|
+
import { lpad as l } from "./string.js";
|
|
2
|
+
const c = 1e-9, i = (t, e, n = 360) => {
|
|
3
|
+
let o = (e - t) % n;
|
|
4
|
+
return o < 0 && (o += n), o > n / 2 && (o -= n), o;
|
|
5
5
|
}, h = (t, e) => {
|
|
6
|
-
const
|
|
7
|
-
return Math.ceil(t *
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
return Math.floor(t *
|
|
11
|
-
}, w = (t, e = 0) =>
|
|
12
|
-
let
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
return Math.round(t *
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
return t < e && (t +=
|
|
20
|
-
},
|
|
6
|
+
const n = Math.pow(10, e);
|
|
7
|
+
return Math.ceil(t * n) / n;
|
|
8
|
+
}, a = (t, e, n) => Math.min(Math.max(t, e), n), u = (t, e, n) => Math.trunc(a(t, e, n)), M = (t, e) => a(t, -e, e), N = (t, e) => t < e ? -1 : t > e ? 1 : 0, g = (t, e) => {
|
|
9
|
+
const n = Math.pow(10, e);
|
|
10
|
+
return Math.floor(t * n) / n;
|
|
11
|
+
}, w = (t, e = 0) => l(t.toString(16), "0", e), s = (t, e, n) => (e - t) * n + t, d = (t, e, n, o = 360) => r(s(t, t + i(t, e, o), n), o), f = (t, e, n = 360) => {
|
|
12
|
+
let o = (e - t) % n;
|
|
13
|
+
return o < 0 && (o += n), o > n / 2 && (o -= n), o;
|
|
14
|
+
}, A = (t, e, n, o = 360) => r(s(t, t + f(t, e, o), n), o), m = (t, e, n, o = 360) => (t = r(t, o), e = r(e, o), e < t && (e += o), r(s(t, e, n), o)), C = (t, e, n, o = 360) => (t = r(t, o), e = r(e, o), e > t && (e -= o), r(s(t, e, n), o)), T = (t, e, n = c) => isFinite(t) ? isFinite(e) ? Math.abs(t - e) <= n : !1 : isNaN(t) && isNaN(e) ? !0 : isNaN(t) || isNaN(e) || isFinite(e) ? !1 : t > 0 == e > 0, E = (t, e, n = 360, o = c) => Math.abs(i(t, e, n)) <= o, F = (t, e = c) => Math.abs(t) <= e, W = (t, e) => Math.pow(t, 1 / e), q = (t, e) => {
|
|
15
|
+
const n = Math.pow(10, e);
|
|
16
|
+
return Math.round(t * n) / n;
|
|
17
|
+
}, D = (t, e, n) => {
|
|
18
|
+
const o = n - e + 1;
|
|
19
|
+
return t < e && (t += o * ((e - t) / o + 1)), e + (t - e) % o;
|
|
20
|
+
}, r = (t, e) => (t = t % e, t < 0 && (t += e), t), I = (t, e) => Math.round(t / e) * e;
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
c as EPSILON,
|
|
23
|
+
i as angleDifference,
|
|
24
24
|
h as ceilTo,
|
|
25
|
-
|
|
25
|
+
a as clamp,
|
|
26
26
|
u as clampInt,
|
|
27
27
|
M as clampSym,
|
|
28
28
|
N as compareNumbers,
|
|
29
29
|
g as floorTo,
|
|
30
30
|
s as interpolate,
|
|
31
|
-
|
|
31
|
+
d as interpolateAngle,
|
|
32
32
|
C as interpolateAngleCCW,
|
|
33
33
|
m as interpolateAngleCW,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
A as interpolateWidestAngle,
|
|
35
|
+
T as nearEqual,
|
|
36
|
+
E as nearEqualAngles,
|
|
37
|
+
F as nearZero,
|
|
38
|
+
W as root,
|
|
39
|
+
q as roundTo,
|
|
40
|
+
I as snapToGrid,
|
|
40
41
|
w as toHex,
|
|
41
42
|
f as widestAngleDifference,
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
D as wrap,
|
|
44
|
+
r as wrapCircular
|
|
44
45
|
};
|