@nlozgachev/pipelined 0.63.0 → 0.64.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/README.md +9 -9
- package/dist/{Validation-C5RGZUXy.d.ts → Task-9SJCMtG4.d.ts} +602 -1411
- package/dist/{Validation-KFUpea_k.d.cts → Task-C_goFYQ1.d.cts} +602 -1411
- package/dist/core.cjs +1200 -1111
- package/dist/core.d.cts +114 -16
- package/dist/core.d.ts +114 -16
- package/dist/core.mjs +1200 -1111
- package/dist/data.cjs +398 -3
- package/dist/data.d.cts +345 -4
- package/dist/data.d.ts +345 -4
- package/dist/data.mjs +394 -0
- package/dist/index.cjs +1587 -1103
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1583 -1100
- package/package.json +1 -1
package/dist/data.cjs
CHANGED
|
@@ -3,9 +3,9 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target,
|
|
7
|
-
for (var name in
|
|
8
|
-
__defProp(target, name, { get:
|
|
6
|
+
var __export = (target, all2) => {
|
|
7
|
+
for (var name in all2)
|
|
8
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -22,6 +22,7 @@ var Data_exports = {};
|
|
|
22
22
|
__export(Data_exports, {
|
|
23
23
|
Arr: () => Arr,
|
|
24
24
|
BigNum: () => BigNum,
|
|
25
|
+
Bool: () => Bool,
|
|
25
26
|
Dict: () => Dict,
|
|
26
27
|
Json: () => Json,
|
|
27
28
|
Num: () => Num,
|
|
@@ -1749,6 +1750,60 @@ var Arr = {
|
|
|
1749
1750
|
|
|
1750
1751
|
// src/Data/BigNum.ts
|
|
1751
1752
|
var BigNum = {
|
|
1753
|
+
is: {
|
|
1754
|
+
/**
|
|
1755
|
+
* Returns `true` when the bigint is equal to zero (`0n`).
|
|
1756
|
+
*
|
|
1757
|
+
* @example
|
|
1758
|
+
* ```ts
|
|
1759
|
+
* BigNum.is.zero(0n); // true
|
|
1760
|
+
* BigNum.is.zero(5n); // false
|
|
1761
|
+
* ```
|
|
1762
|
+
*/
|
|
1763
|
+
zero: (b) => b === 0n,
|
|
1764
|
+
/**
|
|
1765
|
+
* Returns `true` when the bigint is an even integer.
|
|
1766
|
+
*
|
|
1767
|
+
* @example
|
|
1768
|
+
* ```ts
|
|
1769
|
+
* BigNum.is.even(4n); // true
|
|
1770
|
+
* BigNum.is.even(3n); // false
|
|
1771
|
+
* ```
|
|
1772
|
+
*/
|
|
1773
|
+
even: (b) => b % 2n === 0n,
|
|
1774
|
+
/**
|
|
1775
|
+
* Returns `true` when the bigint is an odd integer.
|
|
1776
|
+
*
|
|
1777
|
+
* @example
|
|
1778
|
+
* ```ts
|
|
1779
|
+
* BigNum.is.odd(3n); // true
|
|
1780
|
+
* BigNum.is.odd(4n); // false
|
|
1781
|
+
* ```
|
|
1782
|
+
*/
|
|
1783
|
+
odd: (b) => b % 2n !== 0n,
|
|
1784
|
+
/**
|
|
1785
|
+
* Returns `true` when the bigint is strictly greater than zero (`0n`).
|
|
1786
|
+
*
|
|
1787
|
+
* @example
|
|
1788
|
+
* ```ts
|
|
1789
|
+
* BigNum.is.positive(5n); // true
|
|
1790
|
+
* BigNum.is.positive(0n); // false
|
|
1791
|
+
* BigNum.is.positive(-5n); // false
|
|
1792
|
+
* ```
|
|
1793
|
+
*/
|
|
1794
|
+
positive: (b) => b > 0n,
|
|
1795
|
+
/**
|
|
1796
|
+
* Returns `true` when the bigint is strictly less than zero (`0n`).
|
|
1797
|
+
*
|
|
1798
|
+
* @example
|
|
1799
|
+
* ```ts
|
|
1800
|
+
* BigNum.is.negative(-5n); // true
|
|
1801
|
+
* BigNum.is.negative(0n); // false
|
|
1802
|
+
* BigNum.is.negative(5n); // false
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
negative: (b) => b < 0n
|
|
1806
|
+
},
|
|
1752
1807
|
// --- from ---
|
|
1753
1808
|
from: {
|
|
1754
1809
|
/**
|
|
@@ -1898,6 +1953,345 @@ var BigNum = {
|
|
|
1898
1953
|
max: (b) => (a) => a > b ? a : b
|
|
1899
1954
|
};
|
|
1900
1955
|
|
|
1956
|
+
// src/Data/Bool.ts
|
|
1957
|
+
var isBoolean = (u) => typeof u === "boolean";
|
|
1958
|
+
var isTrue = (u) => u === true;
|
|
1959
|
+
var isFalse = (u) => u === false;
|
|
1960
|
+
var isTruthy = (u) => Boolean(u);
|
|
1961
|
+
var isFalsy = (u) => !u;
|
|
1962
|
+
var not = (b) => !b;
|
|
1963
|
+
var and = (that) => (self) => self && that;
|
|
1964
|
+
var or = (that) => (self) => self || that;
|
|
1965
|
+
var xor = (that) => (self) => self !== that;
|
|
1966
|
+
var andLazy = (that) => (self) => self && that();
|
|
1967
|
+
var orLazy = (that) => (self) => self || that();
|
|
1968
|
+
var all = (booleans) => {
|
|
1969
|
+
for (let i = 0; i < booleans.length; i++) {
|
|
1970
|
+
if (!booleans[i]) {
|
|
1971
|
+
return false;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
return true;
|
|
1975
|
+
};
|
|
1976
|
+
var any = (booleans) => {
|
|
1977
|
+
for (let i = 0; i < booleans.length; i++) {
|
|
1978
|
+
if (booleans[i]) {
|
|
1979
|
+
return true;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
return false;
|
|
1983
|
+
};
|
|
1984
|
+
var fold = (onFalse, onTrue) => (b) => b ? onTrue() : onFalse();
|
|
1985
|
+
var match = (cases) => (b) => b ? cases.true() : cases.false();
|
|
1986
|
+
var fromString = (s) => {
|
|
1987
|
+
const trimmed = s.trim().toLowerCase();
|
|
1988
|
+
if (trimmed === "true") {
|
|
1989
|
+
return Maybe.make.some(true);
|
|
1990
|
+
}
|
|
1991
|
+
if (trimmed === "false") {
|
|
1992
|
+
return Maybe.make.some(false);
|
|
1993
|
+
}
|
|
1994
|
+
return Maybe.make.none();
|
|
1995
|
+
};
|
|
1996
|
+
var fromNumber = (n) => {
|
|
1997
|
+
if (n === 1) {
|
|
1998
|
+
return Maybe.make.some(true);
|
|
1999
|
+
}
|
|
2000
|
+
if (n === 0) {
|
|
2001
|
+
return Maybe.make.some(false);
|
|
2002
|
+
}
|
|
2003
|
+
return Maybe.make.none();
|
|
2004
|
+
};
|
|
2005
|
+
var fromTruthy = (value) => Boolean(value);
|
|
2006
|
+
var toMaybe = (onTrue) => (b) => b ? Maybe.make.some(onTrue()) : Maybe.make.none();
|
|
2007
|
+
var toResult2 = (onErr, onOk) => (b) => b ? Result.make.ok(onOk()) : Result.make.err(onErr());
|
|
2008
|
+
var toNumber = (b) => b ? 1 : 0;
|
|
2009
|
+
var toString = (b) => b ? "true" : "false";
|
|
2010
|
+
var Bool = {
|
|
2011
|
+
is: {
|
|
2012
|
+
/**
|
|
2013
|
+
* Type guard — checks if a value is a primitive boolean.
|
|
2014
|
+
*
|
|
2015
|
+
* @example
|
|
2016
|
+
* ```ts
|
|
2017
|
+
* Bool.is.boolean(true); // true
|
|
2018
|
+
* Bool.is.boolean(false); // true
|
|
2019
|
+
* Bool.is.boolean("true"); // false
|
|
2020
|
+
* Bool.is.boolean(null); // false
|
|
2021
|
+
* ```
|
|
2022
|
+
*/
|
|
2023
|
+
boolean: isBoolean,
|
|
2024
|
+
/**
|
|
2025
|
+
* Narrowing guard — checks if a value is strictly `true`.
|
|
2026
|
+
*
|
|
2027
|
+
* @example
|
|
2028
|
+
* ```ts
|
|
2029
|
+
* Bool.is.true(true); // true
|
|
2030
|
+
* Bool.is.true(false); // false
|
|
2031
|
+
* ```
|
|
2032
|
+
*/
|
|
2033
|
+
true: isTrue,
|
|
2034
|
+
/**
|
|
2035
|
+
* Narrowing guard — checks if a value is strictly `false`.
|
|
2036
|
+
*
|
|
2037
|
+
* @example
|
|
2038
|
+
* ```ts
|
|
2039
|
+
* Bool.is.false(false); // true
|
|
2040
|
+
* Bool.is.false(true); // false
|
|
2041
|
+
* ```
|
|
2042
|
+
*/
|
|
2043
|
+
false: isFalse,
|
|
2044
|
+
/**
|
|
2045
|
+
* Type guard — checks if a value is truthy (not `false`, `0`, `0n`, `""`, `null`, `undefined`, or `NaN`).
|
|
2046
|
+
*
|
|
2047
|
+
* @example
|
|
2048
|
+
* ```ts
|
|
2049
|
+
* Bool.is.truthy("hello"); // true
|
|
2050
|
+
* Bool.is.truthy(42); // true
|
|
2051
|
+
* Bool.is.truthy(0); // false
|
|
2052
|
+
* Bool.is.truthy(null); // false
|
|
2053
|
+
* ```
|
|
2054
|
+
*/
|
|
2055
|
+
truthy: isTruthy,
|
|
2056
|
+
/**
|
|
2057
|
+
* Type guard — checks if a value is falsy (`false`, `0`, `0n`, `""`, `null`, `undefined`, or `NaN`).
|
|
2058
|
+
*
|
|
2059
|
+
* @example
|
|
2060
|
+
* ```ts
|
|
2061
|
+
* Bool.is.falsy(""); // true
|
|
2062
|
+
* Bool.is.falsy(null); // true
|
|
2063
|
+
* Bool.is.falsy("content"); // false
|
|
2064
|
+
* ```
|
|
2065
|
+
*/
|
|
2066
|
+
falsy: isFalsy
|
|
2067
|
+
},
|
|
2068
|
+
/**
|
|
2069
|
+
* Unary boolean negation: inverts the given boolean value.
|
|
2070
|
+
*
|
|
2071
|
+
* @example
|
|
2072
|
+
* ```ts
|
|
2073
|
+
* Bool.not(true); // false
|
|
2074
|
+
* Bool.not(false); // true
|
|
2075
|
+
* ```
|
|
2076
|
+
*/
|
|
2077
|
+
not,
|
|
2078
|
+
/**
|
|
2079
|
+
* Logical AND combinator. Returns `true` only if both `self` and `that` are `true`.
|
|
2080
|
+
*
|
|
2081
|
+
* Data-last: `pipe(self, Bool.and(that))`.
|
|
2082
|
+
*
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```ts
|
|
2085
|
+
* pipe(true, Bool.and(true)); // true
|
|
2086
|
+
* pipe(true, Bool.and(false)); // false
|
|
2087
|
+
* ```
|
|
2088
|
+
*/
|
|
2089
|
+
and,
|
|
2090
|
+
/**
|
|
2091
|
+
* Logical OR combinator. Returns `true` if either `self` or `that` is `true`.
|
|
2092
|
+
*
|
|
2093
|
+
* Data-last: `pipe(self, Bool.or(that))`.
|
|
2094
|
+
*
|
|
2095
|
+
* @example
|
|
2096
|
+
* ```ts
|
|
2097
|
+
* pipe(false, Bool.or(true)); // true
|
|
2098
|
+
* pipe(false, Bool.or(false)); // false
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
or,
|
|
2102
|
+
/**
|
|
2103
|
+
* Logical XOR (exclusive OR) combinator. Returns `true` if exactly one of `self` and `that` is `true`.
|
|
2104
|
+
*
|
|
2105
|
+
* Data-last: `pipe(self, Bool.xor(that))`.
|
|
2106
|
+
*
|
|
2107
|
+
* @example
|
|
2108
|
+
* ```ts
|
|
2109
|
+
* pipe(true, Bool.xor(false)); // true
|
|
2110
|
+
* pipe(true, Bool.xor(true)); // false
|
|
2111
|
+
* ```
|
|
2112
|
+
*/
|
|
2113
|
+
xor,
|
|
2114
|
+
/**
|
|
2115
|
+
* Lazy logical AND combinator.
|
|
2116
|
+
* If `self` is `false`, the `that` computation is never evaluated.
|
|
2117
|
+
*
|
|
2118
|
+
* Data-last: `pipe(self, Bool.andLazy(that))`.
|
|
2119
|
+
*
|
|
2120
|
+
* @example
|
|
2121
|
+
* ```ts
|
|
2122
|
+
* pipe(
|
|
2123
|
+
* isCached,
|
|
2124
|
+
* Bool.andLazy(() => checkPermissions())
|
|
2125
|
+
* );
|
|
2126
|
+
* ```
|
|
2127
|
+
*/
|
|
2128
|
+
andLazy,
|
|
2129
|
+
/**
|
|
2130
|
+
* Lazy logical OR combinator.
|
|
2131
|
+
* If `self` is `true`, the `that` computation is never evaluated.
|
|
2132
|
+
*
|
|
2133
|
+
* Data-last: `pipe(self, Bool.orLazy(that))`.
|
|
2134
|
+
*
|
|
2135
|
+
* @example
|
|
2136
|
+
* ```ts
|
|
2137
|
+
* pipe(
|
|
2138
|
+
* isAdmin,
|
|
2139
|
+
* Bool.orLazy(() => hasAccess(userId))
|
|
2140
|
+
* );
|
|
2141
|
+
* ```
|
|
2142
|
+
*/
|
|
2143
|
+
orLazy,
|
|
2144
|
+
/**
|
|
2145
|
+
* N-ary AND aggregation across an array of booleans.
|
|
2146
|
+
* Returns `true` if every boolean is `true`, or for an empty array (vacuous truth).
|
|
2147
|
+
* Short-circuits on the first `false`.
|
|
2148
|
+
*
|
|
2149
|
+
* @example
|
|
2150
|
+
* ```ts
|
|
2151
|
+
* Bool.all([true, true, true]); // true
|
|
2152
|
+
* Bool.all([true, false, true]); // false
|
|
2153
|
+
* Bool.all([]); // true
|
|
2154
|
+
* ```
|
|
2155
|
+
*/
|
|
2156
|
+
all,
|
|
2157
|
+
/**
|
|
2158
|
+
* N-ary OR aggregation across an array of booleans.
|
|
2159
|
+
* Returns `true` if at least one boolean is `true`. Returns `false` for an empty array.
|
|
2160
|
+
* Short-circuits on the first `true`.
|
|
2161
|
+
*
|
|
2162
|
+
* @example
|
|
2163
|
+
* ```ts
|
|
2164
|
+
* Bool.any([false, true, false]); // true
|
|
2165
|
+
* Bool.any([false, false]); // false
|
|
2166
|
+
* Bool.any([]); // false
|
|
2167
|
+
* ```
|
|
2168
|
+
*/
|
|
2169
|
+
any,
|
|
2170
|
+
/**
|
|
2171
|
+
* Catamorphism for boolean: evaluates `onFalse()` when `false` and `onTrue()` when `true`.
|
|
2172
|
+
*
|
|
2173
|
+
* Positional ordering: `onFalse` first, `onTrue` second.
|
|
2174
|
+
* Aligned with `Result.fold(onErr, onOk)` and `Maybe.fold(onNone, onSome)`.
|
|
2175
|
+
*
|
|
2176
|
+
* @example
|
|
2177
|
+
* ```ts
|
|
2178
|
+
* pipe(
|
|
2179
|
+
* isDarkMode,
|
|
2180
|
+
* Bool.fold(
|
|
2181
|
+
* () => "light-theme",
|
|
2182
|
+
* () => "dark-theme"
|
|
2183
|
+
* )
|
|
2184
|
+
* );
|
|
2185
|
+
* ```
|
|
2186
|
+
*/
|
|
2187
|
+
fold,
|
|
2188
|
+
/**
|
|
2189
|
+
* Pattern matching on boolean using named cases `{ true, false }`.
|
|
2190
|
+
*
|
|
2191
|
+
* @example
|
|
2192
|
+
* ```ts
|
|
2193
|
+
* pipe(
|
|
2194
|
+
* isEnabled,
|
|
2195
|
+
* Bool.match({
|
|
2196
|
+
* true: () => "Feature Active",
|
|
2197
|
+
* false: () => "Feature Disabled",
|
|
2198
|
+
* })
|
|
2199
|
+
* );
|
|
2200
|
+
* ```
|
|
2201
|
+
*/
|
|
2202
|
+
match,
|
|
2203
|
+
// --- from ---
|
|
2204
|
+
from: {
|
|
2205
|
+
/**
|
|
2206
|
+
* Parses a string into a `Maybe<boolean>`.
|
|
2207
|
+
* Returns `Some(true)` for `"true"`, `Some(false)` for `"false"` (case-insensitive & trimmed),
|
|
2208
|
+
* and `None` for any other string.
|
|
2209
|
+
*
|
|
2210
|
+
* @example
|
|
2211
|
+
* ```ts
|
|
2212
|
+
* Bool.from.string("true"); // Some(true)
|
|
2213
|
+
* Bool.from.string("FALSE"); // Some(false)
|
|
2214
|
+
* Bool.from.string("yes"); // None
|
|
2215
|
+
* ```
|
|
2216
|
+
*/
|
|
2217
|
+
string: fromString,
|
|
2218
|
+
/**
|
|
2219
|
+
* Converts a number into a `Maybe<boolean>`.
|
|
2220
|
+
* Returns `Some(true)` for `1`, `Some(false)` for `0`, and `None` for any other number.
|
|
2221
|
+
*
|
|
2222
|
+
* @example
|
|
2223
|
+
* ```ts
|
|
2224
|
+
* Bool.from.number(1); // Some(true)
|
|
2225
|
+
* Bool.from.number(0); // Some(false)
|
|
2226
|
+
* Bool.from.number(42); // None
|
|
2227
|
+
* ```
|
|
2228
|
+
*/
|
|
2229
|
+
number: fromNumber,
|
|
2230
|
+
/**
|
|
2231
|
+
* Coerces any unknown value into a boolean via standard JS `Boolean(value)`.
|
|
2232
|
+
*
|
|
2233
|
+
* @example
|
|
2234
|
+
* ```ts
|
|
2235
|
+
* Bool.from.truthy("hello"); // true
|
|
2236
|
+
* Bool.from.truthy(0); // false
|
|
2237
|
+
* ```
|
|
2238
|
+
*/
|
|
2239
|
+
truthy: fromTruthy
|
|
2240
|
+
},
|
|
2241
|
+
// --- to ---
|
|
2242
|
+
to: {
|
|
2243
|
+
/**
|
|
2244
|
+
* Lifts a boolean condition into a `Maybe`.
|
|
2245
|
+
* Returns `Some(onTrue())` when `true`, and `None` when `false`.
|
|
2246
|
+
*
|
|
2247
|
+
* @example
|
|
2248
|
+
* ```ts
|
|
2249
|
+
* pipe(
|
|
2250
|
+
* user.isVerified,
|
|
2251
|
+
* Bool.to.Maybe(() => user.profile)
|
|
2252
|
+
* ); // Some(profile) or None
|
|
2253
|
+
* ```
|
|
2254
|
+
*/
|
|
2255
|
+
Maybe: toMaybe,
|
|
2256
|
+
/**
|
|
2257
|
+
* Lifts a boolean condition into a `Result`.
|
|
2258
|
+
* Returns `Ok(onOk())` when `true`, and `Err(onErr())` when `false`.
|
|
2259
|
+
*
|
|
2260
|
+
* @example
|
|
2261
|
+
* ```ts
|
|
2262
|
+
* pipe(
|
|
2263
|
+
* hasPermission,
|
|
2264
|
+
* Bool.to.Result(
|
|
2265
|
+
* () => "Permission denied",
|
|
2266
|
+
* () => sessionData
|
|
2267
|
+
* )
|
|
2268
|
+
* ); // Ok(sessionData) or Err("Permission denied")
|
|
2269
|
+
* ```
|
|
2270
|
+
*/
|
|
2271
|
+
Result: toResult2,
|
|
2272
|
+
/**
|
|
2273
|
+
* Converts a boolean to numeric `1` or `0`.
|
|
2274
|
+
*
|
|
2275
|
+
* @example
|
|
2276
|
+
* ```ts
|
|
2277
|
+
* Bool.to.number(true); // 1
|
|
2278
|
+
* Bool.to.number(false); // 0
|
|
2279
|
+
* ```
|
|
2280
|
+
*/
|
|
2281
|
+
number: toNumber,
|
|
2282
|
+
/**
|
|
2283
|
+
* Converts a boolean to literal string `"true"` or `"false"`.
|
|
2284
|
+
*
|
|
2285
|
+
* @example
|
|
2286
|
+
* ```ts
|
|
2287
|
+
* Bool.to.string(true); // "true"
|
|
2288
|
+
* Bool.to.string(false); // "false"
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
string: toString
|
|
2292
|
+
}
|
|
2293
|
+
};
|
|
2294
|
+
|
|
1901
2295
|
// src/Data/Dict.ts
|
|
1902
2296
|
var DictIs = {
|
|
1903
2297
|
empty: (m) => m.size === 0,
|
|
@@ -3287,6 +3681,7 @@ var Uniq = {
|
|
|
3287
3681
|
0 && (module.exports = {
|
|
3288
3682
|
Arr,
|
|
3289
3683
|
BigNum,
|
|
3684
|
+
Bool,
|
|
3290
3685
|
Dict,
|
|
3291
3686
|
Json,
|
|
3292
3687
|
Num,
|