@tempots/std 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,39 +1,38 @@
1
- import { allElements as a, anyElement as i, applyArrayDiffOperations as t, areArraysEqual as s, arrayDiffOperations as o, arrayHasValues as n, arrayHead as l, arrayOfIterableIterator as m, arrayTail as p, compareArrays as c, concatArrays as y, createFilledArray as A, filterArray as f, filterMapArray as d, filterNullsFromArray as u, flatMapArray as C, flattenArray as b, foldLeftArray as h, forEachElement as v, generateArray as I, generateSequenceArray as E, isArrayEmpty as O, joinArrayWithConjunction as g, mapArray as x, rankArray as W, removeAllFromArray as q, removeAllFromArrayByPredicate as L, removeOneFromArray as F, removeOneFromArrayByPredicate as P, sortArray as j, uniqueByPredicate as w, uniquePrimitives as B } from "./array.js";
2
- import { AsyncResult as N } from "./async-result.js";
3
- import { biAbs as S, biCeilDiv as z, biCompare as T, biFloorDiv as M, biGcd as k, biIsEven as H, biIsNegative as V, biIsOdd as K, biIsOne as Q, biIsPositive as Z, biIsPrime as G, biIsZero as U, biLcm as J, biMax as X, biMin as Y, biNextPrime as _, biPow as $, biPrevPrime as ee } from "./bigint.js";
4
- import { deepEqual as ae, looseEqual as ie, strictEqual as te } from "./equal.js";
5
- import { compose as oe, curryLeft as ne, curryRight as le, flip as me, identity as pe, memoize as ce } from "./function.js";
6
- import { EPSILON as Ae, TOLERANCE as fe, angleDifference as de, ceilTo as ue, clamp as Ce, clampInt as be, clampSym as he, compare as ve, floorTo as Ie, interpolate as Ee, interpolateAngle as Oe, interpolateAngleCCW as ge, interpolateAngleCW as xe, interpolateWidestAngle as We, nearEqualAngles as qe, nearEquals as Le, nearZero as Fe, root as Pe, roundTo as je, sign as we, toHex as Be, widestAngleDifference as De, wrap as Ne, wrapCircular as Re } from "./number.js";
7
- import { isEmptyObject as ze, isObject as Te, mergeObjects as Me, objectKeys as ke, removeObjectFields as He, sameObjectKeys as Ve } from "./object.js";
8
- import { mapRegExp as Qe } from "./regexp.js";
9
- import { R as Ge, V as Ue } from "./result-Czm7RKNP.js";
10
- import { after as Xe, afterLast as Ye, before as _e, beforeLast as $e, canonicalizeNewlines as er, capitalize as rr, capitalizeWords as ar, collapse as ir, compareCaseInsensitive as tr, compareStrings as sr, contains as or, containsAll as nr, containsAllCaseInsensitive as lr, containsAny as mr, containsAnyCaseInsensitive as pr, containsCaseInsensitive as cr, count as yr, dasherize as Ar, decodeBase64 as fr, diffIndex as dr, ellipsis as ur, ellipsisMiddle as Cr, encodeBase64 as br, endsWith as hr, endsWithAny as vr, endsWithAnyCaseInsensitive as Ir, endsWithCaseInsensitive as Er, filter as Or, filterCharcode as gr, from as xr, hasContent as Wr, hashCode as qr, humanize as Lr, ifEmpty as Fr, isAlpha as Pr, isAlphaNum as jr, isBreakingWhitespace as wr, isDigitsOnly as Br, isEmpty as Dr, isLowerCase as Nr, isSpaceAt as Rr, isUpperCase as Sr, jsQuote as zr, lowerCaseFirst as Tr, lpad as Mr, map as kr, quote as Hr, random as Vr, randomSequence as Kr, randomSequence64 as Qr, remove as Zr, removeAfter as Gr, removeAt as Ur, removeBefore as Jr, removeOne as Xr, repeat as Yr, replace as _r, reverse as $r, rpad as ea, smartQuote as ra, splitOnFirst as aa, splitOnLast as ia, splitOnce as ta, startsWith as sa, startsWithAny as oa, startsWithAnyCaseInsensitive as na, startsWithCaseInsensitive as la, surround as ma, toArray as pa, toCharcodes as ca, toChunks as ya, toLines as Aa, trimChars as fa, trimCharsLeft as da, trimCharsRight as ua, underscore as Ca, upTo as ba, upperCaseFirst as ha, wrapColumns as va, wrapLine as Ia } from "./string.js";
1
+ import { allElements as t, anyElement as i, applyArrayDiffOperations as a, areArraysEqual as s, arrayDiffOperations as n, arrayHasValues as o, arrayHead as l, arrayOfIterableIterator as m, arrayTail as p, compareArrays as c, concatArrays as y, createFilledArray as A, filterArray as f, filterMapArray as d, filterNullsFromArray as x, flatMapArray as g, flattenArray as u, foldLeftArray as C, forEachElement as b, generateArray as v, generateSequenceArray as h, isArrayEmpty as S, joinArrayWithConjunction as E, mapArray as I, rankArray as T, removeAllFromArray as O, removeAllFromArrayByPredicate as F, removeOneFromArray as W, removeOneFromArrayByPredicate as q, sortArray as L, uniqueByPredicate as P, uniquePrimitives as j } from "./array.js";
2
+ import { AsyncResult as B } from "./async-result.js";
3
+ import { biAbs as N, biCeilDiv as z, biCompare as H, biFloorDiv as M, biGcd as R, biIsEven as k, biIsNegative as V, biIsOdd as K, biIsOne as Q, biIsPositive as Z, biIsPrime as G, biIsZero as U, biLcm as J, biMax as X, biMin as Y, biNextPrime as _, biPow as $, biPrevPrime as ee } from "./bigint.js";
4
+ import { deepEqual as te, looseEqual as ie, strictEqual as ae } from "./equal.js";
5
+ import { curryLeft as ne, identity as oe, memoize as le } from "./function.js";
6
+ import { EPSILON as pe, angleDifference as ce, ceilTo as ye, clamp as Ae, clampInt as fe, clampSym as de, compareNumbers as xe, floorTo as ge, interpolate as ue, interpolateAngle as Ce, interpolateAngleCCW as be, interpolateAngleCW as ve, interpolateWidestAngle as he, nearEqualAngles as Se, nearEquals as Ee, nearZero as Ie, root as Te, roundTo as Oe, sign as Fe, toHex as We, widestAngleDifference as qe, wrap as Le, wrapCircular as Pe } from "./number.js";
7
+ import { isEmptyObject as we, isObject as Be, mergeObjects as De, objectKeys as Ne, removeObjectFields as ze, sameObjectKeys as He } from "./object.js";
8
+ import { mapRegExp as Re } from "./regexp.js";
9
+ import { R as Ve, V as Ke } from "./result-Czm7RKNP.js";
10
+ import { afterLastText as Ze, afterText as Ge, beforeLastText as Ue, beforeText as Je, canonicalizeNewlines as Xe, capitalize as Ye, capitalizeWords as _e, chunkText as $e, compareCaseInsensitive as er, compareStrings as rr, containsAllText as tr, containsAllTextCaseInsensitive as ir, containsAnyText as ar, containsAnyTextCaseInsensitive as sr, countTextOccurrences as nr, dasherize as or, decodeBase64 as lr, ellipsis as mr, ellipsisMiddle as pr, encodeBase64 as cr, endsWithAnyText as yr, filterCharcode as Ar, filterText as fr, humanize as dr, ifEmptyString as xr, isAlpha as gr, isAlphaNum as ur, isBreakingWhitespace as Cr, isDigitsOnly as br, isEmptyString as vr, isLowerCase as hr, isSpaceAt as Sr, isUpperCase as Er, jsQuote as Ir, lowerCaseFirst as Tr, lpad as Or, mapChars as Fr, quote as Wr, randomString as qr, randomStringSequence as Lr, randomStringSequenceBase64 as Pr, removeFirstFromString as jr, removeFromString as wr, removeFromStringAfter as Br, removeFromStringBefore as Dr, removeSliceFromString as Nr, repeatString as zr, replaceAll as Hr, reverseString as Mr, rpad as Rr, smartQuote as kr, splitOnFirst as Vr, splitOnLast as Kr, splitStringOnce as Qr, stringHasContent as Zr, stringHashCode as Gr, stringToCharcodes as Ur, stringToChars as Jr, stringToLines as Xr, stringsDifferAtIndex as Yr, surroundText as _r, textCollapse as $r, textContains as et, textContainsCaseInsensitive as rt, textEndsWith as tt, textEndsWithAnyCaseInsensitive as it, textEndsWithCaseInsensitive as at, textStartsWith as st, textStartsWithAny as nt, textStartsWithAnyCaseInsensitive as ot, textStartsWithCaseInsensitive as lt, trimChars as mt, trimCharsLeft as pt, trimCharsRight as ct, underscore as yt, upperCaseFirst as At, wrapColumns as ft, wrapLine as dt } from "./string.js";
11
11
  export {
12
- N as AsyncResult,
13
- Ae as EPSILON,
14
- Ge as Result,
15
- fe as TOLERANCE,
16
- Ue as Validation,
17
- Xe as after,
18
- Ye as afterLast,
19
- a as allElements,
20
- de as angleDifference,
12
+ B as AsyncResult,
13
+ pe as EPSILON,
14
+ Ve as Result,
15
+ Ke as Validation,
16
+ Ze as afterLastText,
17
+ Ge as afterText,
18
+ t as allElements,
19
+ ce as angleDifference,
21
20
  i as anyElement,
22
- t as applyArrayDiffOperations,
21
+ a as applyArrayDiffOperations,
23
22
  s as areArraysEqual,
24
- o as arrayDiffOperations,
25
- n as arrayHasValues,
23
+ n as arrayDiffOperations,
24
+ o as arrayHasValues,
26
25
  l as arrayHead,
27
26
  m as arrayOfIterableIterator,
28
27
  p as arrayTail,
29
- _e as before,
30
- $e as beforeLast,
31
- S as biAbs,
28
+ Ue as beforeLastText,
29
+ Je as beforeText,
30
+ N as biAbs,
32
31
  z as biCeilDiv,
33
- T as biCompare,
32
+ H as biCompare,
34
33
  M as biFloorDiv,
35
- k as biGcd,
36
- H as biIsEven,
34
+ R as biGcd,
35
+ k as biIsEven,
37
36
  V as biIsNegative,
38
37
  K as biIsOdd,
39
38
  Q as biIsOne,
@@ -46,140 +45,135 @@ export {
46
45
  _ as biNextPrime,
47
46
  $ as biPow,
48
47
  ee as biPrevPrime,
49
- er as canonicalizeNewlines,
50
- rr as capitalize,
51
- ar as capitalizeWords,
52
- ue as ceilTo,
53
- Ce as clamp,
54
- be as clampInt,
55
- he as clampSym,
56
- ir as collapse,
57
- ve as compare,
48
+ Xe as canonicalizeNewlines,
49
+ Ye as capitalize,
50
+ _e as capitalizeWords,
51
+ ye as ceilTo,
52
+ $e as chunkText,
53
+ Ae as clamp,
54
+ fe as clampInt,
55
+ de as clampSym,
58
56
  c as compareArrays,
59
- tr as compareCaseInsensitive,
60
- sr as compareStrings,
61
- oe as compose,
57
+ er as compareCaseInsensitive,
58
+ xe as compareNumbers,
59
+ rr as compareStrings,
62
60
  y as concatArrays,
63
- or as contains,
64
- nr as containsAll,
65
- lr as containsAllCaseInsensitive,
66
- mr as containsAny,
67
- pr as containsAnyCaseInsensitive,
68
- cr as containsCaseInsensitive,
69
- yr as count,
61
+ tr as containsAllText,
62
+ ir as containsAllTextCaseInsensitive,
63
+ ar as containsAnyText,
64
+ sr as containsAnyTextCaseInsensitive,
65
+ nr as countTextOccurrences,
70
66
  A as createFilledArray,
71
67
  ne as curryLeft,
72
- le as curryRight,
73
- Ar as dasherize,
74
- fr as decodeBase64,
75
- ae as deepEqual,
76
- dr as diffIndex,
77
- ur as ellipsis,
78
- Cr as ellipsisMiddle,
79
- br as encodeBase64,
80
- hr as endsWith,
81
- vr as endsWithAny,
82
- Ir as endsWithAnyCaseInsensitive,
83
- Er as endsWithCaseInsensitive,
84
- Or as filter,
68
+ or as dasherize,
69
+ lr as decodeBase64,
70
+ te as deepEqual,
71
+ mr as ellipsis,
72
+ pr as ellipsisMiddle,
73
+ cr as encodeBase64,
74
+ yr as endsWithAnyText,
85
75
  f as filterArray,
86
- gr as filterCharcode,
76
+ Ar as filterCharcode,
87
77
  d as filterMapArray,
88
- u as filterNullsFromArray,
89
- C as flatMapArray,
90
- b as flattenArray,
91
- me as flip,
92
- Ie as floorTo,
93
- h as foldLeftArray,
94
- v as forEachElement,
95
- xr as from,
96
- I as generateArray,
97
- E as generateSequenceArray,
98
- Wr as hasContent,
99
- qr as hashCode,
100
- Lr as humanize,
101
- pe as identity,
102
- Fr as ifEmpty,
103
- Ee as interpolate,
104
- Oe as interpolateAngle,
105
- ge as interpolateAngleCCW,
106
- xe as interpolateAngleCW,
107
- We as interpolateWidestAngle,
108
- Pr as isAlpha,
109
- jr as isAlphaNum,
110
- O as isArrayEmpty,
111
- wr as isBreakingWhitespace,
112
- Br as isDigitsOnly,
113
- Dr as isEmpty,
114
- ze as isEmptyObject,
115
- Nr as isLowerCase,
116
- Te as isObject,
117
- Rr as isSpaceAt,
118
- Sr as isUpperCase,
119
- g as joinArrayWithConjunction,
120
- zr as jsQuote,
78
+ x as filterNullsFromArray,
79
+ fr as filterText,
80
+ g as flatMapArray,
81
+ u as flattenArray,
82
+ ge as floorTo,
83
+ C as foldLeftArray,
84
+ b as forEachElement,
85
+ v as generateArray,
86
+ h as generateSequenceArray,
87
+ dr as humanize,
88
+ oe as identity,
89
+ xr as ifEmptyString,
90
+ ue as interpolate,
91
+ Ce as interpolateAngle,
92
+ be as interpolateAngleCCW,
93
+ ve as interpolateAngleCW,
94
+ he as interpolateWidestAngle,
95
+ gr as isAlpha,
96
+ ur as isAlphaNum,
97
+ S as isArrayEmpty,
98
+ Cr as isBreakingWhitespace,
99
+ br as isDigitsOnly,
100
+ we as isEmptyObject,
101
+ vr as isEmptyString,
102
+ hr as isLowerCase,
103
+ Be as isObject,
104
+ Sr as isSpaceAt,
105
+ Er as isUpperCase,
106
+ E as joinArrayWithConjunction,
107
+ Ir as jsQuote,
121
108
  ie as looseEqual,
122
109
  Tr as lowerCaseFirst,
123
- Mr as lpad,
124
- kr as map,
125
- x as mapArray,
126
- Qe as mapRegExp,
127
- ce as memoize,
128
- Me as mergeObjects,
129
- qe as nearEqualAngles,
130
- Le as nearEquals,
131
- Fe as nearZero,
132
- ke as objectKeys,
133
- Hr as quote,
134
- Vr as random,
135
- Kr as randomSequence,
136
- Qr as randomSequence64,
137
- W as rankArray,
138
- Zr as remove,
139
- Gr as removeAfter,
140
- q as removeAllFromArray,
141
- L as removeAllFromArrayByPredicate,
142
- Ur as removeAt,
143
- Jr as removeBefore,
144
- He as removeObjectFields,
145
- Xr as removeOne,
146
- F as removeOneFromArray,
147
- P as removeOneFromArrayByPredicate,
148
- Yr as repeat,
149
- _r as replace,
150
- $r as reverse,
151
- Pe as root,
152
- je as roundTo,
153
- ea as rpad,
154
- Ve as sameObjectKeys,
155
- we as sign,
156
- ra as smartQuote,
157
- j as sortArray,
158
- aa as splitOnFirst,
159
- ia as splitOnLast,
160
- ta as splitOnce,
161
- sa as startsWith,
162
- oa as startsWithAny,
163
- na as startsWithAnyCaseInsensitive,
164
- la as startsWithCaseInsensitive,
165
- te as strictEqual,
166
- ma as surround,
167
- pa as toArray,
168
- ca as toCharcodes,
169
- ya as toChunks,
170
- Be as toHex,
171
- Aa as toLines,
172
- fa as trimChars,
173
- da as trimCharsLeft,
174
- ua as trimCharsRight,
175
- Ca as underscore,
176
- w as uniqueByPredicate,
177
- B as uniquePrimitives,
178
- ba as upTo,
179
- ha as upperCaseFirst,
180
- De as widestAngleDifference,
181
- Ne as wrap,
182
- Re as wrapCircular,
183
- va as wrapColumns,
184
- Ia as wrapLine
110
+ Or as lpad,
111
+ I as mapArray,
112
+ Fr as mapChars,
113
+ Re as mapRegExp,
114
+ le as memoize,
115
+ De as mergeObjects,
116
+ Se as nearEqualAngles,
117
+ Ee as nearEquals,
118
+ Ie as nearZero,
119
+ Ne as objectKeys,
120
+ Wr as quote,
121
+ qr as randomString,
122
+ Lr as randomStringSequence,
123
+ Pr as randomStringSequenceBase64,
124
+ T as rankArray,
125
+ O as removeAllFromArray,
126
+ F as removeAllFromArrayByPredicate,
127
+ jr as removeFirstFromString,
128
+ wr as removeFromString,
129
+ Br as removeFromStringAfter,
130
+ Dr as removeFromStringBefore,
131
+ ze as removeObjectFields,
132
+ W as removeOneFromArray,
133
+ q as removeOneFromArrayByPredicate,
134
+ Nr as removeSliceFromString,
135
+ zr as repeatString,
136
+ Hr as replaceAll,
137
+ Mr as reverseString,
138
+ Te as root,
139
+ Oe as roundTo,
140
+ Rr as rpad,
141
+ He as sameObjectKeys,
142
+ Fe as sign,
143
+ kr as smartQuote,
144
+ L as sortArray,
145
+ Vr as splitOnFirst,
146
+ Kr as splitOnLast,
147
+ Qr as splitStringOnce,
148
+ ae as strictEqual,
149
+ Zr as stringHasContent,
150
+ Gr as stringHashCode,
151
+ Ur as stringToCharcodes,
152
+ Jr as stringToChars,
153
+ Xr as stringToLines,
154
+ Yr as stringsDifferAtIndex,
155
+ _r as surroundText,
156
+ $r as textCollapse,
157
+ et as textContains,
158
+ rt as textContainsCaseInsensitive,
159
+ tt as textEndsWith,
160
+ it as textEndsWithAnyCaseInsensitive,
161
+ at as textEndsWithCaseInsensitive,
162
+ st as textStartsWith,
163
+ nt as textStartsWithAny,
164
+ ot as textStartsWithAnyCaseInsensitive,
165
+ lt as textStartsWithCaseInsensitive,
166
+ We as toHex,
167
+ mt as trimChars,
168
+ pt as trimCharsLeft,
169
+ ct as trimCharsRight,
170
+ yt as underscore,
171
+ P as uniqueByPredicate,
172
+ j as uniquePrimitives,
173
+ At as upperCaseFirst,
174
+ qe as widestAngleDifference,
175
+ Le as wrap,
176
+ Pe as wrapCircular,
177
+ ft as wrapColumns,
178
+ dt as wrapLine
185
179
  };
package/number.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./string.cjs"),s=1e-4,l=1e-9;function f(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function p(e,n){const t=Math.pow(10,n);return Math.ceil(e*t)/t}function c(e,n,t){return Math.min(Math.max(e,n),t)}function g(e,n,t){return Math.trunc(c(e,n,t))}function A(e,n){return c(e,-n,n)}function M(e,n){return e<n?-1:e>n?1:0}function h(e,n){const t=Math.pow(10,n);return Math.floor(e*t)/t}function d(e,n=0){return a.lpad(e.toString(16),"0",n)}function o(e,n,t){return(n-e)*t+e}function w(e,n,t,r=360){return i(o(e,e+f(e,n,r),t),r)}function u(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function C(e,n,t,r=360){return i(o(e,e+u(e,n,r),t),r)}function E(e,n,t,r=360){return e=i(e,r),n=i(n,r),n<e&&(n+=r),i(o(e,n,t),r)}function N(e,n,t,r=360){return e=i(e,r),n=i(n,r),n>e&&(n-=r),i(o(e,n,t),r)}function T(e,n,t=l){return isFinite(e)?isFinite(n)?Math.abs(e-n)<=t:!1:isNaN(e)?isNaN(n):isNaN(n)||isFinite(n)?!1:e>0==n>0}function m(e,n,t=360,r=l){return Math.abs(f(e,n,t))<=r}function S(e,n=l){return Math.abs(e)<=n}function W(e,n){return Math.pow(e,1/n)}function q(e,n){const t=Math.pow(10,n);return Math.round(e*t)/t}function O(e){return e<0?-1:1}function y(e,n,t){const r=t-n+1;return e<n&&(e+=r*((n-e)/r+1)),n+(e-n)%r}function i(e,n){return e=e%n,e<0&&(e+=n),e}exports.EPSILON=l;exports.TOLERANCE=s;exports.angleDifference=f;exports.ceilTo=p;exports.clamp=c;exports.clampInt=g;exports.clampSym=A;exports.compare=M;exports.floorTo=h;exports.interpolate=o;exports.interpolateAngle=w;exports.interpolateAngleCCW=N;exports.interpolateAngleCW=E;exports.interpolateWidestAngle=C;exports.nearEqualAngles=m;exports.nearEquals=T;exports.nearZero=S;exports.root=W;exports.roundTo=q;exports.sign=O;exports.toHex=d;exports.widestAngleDifference=u;exports.wrap=y;exports.wrapCircular=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./string.cjs"),l=1e-9;function u(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function s(e,n){const t=Math.pow(10,n);return Math.ceil(e*t)/t}function f(e,n,t){return Math.min(Math.max(e,n),t)}function p(e,n,t){return Math.trunc(f(e,n,t))}function g(e,n){return f(e,-n,n)}function M(e,n){return e<n?-1:e>n?1:0}function h(e,n){const t=Math.pow(10,n);return Math.floor(e*t)/t}function A(e,n=0){return a.lpad(e.toString(16),"0",n)}function o(e,n,t){return(n-e)*t+e}function d(e,n,t,r=360){return i(o(e,e+u(e,n,r),t),r)}function c(e,n,t=360){let r=(n-e)%t;return r<0&&(r+=t),r>t/2&&(r-=t),r}function w(e,n,t,r=360){return i(o(e,e+c(e,n,r),t),r)}function N(e,n,t,r=360){return e=i(e,r),n=i(n,r),n<e&&(n+=r),i(o(e,n,t),r)}function m(e,n,t,r=360){return e=i(e,r),n=i(n,r),n>e&&(n-=r),i(o(e,n,t),r)}function C(e,n,t=l){return isFinite(e)?isFinite(n)?Math.abs(e-n)<=t:!1:isNaN(e)?isNaN(n):isNaN(n)||isFinite(n)?!1:e>0==n>0}function S(e,n,t=360,r=l){return Math.abs(u(e,n,t))<=r}function T(e,n=l){return Math.abs(e)<=n}function E(e,n){return Math.pow(e,1/n)}function W(e,n){const t=Math.pow(10,n);return Math.round(e*t)/t}function q(e){return e<0?-1:1}function y(e,n,t){const r=t-n+1;return e<n&&(e+=r*((n-e)/r+1)),n+(e-n)%r}function i(e,n){return e=e%n,e<0&&(e+=n),e}exports.EPSILON=l;exports.angleDifference=u;exports.ceilTo=s;exports.clamp=f;exports.clampInt=p;exports.clampSym=g;exports.compareNumbers=M;exports.floorTo=h;exports.interpolate=o;exports.interpolateAngle=d;exports.interpolateAngleCCW=m;exports.interpolateAngleCW=N;exports.interpolateWidestAngle=w;exports.nearEqualAngles=S;exports.nearEquals=C;exports.nearZero=T;exports.root=E;exports.roundTo=W;exports.sign=q;exports.toHex=A;exports.widestAngleDifference=c;exports.wrap=y;exports.wrapCircular=i;
package/number.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare const TOLERANCE = 0.0001;
2
1
  /**
3
2
  Constant value employed to see if two `number` values are very close.
4
3
  **/
@@ -11,6 +10,7 @@ export declare const EPSILON = 1e-9;
11
10
  * @param turn - The total number of degrees in a full turn. Default is 360.0.
12
11
  * @returns The difference between the two angles.
13
12
  * @public
13
+ * @remarks
14
14
  * @example
15
15
  * ```ts
16
16
  * angleDifference(0, 90) // returns 90
@@ -27,6 +27,7 @@ export declare function angleDifference(a: number, b: number, turn?: number): nu
27
27
  * @param decimals - The number of decimals to round up to.
28
28
  * @returns The rounded up number.
29
29
  * @public
30
+ * @remarks
30
31
  * @example
31
32
  * ```ts
32
33
  * ceilTo(1.234, 2) // returns 1.24
@@ -43,6 +44,7 @@ export declare function ceilTo(v: number, decimals: number): number;
43
44
  * @param max - The maximum value.
44
45
  * @returns The clamped value.
45
46
  * @public
47
+ * @remarks
46
48
  * @example
47
49
  * ```ts
48
50
  * clamp(1.3, 0, 1) // returns 1
@@ -59,6 +61,7 @@ export declare function clamp(value: number, min: number, max: number): number;
59
61
  * @param max - The maximum value of the range.
60
62
  * @returns The clamped integer value.
61
63
  * @public
64
+ * @remarks
62
65
  * @example
63
66
  * ```ts
64
67
  * clampInt(5, 0, 10) // returns 5
@@ -75,6 +78,7 @@ export declare function clampInt(value: number, min: number, max: number): numbe
75
78
  * @param max - The maximum value.
76
79
  * @returns The clamped value.
77
80
  * @public
81
+ * @remarks
78
82
  * @example
79
83
  * ```ts
80
84
  * clampSym(5, 10) // returns 5
@@ -91,6 +95,7 @@ export declare function clampSym(v: number, max: number): number;
91
95
  * @param b - The second value to compare.
92
96
  * @returns A number indicating the relative order of the two values.
93
97
  * @public
98
+ * @remarks
94
99
  * @example
95
100
  * ```ts
96
101
  * compare(5, 10) // returns -1
@@ -98,7 +103,7 @@ export declare function clampSym(v: number, max: number): number;
98
103
  * compare(5, 5) // returns 0
99
104
  * ```
100
105
  **/
101
- export declare function compare(a: number, b: number): number;
106
+ export declare function compareNumbers(a: number, b: number): number;
102
107
  /**
103
108
  * Rounds a number down to the specified number of decimals.
104
109
  *
@@ -106,6 +111,7 @@ export declare function compare(a: number, b: number): number;
106
111
  * @param decimals - The number of decimals to round down to.
107
112
  * @returns The rounded down number.
108
113
  * @public
114
+ * @remarks
109
115
  * @example
110
116
  * ```ts
111
117
  * floorTo(1.234, 2) // returns 1.23
@@ -121,6 +127,7 @@ export declare function floorTo(v: number, decimals: number): number;
121
127
  * @param length - The desired length of the hexadecimal string. Defaults to 0.
122
128
  * @returns The hexadecimal representation of the number.
123
129
  * @public
130
+ * @remarks
124
131
  * @example
125
132
  * ```ts
126
133
  * toHex(255) // returns 'ff'
@@ -137,6 +144,7 @@ export declare function toHex(num: number, length?: number): string;
137
144
  * @param t - The interpolation value.
138
145
  * @returns The interpolated value.
139
146
  * @public
147
+ * @remarks
140
148
  * @example
141
149
  * ```ts
142
150
  * interpolate(0, 10, 0.5) // returns 5
@@ -155,6 +163,7 @@ export declare function interpolate(a: number, b: number, t: number): number;
155
163
  * @param turn - The total number of degrees in a full turn. Default is 360.0.
156
164
  * @returns The interpolated angle.
157
165
  * @public
166
+ * @remarks
158
167
  * @example
159
168
  * ```ts
160
169
  * interpolateAngle(0, 90, 0.5) // returns 45
@@ -172,6 +181,7 @@ export declare function interpolateAngle(a: number, b: number, t: number, turn?:
172
181
  * @param turn - The total angle of a full turn. Defaults to 360 degrees.
173
182
  * @returns The widest angle difference between `a` and `b`.
174
183
  * @public
184
+ * @remarks
175
185
  * @example
176
186
  * ```ts
177
187
  * widestAngleDifference(0, 90) // returns 90
@@ -191,6 +201,7 @@ export declare function widestAngleDifference(a: number, b: number, turn?: numbe
191
201
  * @param turn - The total number of degrees in a full turn. Default is 360.0.
192
202
  * @returns The interpolated angle.
193
203
  * @public
204
+ * @remarks
194
205
  * @example
195
206
  * ```ts
196
207
  * interpolateWidestAngle(0, 90, 0.5) // returns 45
@@ -209,6 +220,7 @@ export declare function interpolateWidestAngle(a: number, b: number, t: number,
209
220
  * @param turn - The total number of degrees in a full turn. Default is 360.0.
210
221
  * @returns The interpolated angle.
211
222
  * @public
223
+ * @remarks
212
224
  * @example
213
225
  * ```ts
214
226
  * interpolateAngleCW(0, 90, 0.5) // returns 45
@@ -227,6 +239,7 @@ export declare function interpolateAngleCW(a: number, b: number, t: number, turn
227
239
  * @param turn - The total number of degrees in a full turn. Default is 360.0.
228
240
  * @returns The interpolated angle.
229
241
  * @public
242
+ * @remarks
230
243
  * @example
231
244
  * ```ts
232
245
  * interpolateAngleCCW(0, 90, 0.5) // returns 45
@@ -246,6 +259,7 @@ export declare function interpolateAngleCCW(a: number, b: number, t: number, tur
246
259
  * @param tollerance - The tollerance value. Default is `EPSILON`.
247
260
  * @returns `true` if the numbers are very close, `false` otherwise.
248
261
  * @public
262
+ * @remarks
249
263
  * @example
250
264
  * ```ts
251
265
  * nearEquals(5, 5.000000000000001) // returns true
@@ -266,6 +280,7 @@ export declare function nearEquals(a: number, b: number, tollerance?: number): b
266
280
  * @param tollerance - The tollerance value. Default is `EPSILON`.
267
281
  * @returns `true` if the angles are very close, `false` otherwise.
268
282
  * @public
283
+ * @remarks
269
284
  * @example
270
285
  * ```ts
271
286
  * nearEqualAngles(0, 360) // returns true
@@ -283,6 +298,7 @@ export declare function nearEqualAngles(a: number, b: number, turn?: number, tol
283
298
  * @param tollerance - The tollerance value. Default is `EPSILON`.
284
299
  * @returns `true` if the number is zero or very close to it, `false` otherwise.
285
300
  * @public
301
+ * @remarks
286
302
  * @example
287
303
  * ```ts
288
304
  * nearZero(0.000000000000001) // returns true
@@ -298,6 +314,7 @@ export declare function nearZero(n: number, tollerance?: number): boolean;
298
314
  * @param index - The index of the root.
299
315
  * @returns The nth root of the base number.
300
316
  * @public
317
+ * @remarks
301
318
  * @example
302
319
  * ```ts
303
320
  * root(8, 3) // returns 2
@@ -313,6 +330,7 @@ export declare function root(base: number, index: number): number;
313
330
  * @param decimals - The number of decimals to round to.
314
331
  * @returns The rounded number.
315
332
  * @public
333
+ * @remarks
316
334
  * @example
317
335
  * ```ts
318
336
  * roundTo(1.234, 2) // returns 1.23
@@ -327,6 +345,7 @@ export declare function roundTo(f: number, decimals: number): number;
327
345
  * @param value - The number to check.
328
346
  * @returns `-1` if the number is negative, `1` otherwise.
329
347
  * @public
348
+ * @remarks
330
349
  * @example
331
350
  * ```ts
332
351
  * sign(-5) // returns -1
@@ -345,6 +364,7 @@ export declare function sign<T extends number>(value: T): number;
345
364
  * @param max - The maximum value of the range.
346
365
  * @returns The wrapped value.
347
366
  * @public
367
+ * @remarks
348
368
  * @example
349
369
  * ```ts
350
370
  * wrap(5, 0, 10) // returns 5
@@ -360,6 +380,7 @@ export declare function wrap(v: number, min: number, max: number): number;
360
380
  * @param max - The maximum value of the range.
361
381
  * @returns The wrapped value.
362
382
  * @public
383
+ * @remarks
363
384
  * @example
364
385
  * ```ts
365
386
  * wrapCircular(5, 10) // returns 5
package/number.js CHANGED
@@ -1,55 +1,55 @@
1
1
  import { lpad as l } from "./string.js";
2
- const p = 1e-4, f = 1e-9;
2
+ const f = 1e-9;
3
3
  function u(n, t, e = 360) {
4
4
  let r = (t - n) % e;
5
5
  return r < 0 && (r += e), r > e / 2 && (r -= e), r;
6
6
  }
7
- function h(n, t) {
7
+ function p(n, t) {
8
8
  const e = Math.pow(10, t);
9
9
  return Math.ceil(n * e) / e;
10
10
  }
11
11
  function c(n, t, e) {
12
12
  return Math.min(Math.max(n, t), e);
13
13
  }
14
- function M(n, t, e) {
14
+ function h(n, t, e) {
15
15
  return Math.trunc(c(n, t, e));
16
16
  }
17
- function g(n, t) {
17
+ function M(n, t) {
18
18
  return c(n, -t, t);
19
19
  }
20
- function N(n, t) {
20
+ function g(n, t) {
21
21
  return n < t ? -1 : n > t ? 1 : 0;
22
22
  }
23
- function w(n, t) {
23
+ function N(n, t) {
24
24
  const e = Math.pow(10, t);
25
25
  return Math.floor(n * e) / e;
26
26
  }
27
- function A(n, t = 0) {
27
+ function w(n, t = 0) {
28
28
  return l(n.toString(16), "0", t);
29
29
  }
30
30
  function o(n, t, e) {
31
31
  return (t - n) * e + n;
32
32
  }
33
- function d(n, t, e, r = 360) {
33
+ function A(n, t, e, r = 360) {
34
34
  return i(o(n, n + u(n, t, r), e), r);
35
35
  }
36
36
  function a(n, t, e = 360) {
37
37
  let r = (t - n) % e;
38
38
  return r < 0 && (r += e), r > e / 2 && (r -= e), r;
39
39
  }
40
- function C(n, t, e, r = 360) {
40
+ function d(n, t, e, r = 360) {
41
41
  return i(
42
42
  o(n, n + a(n, t, r), e),
43
43
  r
44
44
  );
45
45
  }
46
- function E(n, t, e, r = 360) {
46
+ function m(n, t, e, r = 360) {
47
47
  return n = i(n, r), t = i(t, r), t < n && (t += r), i(o(n, t, e), r);
48
48
  }
49
- function T(n, t, e, r = 360) {
49
+ function C(n, t, e, r = 360) {
50
50
  return n = i(n, r), t = i(t, r), t > n && (t -= r), i(o(n, t, e), r);
51
51
  }
52
- function m(n, t, e = f) {
52
+ function E(n, t, e = f) {
53
53
  return isFinite(n) ? isFinite(t) ? Math.abs(n - t) <= e : !1 : isNaN(n) ? isNaN(t) : isNaN(t) || isFinite(t) ? !1 : n > 0 == t > 0;
54
54
  }
55
55
  function F(n, t, e = 360, r = f) {
@@ -58,17 +58,17 @@ function F(n, t, e = 360, r = f) {
58
58
  function S(n, t = f) {
59
59
  return Math.abs(n) <= t;
60
60
  }
61
- function W(n, t) {
61
+ function T(n, t) {
62
62
  return Math.pow(n, 1 / t);
63
63
  }
64
- function q(n, t) {
64
+ function W(n, t) {
65
65
  const e = Math.pow(10, t);
66
66
  return Math.round(n * e) / e;
67
67
  }
68
- function D(n) {
68
+ function q(n) {
69
69
  return n < 0 ? -1 : 1;
70
70
  }
71
- function I(n, t, e) {
71
+ function D(n, t, e) {
72
72
  const r = e - t + 1;
73
73
  return n < t && (n += r * ((t - n) / r + 1)), t + (n - t) % r;
74
74
  }
@@ -77,27 +77,26 @@ function i(n, t) {
77
77
  }
78
78
  export {
79
79
  f as EPSILON,
80
- p as TOLERANCE,
81
80
  u as angleDifference,
82
- h as ceilTo,
81
+ p as ceilTo,
83
82
  c as clamp,
84
- M as clampInt,
85
- g as clampSym,
86
- N as compare,
87
- w as floorTo,
83
+ h as clampInt,
84
+ M as clampSym,
85
+ g as compareNumbers,
86
+ N as floorTo,
88
87
  o as interpolate,
89
- d as interpolateAngle,
90
- T as interpolateAngleCCW,
91
- E as interpolateAngleCW,
92
- C as interpolateWidestAngle,
88
+ A as interpolateAngle,
89
+ C as interpolateAngleCCW,
90
+ m as interpolateAngleCW,
91
+ d as interpolateWidestAngle,
93
92
  F as nearEqualAngles,
94
- m as nearEquals,
93
+ E as nearEquals,
95
94
  S as nearZero,
96
- W as root,
97
- q as roundTo,
98
- D as sign,
99
- A as toHex,
95
+ T as root,
96
+ W as roundTo,
97
+ q as sign,
98
+ w as toHex,
100
99
  a as widestAngleDifference,
101
- I as wrap,
100
+ D as wrap,
102
101
  i as wrapCircular
103
102
  };