@tempots/std 0.11.0 → 0.12.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,42 +1,146 @@
1
1
  const u = {
2
+ /**
3
+ * Creates a loading state.
4
+ * @param previousValue - The previous value.
5
+ * @returns A loading state.
6
+ * @public
7
+ */
2
8
  notAsked: { type: "NotAsked" },
9
+ /**
10
+ * Creates a loading state.
11
+ * @param previousValue - The previous value.
12
+ * @returns A loading state.
13
+ * @public
14
+ */
3
15
  loading(e = void 0) {
4
16
  return { type: "Loading", previousValue: e };
5
17
  },
18
+ /**
19
+ * Creates a successful state.
20
+ * @param value - The value.
21
+ * @returns A successful state.
22
+ * @public
23
+ */
6
24
  success(e) {
7
- return { type: "Success", value: e };
25
+ return { type: "AsyncSuccess", value: e };
8
26
  },
27
+ /**
28
+ * Creates a failure state.
29
+ * @param error - The error.
30
+ * @returns A failure state.
31
+ * @public
32
+ */
9
33
  failure(e) {
10
- return { type: "Failure", error: e };
34
+ return { type: "AsyncFailure", error: e };
11
35
  },
36
+ /**
37
+ * Checks if the result is a success.
38
+ * @param r - The result.
39
+ * @returns `true` if the result is a success; otherwise, `false`.
40
+ * @public
41
+ */
12
42
  isSuccess(e) {
13
- return e.type === "Success";
43
+ return e.type === "AsyncSuccess";
14
44
  },
45
+ /**
46
+ * Checks if the result is a failure.
47
+ * @param r - The result.
48
+ * @returns `true` if the result is a failure; otherwise, `false`.
49
+ * @public
50
+ */
15
51
  isFailure(e) {
16
- return e.type === "Failure";
52
+ return e.type === "AsyncFailure";
17
53
  },
54
+ /**
55
+ * Checks if the result is a not-asked.
56
+ * @param r - The result.
57
+ * @returns `true` if the result is not-asked; otherwise, `false`.
58
+ * @public
59
+ */
18
60
  isNotAsked(e) {
19
61
  return e.type === "NotAsked";
20
62
  },
63
+ /**
64
+ * Checks if the result is a loading.
65
+ * @param r - The result.
66
+ * @returns `true` if the result is loading; otherwise, `false`.
67
+ * @public
68
+ */
21
69
  isLoading(e) {
22
70
  return e.type === "Loading";
23
71
  },
72
+ /**
73
+ * Gets the value if the result is a success; otherwise, returns the alternative value.
74
+ * @param r - The result.
75
+ * @param alt - The alternative value.
76
+ * @returns The value if the result is a success; otherwise, the alternative value.
77
+ * @public
78
+ */
24
79
  getOrElse(e, s) {
25
80
  return u.isSuccess(e) ? e.value : s;
26
81
  },
82
+ /**
83
+ * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
84
+ * @param r - The result.
85
+ * @param altf - The alternative function.
86
+ * @returns The value if the result is a success; otherwise, the value from the alternative
87
+ * @public
88
+ * function.
89
+ */
27
90
  getOrElseLazy(e, s) {
28
91
  return u.isSuccess(e) ? e.value : s();
29
92
  },
93
+ /**
94
+ * Gets the value if the result is a success; otherwise, returns `null`.
95
+ * @param r - The result.
96
+ * @returns The value if the result is a success; otherwise, `null`.
97
+ * @public
98
+ */
30
99
  getOrNull(e) {
31
100
  return u.isSuccess(e) ? e.value : null;
32
101
  },
102
+ /**
103
+ * Gets the value if the result is a success; otherwise, returns `undefined`.
104
+ * @param r - The result.
105
+ * @returns The value if the result is a success; otherwise, `undefined`.
106
+ * @public
107
+ */
33
108
  getOrUndefined(e) {
34
109
  return u.isSuccess(e) ? e.value : void 0;
35
110
  },
36
- cmatch: (e, s, t, i = t) => (r) => u.isSuccess(r) ? e(r.value) : u.isFailure(r) ? s(r.error) : u.isNotAsked(r) ? i() : t(r.previousValue),
37
- match: (e, s, t, i, r = i) => u.isSuccess(e) ? s(e.value) : u.isFailure(e) ? t(e.error) : u.isNotAsked(e) ? r() : i(e.previousValue),
38
- whenSuccess: (e) => (s) => (u.isSuccess(s) && e(s.value), s),
39
- whenFailure: (e) => (s) => (u.isFailure(s) && e(s.error), s)
111
+ /**
112
+ * Based on the state of the result, it picks the appropriate function to call and returns the result.
113
+ * @param success - The function to call if the result is a success.
114
+ * @param failure - The function to call if the result is a failure.
115
+ * @param loading - The function to call if the result is loading.
116
+ * @param notAsked - The function to call if the result is not-asked.
117
+ * @returns The result of calling the appropriate function based on the state of the result.
118
+ * @public
119
+ */
120
+ match: (e, {
121
+ success: s,
122
+ failure: t,
123
+ loading: r,
124
+ notAsked: i = r
125
+ }) => u.isSuccess(e) ? s(e.value) : u.isFailure(e) ? t(e.error) : u.isNotAsked(e) ? i() : r(e.previousValue),
126
+ /**
127
+ * When the result is a success, it applies the function to the value.
128
+ *
129
+ * @param r - The result.
130
+ * @param apply - The function to apply.
131
+ * @returns The result that was passed in.
132
+ * @public
133
+ */
134
+ whenSuccess: (e, s) => (u.isSuccess(e) && s(e.value), e),
135
+ /**
136
+ * When the result is a failure, it applies the function to the error.
137
+ *
138
+ * @param r - The result.
139
+ * @param apply - The function to apply.
140
+ * @returns The result that was passed in.
141
+ * @public
142
+ */
143
+ whenFailure: (e, s) => (u.isFailure(e) && s(e.error), e)
40
144
  };
41
145
  export {
42
146
  u as AsyncResult
package/bigint.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(n,e){return e<0n&&(n=-n,e=-e),n<=0n?n/e:(n-1n)/e+1n}function f(n,e){return e<0n&&(n=-n,e=-e),n>=0n?n/e:(n+1n)/e-1n}function c(n,e){return n<e?-1:n>e?1:0}function i(n){return n<0n?-n:n}function s(n,e){return n<e?n:e}function l(n,e){return n>e?n:e}function m(n,e){if(e<0n)throw new Error("negative exponent");let r=1n;for(;e>0n;)(e&1n)!==0n&&(r*=n),e>>=1n,n*=n;return r}function u(n,e){for(n=i(n),e=i(e);e>0n;){const r=e;e=n%e,n=r}return n}function v(n,e){return i(n*e)/u(n,e)}function t(n){if(n<2n)return!1;if(n===2n||n===3n)return!0;if(n%2n===0n||n%3n===0n)return!1;let e=5n;for(;e*e<=n;){if(n%e===0n||n%(e+2n)===0n)return!1;e+=6n}return!0}function a(n){if(n<2n)return 2n;if(n===2n)return 3n;for(n%2n===0n?n++:n+=2n;!t(n);)n+=2n;return n}function w(n){if(n<=2n)throw new Error("no previous prime");if(n===3n)return 2n;for(n%2n===0n?n--:n-=2n;!t(n);)n-=2n;return n}function p(n){return n%2n===0n}function P(n){return n%2n!==0n}function d(n){return n===0n}function g(n){return n===1n}function h(n){return n<0n}function O(n){return n>0n}exports.abs=i;exports.ceilDiv=o;exports.compare=c;exports.floorDiv=f;exports.gcd=u;exports.isEven=p;exports.isNegative=h;exports.isOdd=P;exports.isOne=g;exports.isPositive=O;exports.isPrime=t;exports.isZero=d;exports.lcm=v;exports.max=l;exports.min=s;exports.nextPrime=a;exports.pow=m;exports.prevPrime=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(n,i){return i<0n&&(n=-n,i=-i),n<=0n?n/i:(n-1n)/i+1n}function b(n,i){return i<0n&&(n=-n,i=-i),n>=0n?n/i:(n+1n)/i-1n}function f(n,i){return n<i?-1:n>i?1:0}function r(n){return n<0n?-n:n}function s(n,i){return n<i?n:i}function c(n,i){return n>i?n:i}function l(n,i){if(i<0n)throw new Error("negative exponent");let e=1n;for(;i>0n;)(i&1n)!==0n&&(e*=n),i>>=1n,n*=n;return e}function u(n,i){for(n=r(n),i=r(i);i>0n;){const e=i;i=n%i,n=e}return n}function v(n,i){return r(n*i)/u(n,i)}function t(n){if(n<2n)return!1;if(n===2n||n===3n)return!0;if(n%2n===0n||n%3n===0n)return!1;let i=5n;for(;i*i<=n;){if(n%i===0n||n%(i+2n)===0n)return!1;i+=6n}return!0}function I(n){if(n<2n)return 2n;if(n===2n)return 3n;for(n%2n===0n?n++:n+=2n;!t(n);)n+=2n;return n}function P(n){if(n<=2n)throw new Error("no previous prime");if(n===3n)return 2n;for(n%2n===0n?n--:n-=2n;!t(n);)n-=2n;return n}function a(n){return n%2n===0n}function m(n){return n%2n!==0n}function w(n){return n===0n}function d(n){return n===1n}function h(n){return n<0n}function p(n){return n>0n}exports.biAbs=r;exports.biCeilDiv=o;exports.biCompare=f;exports.biFloorDiv=b;exports.biGcd=u;exports.biIsEven=a;exports.biIsNegative=h;exports.biIsOdd=m;exports.biIsOne=d;exports.biIsPositive=p;exports.biIsPrime=t;exports.biIsZero=w;exports.biLcm=v;exports.biMax=c;exports.biMin=s;exports.biNextPrime=I;exports.biPow=l;exports.biPrevPrime=P;
package/bigint.d.ts CHANGED
@@ -1,18 +1,155 @@
1
- export declare function ceilDiv(x: bigint, y: bigint): bigint;
2
- export declare function floorDiv(x: bigint, y: bigint): bigint;
3
- export declare function compare(x: bigint, y: bigint): number;
4
- export declare function abs(x: bigint): bigint;
5
- export declare function min(x: bigint, y: bigint): bigint;
6
- export declare function max(x: bigint, y: bigint): bigint;
7
- export declare function pow(x: bigint, y: bigint): bigint;
8
- export declare function gcd(x: bigint, y: bigint): bigint;
9
- export declare function lcm(x: bigint, y: bigint): bigint;
10
- export declare function isPrime(x: bigint): boolean;
11
- export declare function nextPrime(x: bigint): bigint;
12
- export declare function prevPrime(x: bigint): bigint;
13
- export declare function isEven(x: bigint): boolean;
14
- export declare function isOdd(x: bigint): boolean;
15
- export declare function isZero(x: bigint): boolean;
16
- export declare function isOne(x: bigint): boolean;
17
- export declare function isNegative(x: bigint): boolean;
18
- export declare function isPositive(x: bigint): boolean;
1
+ /**
2
+ * Calculates the ceiling division of two BigInt numbers.
3
+ *
4
+ * @param x - The dividend.
5
+ * @param y - The divisor.
6
+ * @returns The result of dividing `x` by `y`, rounded up to the nearest whole number.
7
+ * @public
8
+ */
9
+ export declare function biCeilDiv(x: bigint, y: bigint): bigint;
10
+ /**
11
+ * Divides two BigInt numbers and returns the largest integer less than or equal to the quotient.
12
+ *
13
+ * @param x - The dividend.
14
+ * @param y - The divisor.
15
+ * @returns The largest integer less than or equal to the quotient of `x` divided by `y`.
16
+ * @public
17
+ */
18
+ export declare function biFloorDiv(x: bigint, y: bigint): bigint;
19
+ /**
20
+ * Compares two BigInt values and returns a number indicating their relative order.
21
+ * @param x - The first BigInt value to compare.
22
+ * @param y - The second BigInt value to compare.
23
+ * @returns A negative number if `x` is less than `y`, a positive number if `x` is greater than `y`,
24
+ * @public
25
+ * or zero if `x` is equal to `y`.
26
+ */
27
+ export declare function biCompare(x: bigint, y: bigint): number;
28
+ /**
29
+ * Returns the absolute value of a bigint.
30
+ *
31
+ * @param x - The bigint to compute the absolute value of.
32
+ * @returns The absolute value of `x`.
33
+ * @public
34
+ */
35
+ export declare function biAbs(x: bigint): bigint;
36
+ /**
37
+ * Returns the minimum of two BigInt values.
38
+ *
39
+ * @param x - The first BigInt value.
40
+ * @param y - The second BigInt value.
41
+ * @returns The smaller of the two BigInt values.
42
+ * @public
43
+ */
44
+ export declare function biMin(x: bigint, y: bigint): bigint;
45
+ /**
46
+ * Returns the maximum of two BigInt values.
47
+ *
48
+ * @param x - The first BigInt value.
49
+ * @param y - The second BigInt value.
50
+ * @returns The maximum of the two BigInt values.
51
+ * @public
52
+ */
53
+ export declare function biMax(x: bigint, y: bigint): bigint;
54
+ /**
55
+ * Calculates the power of a bigint number.
56
+ *
57
+ * @param x - The base number.
58
+ * @param y - The exponent.
59
+ * @returns The result of raising `x` to the power of `y`.
60
+ * @public
61
+ * @throws Error If the exponent `y` is negative.
62
+ */
63
+ export declare function biPow(x: bigint, y: bigint): bigint;
64
+ /**
65
+ * Calculates the greatest common divisor (GCD) of two BigInt numbers.
66
+ *
67
+ * @param x - The first BigInt number.
68
+ * @param y - The second BigInt number.
69
+ * @returns The GCD of `x` and `y`.
70
+ * @public
71
+ */
72
+ export declare function biGcd(x: bigint, y: bigint): bigint;
73
+ /**
74
+ * Calculates the least common multiple (LCM) of two BigInt numbers.
75
+ *
76
+ * @param x - The first BigInt number.
77
+ * @param y - The second BigInt number.
78
+ * @returns The least common multiple of `x` and `y`.
79
+ * @public
80
+ */
81
+ export declare function biLcm(x: bigint, y: bigint): bigint;
82
+ /**
83
+ * Checks if a given number is prime.
84
+ *
85
+ * @param x - The number to check for primality.
86
+ * @returns `true` if the number is prime, `false` otherwise.
87
+ * @public
88
+ */
89
+ export declare function biIsPrime(x: bigint): boolean;
90
+ /**
91
+ * Finds the next prime number greater than the given number.
92
+ *
93
+ * @param x - The starting number.
94
+ * @returns The next prime number greater than `x`.
95
+ * @public
96
+ */
97
+ export declare function biNextPrime(x: bigint): bigint;
98
+ /**
99
+ * Returns the previous prime number less than the given number.
100
+ * Throws an error if there is no previous prime.
101
+ *
102
+ * @param x - The number to find the previous prime for.
103
+ * @returns The previous prime number less than `x`.
104
+ * @public
105
+ * @throws Error if there is no previous prime.
106
+ */
107
+ export declare function biPrevPrime(x: bigint): bigint;
108
+ /**
109
+ * Checks if a given bigint is even.
110
+ *
111
+ * @param x - The bigint to check.
112
+ * @returns `true` if the bigint is even, `false` otherwise.
113
+ * @public
114
+ */
115
+ export declare function biIsEven(x: bigint): boolean;
116
+ /**
117
+ * Checks if a given bigint is odd.
118
+ *
119
+ * @param x - The bigint to check.
120
+ * @returns `true` if the bigint is odd, `false` otherwise.
121
+ * @public
122
+ */
123
+ export declare function biIsOdd(x: bigint): boolean;
124
+ /**
125
+ * Checks if a given bigint is zero.
126
+ *
127
+ * @param x - The bigint to check.
128
+ * @returns `true` if the bigint is zero, `false` otherwise.
129
+ * @public
130
+ */
131
+ export declare function biIsZero(x: bigint): boolean;
132
+ /**
133
+ * Checks if a given bigint is equal to 1n.
134
+ *
135
+ * @param x - The bigint to check.
136
+ * @returns `true` if the bigint is equal to 1n, `false` otherwise.
137
+ * @public
138
+ */
139
+ export declare function biIsOne(x: bigint): boolean;
140
+ /**
141
+ * Checks if a given bigint is negative.
142
+ *
143
+ * @param x - The bigint to check.
144
+ * @returns `true` if the bigint is negative, `false` otherwise.
145
+ * @public
146
+ */
147
+ export declare function biIsNegative(x: bigint): boolean;
148
+ /**
149
+ * Checks if a bigint is positive.
150
+ *
151
+ * @param x - The bigint to check.
152
+ * @returns `true` if the bigint is positive, `false` otherwise.
153
+ * @public
154
+ */
155
+ export declare function biIsPositive(x: bigint): boolean;
package/bigint.js CHANGED
@@ -7,31 +7,31 @@ function o(n, r) {
7
7
  function c(n, r) {
8
8
  return n < r ? -1 : n > r ? 1 : 0;
9
9
  }
10
- function i(n) {
10
+ function e(n) {
11
11
  return n < 0n ? -n : n;
12
12
  }
13
- function s(n, r) {
13
+ function b(n, r) {
14
14
  return n < r ? n : r;
15
15
  }
16
- function l(n, r) {
16
+ function s(n, r) {
17
17
  return n > r ? n : r;
18
18
  }
19
- function w(n, r) {
19
+ function l(n, r) {
20
20
  if (r < 0n) throw new Error("negative exponent");
21
- let e = 1n;
21
+ let i = 1n;
22
22
  for (; r > 0n; )
23
- (r & 1n) !== 0n && (e *= n), r >>= 1n, n *= n;
24
- return e;
23
+ (r & 1n) !== 0n && (i *= n), r >>= 1n, n *= n;
24
+ return i;
25
25
  }
26
26
  function u(n, r) {
27
- for (n = i(n), r = i(r); r > 0n; ) {
28
- const e = r;
29
- r = n % r, n = e;
27
+ for (n = e(n), r = e(r); r > 0n; ) {
28
+ const i = r;
29
+ r = n % r, n = i;
30
30
  }
31
31
  return n;
32
32
  }
33
- function a(n, r) {
34
- return i(n * r) / u(n, r);
33
+ function w(n, r) {
34
+ return e(n * r) / u(n, r);
35
35
  }
36
36
  function t(n) {
37
37
  if (n < 2n) return !1;
@@ -44,13 +44,13 @@ function t(n) {
44
44
  }
45
45
  return !0;
46
46
  }
47
- function m(n) {
47
+ function v(n) {
48
48
  if (n < 2n) return 2n;
49
49
  if (n === 2n) return 3n;
50
50
  for (n % 2n === 0n ? n++ : n += 2n; !t(n); ) n += 2n;
51
51
  return n;
52
52
  }
53
- function v(n) {
53
+ function a(n) {
54
54
  if (n <= 2n) throw new Error("no previous prime");
55
55
  if (n === 3n) return 2n;
56
56
  for (n % 2n === 0n ? n-- : n -= 2n; !t(n); ) n -= 2n;
@@ -59,38 +59,38 @@ function v(n) {
59
59
  function h(n) {
60
60
  return n % 2n === 0n;
61
61
  }
62
- function p(n) {
62
+ function I(n) {
63
63
  return n % 2n !== 0n;
64
64
  }
65
- function P(n) {
65
+ function m(n) {
66
66
  return n === 0n;
67
67
  }
68
- function d(n) {
68
+ function P(n) {
69
69
  return n === 1n;
70
70
  }
71
- function g(n) {
71
+ function p(n) {
72
72
  return n < 0n;
73
73
  }
74
- function E(n) {
74
+ function d(n) {
75
75
  return n > 0n;
76
76
  }
77
77
  export {
78
- i as abs,
79
- f as ceilDiv,
80
- c as compare,
81
- o as floorDiv,
82
- u as gcd,
83
- h as isEven,
84
- g as isNegative,
85
- p as isOdd,
86
- d as isOne,
87
- E as isPositive,
88
- t as isPrime,
89
- P as isZero,
90
- a as lcm,
91
- l as max,
92
- s as min,
93
- m as nextPrime,
94
- w as pow,
95
- v as prevPrime
78
+ e as biAbs,
79
+ f as biCeilDiv,
80
+ c as biCompare,
81
+ o as biFloorDiv,
82
+ u as biGcd,
83
+ h as biIsEven,
84
+ p as biIsNegative,
85
+ I as biIsOdd,
86
+ P as biIsOne,
87
+ d as biIsPositive,
88
+ t as biIsPrime,
89
+ m as biIsZero,
90
+ w as biLcm,
91
+ s as biMax,
92
+ b as biMin,
93
+ v as biNextPrime,
94
+ l as biPow,
95
+ a as biPrevPrime
96
96
  };
package/boolean.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e,r){return e===r?0:e?-1:1}function a(e){return e?1:0}function n(e){if(e==null)return!1;switch(e.toLowerCase()){case"true":case"false":case"0":case"1":case"on":case"off":return!0;default:return!1}}function s(e){switch(e.toLowerCase()){case"true":case"1":case"on":return!0;case"false":case"0":case"off":return!1;default:throw new Error(`unable to parse '${e}'`)}}function o(e,r){return e!==r}exports.canParse=n;exports.compare=t;exports.parse=s;exports.toInt=a;exports.xor=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(e,o){return e===o?0:e?-1:1}function n(e){return e?1:0}function r(e){if(e==null)return!1;switch(e.toLowerCase()){case"true":case"false":case"0":case"1":case"on":case"off":return!0;default:return!1}}function t(e){switch(e.toLowerCase()){case"true":case"1":case"on":return!0;case"false":case"0":case"off":return!1;default:throw new Error(`unable to parse '${e}'`)}}function s(e,o){return e!==o}exports.booleanToInt=n;exports.canParseBoolean=r;exports.compareBooleans=a;exports.parseBoolean=t;exports.xorBoolean=s;
package/boolean.d.ts CHANGED
@@ -3,21 +3,53 @@
3
3
  */
4
4
  /**
5
5
  * Returns a comparison value (`Int`) from two boolean values.
6
+ *
7
+ * @param a - The first boolean value.
8
+ * @param b - The second boolean value.
9
+ * @returns A comparison value.
10
+ * @public
6
11
  */
7
- export declare function compare(a: boolean, b: boolean): number;
12
+ export declare function compareBooleans(a: boolean, b: boolean): number;
8
13
  /**
9
14
  * Converts a boolean to an integer value (`true` => `1`, `false` => `0`).
15
+ *
16
+ * @param v - The boolean value.
17
+ * @returns The integer value.
18
+ * @public
10
19
  */
11
- export declare function toInt(v: boolean): number;
20
+ export declare function booleanToInt(v: boolean): number;
12
21
  /**
13
- * Returns `true` if the passed value is either `true` or `false` (case insensitive).
22
+ * Returns `true` if the passed value can be parsed as a boolean. The following values are considered parsable:
23
+ *
24
+ * - `'true'` / `'false'`
25
+ * - `'0'` / `'1'`
26
+ * - `'on'` / `'off'`
27
+ *
28
+ * The comparison is case insensitive.
29
+ *
30
+ * @param v - The value to check.
31
+ * @returns `true` if the value can be parsed; otherwise, `false`.
32
+ * @public
14
33
  */
15
- export declare function canParse(v: string): boolean;
34
+ export declare function canParseBoolean(v: string): boolean;
16
35
  /**
17
- * Returns `true`/`false` if the passed value is `true`/`false` (case insensitive) with any other value it will return null.
36
+ * Returns `true`/`false` if the passed value can be parsed. The following values are considered parsable:
37
+ *
38
+ * - `'true'` / `'false'`
39
+ * - `'0'` / `'1'`
40
+ * - `'on'` / `'off'`
41
+ *
42
+ * @param v - The value to parse.
43
+ * @returns The parsed boolean value.
44
+ * @public
18
45
  */
19
- export declare function parse(v: string): boolean;
46
+ export declare function parseBoolean(v: string): boolean;
20
47
  /**
21
48
  * Returns `true` when arguments are different.
49
+ *
50
+ * @param a - The first boolean value.
51
+ * @param b - The second boolean value.
52
+ * @returns The result of the XOR operation.
53
+ * @public
22
54
  */
23
- export declare function xor(a: boolean, b: boolean): boolean;
55
+ export declare function xorBoolean(a: boolean, b: boolean): boolean;
package/boolean.js CHANGED
@@ -1,10 +1,10 @@
1
- function t(e, r) {
1
+ function a(e, r) {
2
2
  return e === r ? 0 : e ? -1 : 1;
3
3
  }
4
- function a(e) {
4
+ function n(e) {
5
5
  return e ? 1 : 0;
6
6
  }
7
- function n(e) {
7
+ function o(e) {
8
8
  if (e == null) return !1;
9
9
  switch (e.toLowerCase()) {
10
10
  case "true":
@@ -18,7 +18,7 @@ function n(e) {
18
18
  return !1;
19
19
  }
20
20
  }
21
- function s(e) {
21
+ function t(e) {
22
22
  switch (e.toLowerCase()) {
23
23
  case "true":
24
24
  case "1":
@@ -32,13 +32,13 @@ function s(e) {
32
32
  throw new Error(`unable to parse '${e}'`);
33
33
  }
34
34
  }
35
- function c(e, r) {
35
+ function s(e, r) {
36
36
  return e !== r;
37
37
  }
38
38
  export {
39
- n as canParse,
40
- t as compare,
41
- s as parse,
42
- a as toInt,
43
- c as xor
39
+ n as booleanToInt,
40
+ o as canParseBoolean,
41
+ a as compareBooleans,
42
+ t as parseBoolean,
43
+ s as xorBoolean
44
44
  };