massaman 0.4.0 → 0.5.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 +4 -4
- package/dist/array/index.d.mts +2 -2
- package/dist/array/index.mjs +2 -2
- package/dist/{array-DGmsKhoS.mjs → array-glQHknc3.mjs} +3 -3
- package/dist/{array-DGmsKhoS.mjs.map → array-glQHknc3.mjs.map} +1 -1
- package/dist/bigint/index.d.mts +2 -0
- package/dist/bigint/index.mjs +2 -0
- package/dist/control/index.d.mts +1 -1
- package/dist/function/index.d.mts +1 -1
- package/dist/{index-B9ig68hj.d.mts → index-BPYJOreI.d.mts} +3 -4
- package/dist/index-BPYJOreI.d.mts.map +1 -0
- package/dist/index-C7dxY5U-.d.mts.map +1 -1
- package/dist/{index-DKEiLKtl.d.mts → index-D5q3I26j.d.mts} +1 -2
- package/dist/index-D5q3I26j.d.mts.map +1 -0
- package/dist/{index-CQAReq7e.d.mts → index-D7DGVrkN.d.mts} +1 -2
- package/dist/index-D7DGVrkN.d.mts.map +1 -0
- package/dist/index-DTrYN2UY.d.mts +20 -0
- package/dist/index-DTrYN2UY.d.mts.map +1 -0
- package/dist/{index-DPhfdSi7.d.mts → index-DcVpX2Bb.d.mts} +21 -17
- package/dist/index-DcVpX2Bb.d.mts.map +1 -0
- package/dist/{index-CoCKuspw.d.mts → index-DlZyDxI_.d.mts} +1 -2
- package/dist/index-DlZyDxI_.d.mts.map +1 -0
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +6 -6
- package/dist/match/index.d.mts +1 -1
- package/dist/match/index.mjs +1 -1
- package/dist/match-fBetfaIa.mjs +49 -0
- package/dist/match-fBetfaIa.mjs.map +1 -0
- package/dist/object/index.d.mts +2 -2
- package/dist/object/index.mjs +2 -2
- package/dist/object-CILtZbTT.mjs +27 -0
- package/dist/{object-DUAxOgHi.mjs.map → object-CILtZbTT.mjs.map} +1 -1
- package/dist/predicate/index.d.mts +1 -1
- package/dist/promise/index.d.mts +2 -2
- package/dist/promise/index.mjs +2 -2
- package/dist/string/index.d.mts +2 -2
- package/dist/string/index.mjs +2 -2
- package/dist/types-BsimcHZS.d.mts.map +1 -1
- package/package.json +13 -10
- package/dist/index-B9ig68hj.d.mts.map +0 -1
- package/dist/index-CQAReq7e.d.mts.map +0 -1
- package/dist/index-CoCKuspw.d.mts.map +0 -1
- package/dist/index-D5qkz-H4.d.mts +0 -20
- package/dist/index-D5qkz-H4.d.mts.map +0 -1
- package/dist/index-DKEiLKtl.d.mts.map +0 -1
- package/dist/index-DPhfdSi7.d.mts.map +0 -1
- package/dist/match-uR6HPDRb.mjs +0 -44
- package/dist/match-uR6HPDRb.mjs.map +0 -1
- package/dist/object-DUAxOgHi.mjs +0 -27
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/zrosenbauer/massaman/main/.github/assets/banner.
|
|
2
|
+
<img src="https://raw.githubusercontent.com/zrosenbauer/massaman/main/.github/assets/banner.svg" alt="massaman" width="100%" />
|
|
3
3
|
<p><strong>Functional programming utilities for TypeScript. Result types, pattern matching, async pipelines. Fully typed.</strong></p>
|
|
4
4
|
|
|
5
5
|
<a href="https://github.com/zrosenbauer/massaman/actions/workflows/ci.yml"><img src="https://github.com/zrosenbauer/massaman/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
- Rust's `match` in TypeScript: exhaustive pattern matching via re-exported [ts-pattern](https://github.com/gvergnaud/ts-pattern).
|
|
14
14
|
- Rust's `Result` in TypeScript: compose fallible operations without throws (`attempt`, `attemptAsync`, `ok`, `err`, `isOk`, `unwrap`).
|
|
15
15
|
- Functional programming, fully typed: `flow`, `flowAsync`, `tap`, `when`, `ifElse`, and point-free combinators with end-to-end inference.
|
|
16
|
-
- The missing pieces around [es-toolkit](https://es-toolkit.dev): variadic-narrowing predicates, async composition, and consistent error normalization
|
|
17
|
-
- Tree-shakeable:
|
|
16
|
+
- The missing pieces around [es-toolkit](https://es-toolkit.dev): variadic-narrowing predicates, async composition, and consistent error normalization alongside its array, object, string, and math utilities.
|
|
17
|
+
- Tree-shakeable: focused subpath exports, ESM-only, `sideEffects: false`. Import only what you use.
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ npm install massaman
|
|
|
26
26
|
|
|
27
27
|
### From ts-pattern
|
|
28
28
|
|
|
29
|
-
The `
|
|
29
|
+
The `match` subpath re-exports [ts-pattern](https://github.com/gvergnaud/ts-pattern) and adds `P.ok` and `P.err` for Massaman results.
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import { match, P } from 'massaman/match'
|
package/dist/array/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { adjust, ascend, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last,
|
|
1
|
+
import { $ as union, A as isSubset, B as pullAt, C as forEachRight, D as intersection, E as initial, F as maxBy, G as shuffle, H as remove, I as minBy, J as take, K as sortBy, L as orderBy, M as keyBy, N as last, O as intersectionBy, P as mapAsync, Q as toFilled, R as partition, S as forEachAsync, St as adjust, T as head, U as sample, V as reduceAsync, W as sampleSize, X as takeRightWhile, Y as takeRight, Z as takeWhile, _ as flatMap, _t as descend, a as combinations, at as unzip, b as flatten, bt as reduceWhile, c as difference, ct as without, d as drop, dt as xorWith, et as unionBy, f as dropRight, ft as zip, g as filterAsync, gt as ascend, h as fill, ht as unfold, i as chunkBy, it as uniqWith, j as isSubsetWith, k as intersectionWith, l as differenceBy, lt as xor, m as dropWhile, mt as zipWith, n as cartesianProduct, nt as uniq, o as compact, ot as unzipWith, p as dropRightWhile, pt as zipObject, q as tail, r as chunk, rt as uniqBy, s as countBy, st as windowed, t as at, tt as unionWith, u as differenceWith, ut as xorBy, v as flatMapAsync, vt as sortWith, w as groupBy, x as flattenDeep, xt as dropRepeats, y as flatMapDeep, yt as scan, z as pull } from "../index-BPYJOreI.mjs";
|
|
2
|
+
export { adjust, ascend, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, reduceWhile, remove, sample, sampleSize, scan, shuffle, sortBy, sortWith, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, unfold, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/array/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { adjust, ascend, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last,
|
|
1
|
+
import { $ as union, A as isSubset, B as pullAt, C as forEachRight, D as intersection, E as initial, F as maxBy, G as shuffle, H as remove, I as minBy, J as take, K as sortBy, L as orderBy, M as keyBy, N as last, O as intersectionBy, P as mapAsync, Q as toFilled, R as partition, S as forEachAsync, St as adjust, T as head, U as sample, V as reduceAsync, W as sampleSize, X as takeRightWhile, Y as takeRight, Z as takeWhile, _ as flatMap, _t as descend, a as combinations, at as unzip, b as flatten, bt as reduceWhile, c as difference, ct as without, d as drop, dt as xorWith, et as unionBy, f as dropRight, ft as zip, g as filterAsync, gt as ascend, h as fill, ht as unfold, i as chunkBy, it as uniqWith, j as isSubsetWith, k as intersectionWith, l as differenceBy, lt as xor, m as dropWhile, mt as zipWith, n as cartesianProduct, nt as uniq, o as compact, ot as unzipWith, p as dropRightWhile, pt as zipObject, q as tail, r as chunk, rt as uniqBy, s as countBy, st as windowed, t as at, tt as unionWith, u as differenceWith, ut as xorBy, v as flatMapAsync, vt as sortWith, w as groupBy, x as flattenDeep, xt as dropRepeats, y as flatMapDeep, yt as scan, z as pull } from "../array-glQHknc3.mjs";
|
|
2
|
+
export { adjust, ascend, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, reduceWhile, remove, sample, sampleSize, scan, shuffle, sortBy, sortWith, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, unfold, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last,
|
|
1
|
+
import { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, remove, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith } from "es-toolkit/array";
|
|
2
2
|
//#region src/array/adjust.ts
|
|
3
3
|
/**
|
|
4
4
|
* Applies a function to the element at the given index, returning a new array.
|
|
@@ -186,6 +186,6 @@ function unfold(fn, seed) {
|
|
|
186
186
|
return result;
|
|
187
187
|
}
|
|
188
188
|
//#endregion
|
|
189
|
-
export {
|
|
189
|
+
export { union as $, isSubset as A, pullAt as B, forEachRight as C, intersection as D, initial as E, maxBy as F, shuffle as G, remove as H, minBy as I, take as J, sortBy as K, orderBy as L, keyBy as M, last as N, intersectionBy as O, mapAsync as P, toFilled as Q, partition as R, forEachAsync as S, adjust as St, head as T, sample as U, reduceAsync as V, sampleSize as W, takeRightWhile as X, takeRight as Y, takeWhile as Z, flatMap as _, descend as _t, combinations as a, unzip as at, flatten as b, reduceWhile as bt, difference as c, without as ct, drop as d, xorWith as dt, unionBy as et, dropRight as f, zip as ft, filterAsync as g, ascend as gt, fill as h, unfold as ht, chunkBy as i, uniqWith as it, isSubsetWith as j, intersectionWith as k, differenceBy as l, xor as lt, dropWhile as m, zipWith as mt, cartesianProduct as n, uniq as nt, compact as o, unzipWith as ot, dropRightWhile as p, zipObject as pt, tail as q, chunk as r, uniqBy as rt, countBy as s, windowed as st, at as t, unionWith as tt, differenceWith as u, xorBy as ut, flatMapAsync as v, sortWith as vt, groupBy as w, flattenDeep as x, dropRepeats as xt, flatMapDeep as y, scan as yt, pull as z };
|
|
190
190
|
|
|
191
|
-
//# sourceMappingURL=array-
|
|
191
|
+
//# sourceMappingURL=array-glQHknc3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-
|
|
1
|
+
{"version":3,"file":"array-glQHknc3.mjs","names":[],"sources":["../src/array/adjust.ts","../src/array/dropRepeats.ts","../src/array/reduceWhile.ts","../src/array/scan.ts","../src/array/sorting.ts","../src/array/unfold.ts"],"sourcesContent":["/**\n * Applies a function to the element at the given index, returning a new array.\n *\n * The original array is not modified. If the index is out of bounds, the\n * array is returned unchanged.\n *\n * @example\n * ```ts\n * adjust([1, 2, 3], 1, (n) => n * 10)\n * // [1, 20, 3]\n * ```\n */\nexport function adjust<T>(array: readonly T[], index: number, fn: (value: T) => T): T[] {\n const result = [...array]\n if (index >= 0 && index < array.length) {\n // oxlint-disable-next-line security/detect-object-injection -- Numeric array index parameter, not user-controlled key\n result[index] = fn(result[index])\n }\n return result\n}\n","/**\n * Removes consecutively repeated elements from an array using strict\n * equality (`===`).\n *\n * Only adjacent duplicates are removed — non-adjacent duplicates are kept.\n * Use {@link uniq} from es-toolkit to remove all duplicates regardless of position.\n *\n * Quirks (inherent to `===`):\n * - `NaN !== NaN`, so adjacent `NaN`s are *not* collapsed.\n * - `-0 === 0`, so adjacent `-0` and `0` *are* collapsed.\n * - Object/array elements compare by reference, not structure.\n *\n * @example\n * ```ts\n * dropRepeats([1, 1, 2, 3, 3, 2, 1])\n * // [1, 2, 3, 2, 1]\n * ```\n */\nexport function dropRepeats<T>(array: readonly T[]): T[] {\n return array.reduce<T[]>((acc, item, index) => {\n if (index === 0 || item !== array[index - 1]) {\n acc.push(item)\n }\n return acc\n }, [])\n}\n","/**\n * Like `reduce` but stops early when the predicate returns `false`.\n *\n * The predicate receives the current accumulator and element. When it\n * returns `false`, the current accumulator is returned without processing\n * the remaining elements.\n *\n * @example\n * ```ts\n * // Sum until we hit a negative number\n * reduceWhile(\n * [1, 2, 3, -1, 5],\n * (acc, n) => n >= 0,\n * (acc, n) => acc + n,\n * 0,\n * )\n * // 6\n * ```\n */\nexport function reduceWhile<T, R>(\n array: readonly T[],\n predicate: (accumulator: R, value: T) => boolean,\n fn: (accumulator: R, value: T, index: number) => R,\n initial: R\n): R {\n // oxlint-disable-next-line functional/no-let -- iterative impl avoids stack overflow on large arrays\n let acc = initial\n // oxlint-disable-next-line functional/no-let -- iterative impl avoids stack overflow on large arrays\n for (let index = 0; index < array.length; index += 1) {\n // oxlint-disable-next-line security/detect-object-injection -- Locally computed numeric array index\n const value = array[index]\n if (!predicate(acc, value)) {\n return acc\n }\n acc = fn(acc, value, index)\n }\n return acc\n}\n","/**\n * Like `reduce` but returns an array of all intermediate accumulator values.\n *\n * The result array starts with the initial value and ends with the final\n * accumulator, so its length is `array.length + 1`.\n *\n * @example\n * ```ts\n * scan([1, 2, 3, 4], (acc, n) => acc + n, 0)\n * // [0, 1, 3, 6, 10]\n * ```\n */\nexport function scan<T, R>(\n array: readonly T[],\n fn: (accumulator: R, value: T, index: number) => R,\n initial: R\n): R[] {\n return array.reduce<R[]>(\n (result, item, index) => {\n const prev = result[result.length - 1]\n result.push(fn(prev, item, index))\n return result\n },\n [initial]\n )\n}\n","/**\n * Creates an ascending comparator from an accessor function.\n *\n * @example\n * ```ts\n * users.sort(ascend(u => u.name))\n * ```\n */\nexport function ascend<T>(fn: (value: T) => number | string): (a: T, b: T) => number {\n return (a: T, b: T) => {\n const aa = fn(a)\n const bb = fn(b)\n if (aa < bb) {\n return -1\n }\n if (aa > bb) {\n return 1\n }\n return 0\n }\n}\n\n/**\n * Creates a descending comparator from an accessor function.\n *\n * @example\n * ```ts\n * users.sort(descend(u => u.age))\n * ```\n */\nexport function descend<T>(fn: (value: T) => number | string): (a: T, b: T) => number {\n return (a: T, b: T) => {\n const aa = fn(a)\n const bb = fn(b)\n if (aa > bb) {\n return -1\n }\n if (aa < bb) {\n return 1\n }\n return 0\n }\n}\n\n/**\n * Sorts an array using multiple comparators in priority order.\n *\n * The first comparator has highest priority. When it returns 0 (tie),\n * the next comparator is used, and so on.\n *\n * @example\n * ```ts\n * sortWith(users, [\n * ascend(u => u.department),\n * descend(u => u.age),\n * ])\n * ```\n */\nexport function sortWith<T>(\n array: readonly T[],\n comparators: ReadonlyArray<(a: T, b: T) => number>\n): T[] {\n return [...array].toSorted((a, b) => {\n for (const cmp of comparators) {\n const result = cmp(a, b)\n if (result !== 0) {\n return result\n }\n }\n return 0\n })\n}\n","/**\n * Builds an array from a seed value using an iterator function.\n *\n * The iterator receives the current seed and returns either a `[value, nextSeed]`\n * tuple to continue, or `false` to stop.\n *\n * Dual of `reduce` — reduce collapses a list into a value, unfold expands\n * a value into a list.\n *\n * **Termination is the caller's responsibility.** If `fn` never returns\n * `false`, `unfold` will run until memory is exhausted. For bounded\n * generation, encode a counter or limit into the seed.\n *\n * @example\n * ```ts\n * unfold((n) => (n > 0 ? [n, n - 1] : false), 5)\n * // [5, 4, 3, 2, 1]\n * ```\n */\nexport function unfold<T, R>(fn: (seed: T) => [R, T] | false, seed: T): R[] {\n const result: R[] = []\n // oxlint-disable-next-line functional/no-let -- iterative impl avoids stack overflow on large outputs\n let current = seed\n // oxlint-disable-next-line functional/no-let -- iterative impl avoids stack overflow on large outputs\n let pair = fn(current)\n while (pair !== false) {\n result.push(pair[0])\n current = pair[1]\n pair = fn(current)\n }\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,OAAU,OAAqB,OAAe,IAA0B;CACtF,MAAM,SAAS,CAAC,GAAG,KAAK;CACxB,IAAI,SAAS,KAAK,QAAQ,MAAM,QAE9B,OAAO,SAAS,GAAG,OAAO,MAAM;CAElC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;ACDA,SAAgB,YAAe,OAA0B;CACvD,OAAO,MAAM,QAAa,KAAK,MAAM,UAAU;EAC7C,IAAI,UAAU,KAAK,SAAS,MAAM,QAAQ,IACxC,IAAI,KAAK,IAAI;EAEf,OAAO;CACT,GAAG,CAAC,CAAC;AACP;;;;;;;;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AAO,GAAG,OAAO;CACrB,OAAO,SAAS,OAAO;EACrB,OAAO,KAAK,KAAK,EAAE;EACnB,UAAU,KAAK;EACf,OAAO,GAAG,OAAO;CACnB;CACA,OAAO;AACT"}
|
package/dist/control/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as Ok, r as Result, t as Err } from "../types-BsimcHZS.mjs";
|
|
2
|
-
import { a as todo, c as isOk, d as attempt, f as attemptAsync, i as unimplemented, l as ok, n as invariant, o as err, r as unreachable, s as isErr, t as assert, u as unwrap } from "../index-
|
|
2
|
+
import { a as todo, c as isOk, d as attempt, f as attemptAsync, i as unimplemented, l as ok, n as invariant, o as err, r as unreachable, s as isErr, t as assert, u as unwrap } from "../index-D5q3I26j.mjs";
|
|
3
3
|
export { type Err, type Ok, type Result, assert, attempt, attemptAsync, err, invariant, isErr, isOk, ok, todo, unimplemented, unreachable, unwrap };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as unless, C as retry, D as flowAsync, E as unary, M as call, N as callAsync, O as tap, S as rest, T as throttle, _ as negate, a as ThrottledFunction, b as partial, c as asyncNoop, d as curryRight, f as debounce, g as memoize, h as identity, i as ThrottleOptions, j as when, k as ifElse, l as before, m as flowRight, n as DebouncedFunction, o as after, p as flow, r as MemoizeCache, s as ary, t as DebounceOptions, u as curry, v as noop, w as spread, x as partialRight, y as once } from "../index-
|
|
1
|
+
import { A as unless, C as retry, D as flowAsync, E as unary, M as call, N as callAsync, O as tap, S as rest, T as throttle, _ as negate, a as ThrottledFunction, b as partial, c as asyncNoop, d as curryRight, f as debounce, g as memoize, h as identity, i as ThrottleOptions, j as when, k as ifElse, l as before, m as flowRight, n as DebouncedFunction, o as after, p as flow, r as MemoizeCache, s as ary, t as DebounceOptions, u as curry, v as noop, w as spread, x as partialRight, y as once } from "../index-DlZyDxI_.mjs";
|
|
2
2
|
export { type DebounceOptions, type DebouncedFunction, type MemoizeCache, type ThrottleOptions, type ThrottledFunction, after, ary, asyncNoop, before, call, callAsync, curry, curryRight, debounce, flow, flowAsync, flowRight, identity, ifElse, memoize, negate, noop, once, partial, partialRight, rest, retry, spread, tap, throttle, unary, unless, when };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last,
|
|
2
|
-
|
|
1
|
+
import { at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, filterAsync, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, forEachAsync, forEachRight, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, keyBy, last, mapAsync, maxBy, minBy, orderBy, partition, pull, pullAt, reduceAsync, remove, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith } from "es-toolkit/array";
|
|
3
2
|
//#region src/array/adjust.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Applies a function to the element at the given index, returning a new array.
|
|
@@ -130,5 +129,5 @@ declare function sortWith<T>(array: readonly T[], comparators: ReadonlyArray<(a:
|
|
|
130
129
|
*/
|
|
131
130
|
declare function unfold<T, R>(fn: (seed: T) => [R, T] | false, seed: T): R[];
|
|
132
131
|
//#endregion
|
|
133
|
-
export {
|
|
134
|
-
//# sourceMappingURL=index-
|
|
132
|
+
export { union as $, isSubset as A, pullAt as B, forEachRight as C, intersection as D, initial as E, maxBy as F, shuffle as G, remove as H, minBy as I, take as J, sortBy as K, orderBy as L, keyBy as M, last as N, intersectionBy as O, mapAsync as P, toFilled as Q, partition as R, forEachAsync as S, adjust as St, head as T, sample as U, reduceAsync as V, sampleSize as W, takeRightWhile as X, takeRight as Y, takeWhile as Z, flatMap as _, descend as _t, combinations as a, unzip as at, flatten as b, reduceWhile as bt, difference as c, without as ct, drop as d, xorWith as dt, unionBy as et, dropRight as f, zip as ft, filterAsync as g, ascend as gt, fill as h, unfold as ht, chunkBy as i, uniqWith as it, isSubsetWith as j, intersectionWith as k, differenceBy as l, xor as lt, dropWhile as m, zipWith as mt, cartesianProduct as n, uniq as nt, compact as o, unzipWith as ot, dropRightWhile as p, zipObject as pt, tail as q, chunk as r, uniqBy as rt, countBy as s, windowed as st, at as t, unionWith as tt, differenceWith as u, xorBy as ut, flatMapAsync as v, sortWith as vt, groupBy as w, flattenDeep as x, dropRepeats as xt, flatMapDeep as y, scan as yt, pull as z };
|
|
133
|
+
//# sourceMappingURL=index-BPYJOreI.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BPYJOreI.d.mts","names":[],"sources":["../src/array/adjust.ts","../src/array/dropRepeats.ts","../src/array/reduceWhile.ts","../src/array/scan.ts","../src/array/sorting.ts","../src/array/unfold.ts"],"mappings":";;;;;;;;;;;;;;iBAYgB,OAAO,GAAG,gBAAgB,KAAK,eAAe,KAAK,OAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;iBCMpE,YAAY,GAAG,gBAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;iBCCrC,YAAY,GAAG,GAC7B,gBAAgB,KAChB,YAAY,aAAa,GAAG,OAAO,eACnC,KAAK,aAAa,GAAG,OAAO,GAAG,kBAAkB,GACjD,SAAS,IACR;;;;;;;;;;;;;;;iBCZa,KAAK,GAAG,GACtB,gBAAgB,KAChB,KAAK,aAAa,GAAG,OAAO,GAAG,kBAAkB,GACjD,SAAS,IACR;;;;;;;;;;;iBCRa,OAAO,GAAG,KAAK,OAAO,yBAAyB,GAAG,GAAG,GAAG;;;;;;;;;iBAsBxD,QAAQ,GAAG,KAAK,OAAO,yBAAyB,GAAG,GAAG,GAAG;;;;;;;;;;;;;;;iBA4BzD,SAAS,GACvB,gBAAgB,KAChB,aAAa,eAAe,GAAG,GAAG,GAAG,gBACpC;;;;;;;;;;;;;;;;;;;;;;iBC1Ca,OAAO,GAAG,GAAG,KAAK,MAAM,OAAO,GAAG,YAAY,MAAM,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-C7dxY5U-.d.mts","names":[],"sources":["../src/conversion/convert.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index-C7dxY5U-.d.mts","names":[],"sources":["../src/conversion/convert.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAwBgB,QAAQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;iBA8B1B,UAAU;;;;;;;;;;;;;;iBAiFV,SAAS;;;;;;;;;;;;;iBAgBT,SAAS;;;;;;;;;;iBAaT,UAAU;;;;;;;;;;;;iBAeV,SAAS;;;;;;;;;;;;;;;;;iBAwBT,QAAQ,GAAG,OAAO,SAAS,KAAK,uBAAuB;;;;;;;;;;;;;;iBA0BvD,UAAU"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { n as Ok, r as Result, t as Err } from "./types-BsimcHZS.mjs";
|
|
2
2
|
import { assert, invariant } from "es-toolkit/util";
|
|
3
|
-
|
|
4
3
|
//#region src/control/attempt.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Executes a synchronous function and wraps the outcome in a `Result`.
|
|
@@ -183,4 +182,4 @@ declare function unimplemented(message?: string): never;
|
|
|
183
182
|
declare function unreachable(message?: string): never;
|
|
184
183
|
//#endregion
|
|
185
184
|
export { todo as a, isOk as c, attempt as d, attemptAsync as f, unimplemented as i, ok as l, invariant as n, err as o, unreachable as r, isErr as s, assert as t, unwrap as u };
|
|
186
|
-
//# sourceMappingURL=index-
|
|
185
|
+
//# sourceMappingURL=index-D5q3I26j.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D5q3I26j.d.mts","names":[],"sources":["../src/control/attempt.ts","../src/control/result.ts","../src/control/todo.ts","../src/control/unimplemented.ts","../src/control/unreachable.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBAkBgB,QAAQ,GAAG,UAAU,IAAI,OAAO;;;;;;;;;;;;;;;;iBAuB1B,aAAa,GAAG,UAAU,QAAQ,KAAK,QAAQ,OAAO;;;;;;;;;;;;;;;iBCJ5D,GAAG,GAAG,OAAO,IAAI,GAAG;;;;;;;;;;;;;iBAgBpB,IAAI,iBAAiB;;;;;;;;;;;;;;;iBAkBrB,KAAK,GAAG,QAAQ,OAAO,KAAK,UAAU,GAAG;;;;;;;;;;;;;;;iBAkBzC,MAAM,GAAG,QAAQ,OAAO,KAAK,UAAU;;;;;;;;;;;;;;;;;;;iBAsBvC,OAAO,GAAG,QAAQ,OAAO,IAAI,mBAAmB;;;;;;;;;;;;;;;;;;;;iBC5FhD,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;iBCML,cAAc;;;;;;;;;;;;;;;;;;;;;;;;iBCFd,YAAY"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmptyObject, isEqual, isEqualWith, isError as isError$1, isFile, isFunction, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap as isMap$1, isNil as isNil$1, isNode, isNotNil, isNull, isNumber, isPlainObject, isPrimitive as isPrimitive$1, isPromise, isRegExp, isSet as isSet$1, isString as isString$1, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet } from "es-toolkit/predicate";
|
|
2
|
-
|
|
3
2
|
//#region src/types/internal.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Explicit alias for `any` that makes dangerous intent visible at the call site.
|
|
@@ -183,4 +182,4 @@ declare function isInteger(value: unknown): value is number;
|
|
|
183
182
|
declare function isNaN(value: unknown): value is number;
|
|
184
183
|
//#endregion
|
|
185
184
|
export { isString$1 as A, isNaN as B, isNull as C, isPromise as D, isPrimitive$1 as E, isWeakSet as F, both as G, isObject as H, isArray as I, either as K, isEmpty as L, isTypedArray as M, isUndefined as N, isRegExp as O, isWeakMap as P, isFiniteNumber as R, isNotNil as S, isPlainObject as T, allPass as U, isNotEmpty as V, anyPass as W, isJSONValue as _, isBuffer as a, isNil$1 as b, isEqual as c, isFile as d, isFunction as f, isJSONObject as g, isJSONArray as h, isBrowser as i, isSymbol as j, isSet$1 as k, isEqualWith as l, isJSON as m, isBlob as n, isDate as o, isIterable as p, isBoolean as r, isEmptyObject as s, isArrayBuffer as t, isError$1 as u, isLength as v, isNumber as w, isNode as x, isMap$1 as y, isInteger as z };
|
|
186
|
-
//# sourceMappingURL=index-
|
|
185
|
+
//# sourceMappingURL=index-D7DGVrkN.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D7DGVrkN.d.mts","names":[],"sources":["../src/types/internal.ts","../src/predicate/combinators.ts","../src/predicate/guards.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkBY;;;;;;;;;;;;;;;;;;;;;iBCEI,QAAQ,GAAG,2BAA2B,OAAO;iBAC7C,QAAQ,WAAW,eAAe,OAAO,kCACvD,YAAY,MACV,OAAO,WAAW,QAAQ,SAAS,WAAW,MAAM,oBAAoB,QAAQ;;;;;;;;;;;;;;;;;;iBAwBpE,QAAQ,GAAG,2BAA2B,OAAO;iBAC7C,QAAQ,WAAW,eAAe,OAAO,kCACvD,YAAY,MACV,OAAO,WAAW,QAAQ,SAAS,WAAW,MAAM,QAAQ;;;;;;;;;;;;;iBAmBhD,KAAK,GAAG,UAAU,GAAG,UAAU,GAC7C,IAAI,OAAO,MAAM,SAAS,GAC1B,IAAI,OAAO,MAAM,SAAS,KACxB,OAAO,MAAM,SAAS,IAAI;iBACd,KAAK,GAAG,IAAI,OAAO,eAAe,IAAI,OAAO,iBAAiB,OAAO;;;;;;;;;;;;;iBAiBrE,OAAO,GAAG,UAAU,GAAG,UAAU,GAC/C,IAAI,OAAO,MAAM,SAAS,GAC1B,IAAI,OAAO,MAAM,SAAS,KACxB,OAAO,MAAM,SAAS,IAAI;iBACd,OAAO,GAAG,IAAI,OAAO,eAAe,IAAI,OAAO,iBAAiB,OAAO;;;;;KAYlF,QAAQ,KAAK,YAAY,OAAO,wBAAwB,eAAe,KAAK;;;;;KAM5E,WAAW,MAAM,WAAW,eAAe,aAAa,iBAAiB;KAEzE,oBAAoB,MAAM,qBAAqB,GAAG,8BACrD,SAAS,cAEP;;;;;;;;;;;;iBC5GY,QAAQ,iBAAiB;;;;;;;;;;;;;iBAgBzB,SAAS,iBAAiB;;;;;;;;;;;;;;;;;iBAoB1B,QAAQ;;;;;;;;;;iBAmBR,WAAW;;;;;;;;;;iBAaX,eAAe,iBAAiB;;;;;;;;;;iBAahC,UAAU,iBAAiB;;;;;;;;;;iBAa3B,MAAM,iBAAiB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { clone, cloneDeep, cloneDeepWith, deepFreeze, findKey, flattenObject, invert, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toConstantCaseKeys, toKebabCaseKeys, toMerged, toPascalCaseKeys, toSnakeCaseKeys } from "es-toolkit/object";
|
|
2
|
+
import { ToCamelCaseKeys, ToConstantCaseKeys, ToKebabCaseKeys, ToPascalCaseKeys, ToSnakeCaseKeys } from "es-toolkit/types";
|
|
3
|
+
//#region src/object/evolve.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Applies a spec of transformation functions to matching keys of an object,
|
|
6
|
+
* returning a new object. Keys not in the spec are copied as-is.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* evolve({ name: ' Alice ', age: 29, role: 'admin' }, {
|
|
11
|
+
* name: (s) => s.trim(),
|
|
12
|
+
* age: (n) => n + 1,
|
|
13
|
+
* })
|
|
14
|
+
* // { name: 'Alice', age: 30, role: 'admin' }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare function evolve<T extends Record<string, unknown>>(obj: T, spec: { [K in keyof T]?: (value: T[K]) => T[K]; }): T;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { evolve as A, sortKeys as C, toMerged as D, toKebabCaseKeys as E, toPascalCaseKeys as O, pickBy as S, toConstantCaseKeys as T, merge as _, ToSnakeCaseKeys as a, omitBy as b, cloneDeepWith as c, flattenObject as d, invert as f, mapValuesAsync as g, mapValues as h, ToPascalCaseKeys as i, toSnakeCaseKeys as k, deepFreeze as l, mapKeysAsync as m, ToConstantCaseKeys as n, clone as o, mapKeys as p, ToKebabCaseKeys as r, cloneDeep as s, ToCamelCaseKeys as t, findKey as u, mergeWith as v, toCamelCaseKeys as w, pick as x, omit as y };
|
|
20
|
+
//# sourceMappingURL=index-DTrYN2UY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DTrYN2UY.d.mts","names":[],"sources":["../src/object/evolve.ts"],"mappings":";;;;;;;;;;;;;;;;iBAagB,OAAO,UAAU,yBAC/B,KAAK,GACL,SAAS,WAAW,MAAM,OAAO,EAAE,OAAO,EAAE,QAC3C"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { n as Ok$1, t as Err$1 } from "./types-BsimcHZS.mjs";
|
|
2
|
-
import { NonExhaustiveError, P, Pattern, isMatching, match } from "ts-pattern";
|
|
3
|
-
|
|
2
|
+
import { NonExhaustiveError, P, Pattern, isMatching, match as match$1 } from "ts-pattern";
|
|
4
3
|
//#region src/match/match.d.ts
|
|
4
|
+
declare function okPattern(): {
|
|
5
|
+
ok: true;
|
|
6
|
+
};
|
|
7
|
+
declare function okPattern<const pattern extends P.Pattern<unknown>>(pattern: pattern): {
|
|
8
|
+
ok: true;
|
|
9
|
+
value: pattern;
|
|
10
|
+
};
|
|
11
|
+
declare function errPattern(): {
|
|
12
|
+
ok: false;
|
|
13
|
+
};
|
|
14
|
+
declare function errPattern<const pattern extends P.Pattern<unknown>>(pattern: pattern): {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: pattern;
|
|
17
|
+
};
|
|
5
18
|
/**
|
|
6
19
|
* Extended ts-pattern `P` namespace. Carries everything ts-pattern exports
|
|
7
|
-
* (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok` / `P.err`
|
|
8
|
-
* for matching `Result` values.
|
|
9
|
-
*
|
|
10
|
-
* Explicit literal-type annotations on the additions (rather than `as const`)
|
|
11
|
-
* keep the values non-`readonly`, which ts-pattern's narrowing requires —
|
|
12
|
-
* a `readonly` pattern collapses the remaining input to `never` after the
|
|
13
|
-
* first arm, breaking exhaustiveness.
|
|
20
|
+
* (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok()` / `P.err()`
|
|
21
|
+
* for matching `Result` values and their contents.
|
|
14
22
|
*
|
|
15
23
|
* For the `P.Pattern<T>` type shorthand, import `Pattern` standalone from
|
|
16
24
|
* `massaman/match` — it's the form ts-pattern's own docs recommend.
|
|
17
25
|
*/
|
|
18
26
|
declare const P$1: typeof P & {
|
|
19
|
-
ok:
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
err: {
|
|
23
|
-
ok: false;
|
|
24
|
-
};
|
|
27
|
+
ok: typeof okPattern;
|
|
28
|
+
err: typeof errPattern;
|
|
25
29
|
};
|
|
26
30
|
/**
|
|
27
31
|
* The `Ok` variant of a `Result<T>`. Re-exported here so the value-side
|
|
@@ -35,5 +39,5 @@ type Ok<T> = Ok$1<T>;
|
|
|
35
39
|
*/
|
|
36
40
|
type Err = Err$1;
|
|
37
41
|
//#endregion
|
|
38
|
-
export { Err as a, match as i, Pattern as n, Ok as o, isMatching as r, P$1 as s, NonExhaustiveError as t };
|
|
39
|
-
//# sourceMappingURL=index-
|
|
42
|
+
export { Err as a, match$1 as i, Pattern as n, Ok as o, isMatching as r, P$1 as s, NonExhaustiveError as t };
|
|
43
|
+
//# sourceMappingURL=index-DcVpX2Bb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DcVpX2Bb.d.mts","names":[],"sources":["../src/match/match.ts"],"mappings":";;;iBAuBS;EAAe;;iBACf,gBAAgB,gBAAgB,EAAI,kBAC3C,SAAS;EACN;EAAU,OAAO;;iBASb;EAAgB;;iBAChB,iBAAiB,gBAAgB,EAAI,kBAC5C,SAAS;EACN;EAAW,OAAO;;;;;;;;;;cAiBV,YAAU;EAAQ,WAAW;EAAW,YAAY;;;;;;;;KAYrD,GAAG,KAAK,KAAO;;;;KAKf,MAAM"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DebounceOptions, DebouncedFunction, MemoizeCache, ThrottleOptions, ThrottledFunction, after, ary, asyncNoop, before, curry, curryRight, debounce, flow, flowRight, identity, memoize, negate, noop, once, partial, partialRight, rest, retry, spread, throttle, unary } from "es-toolkit/function";
|
|
2
|
-
|
|
3
2
|
//#region src/function/call.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Invokes a function with the provided arguments and returns the result.
|
|
@@ -117,4 +116,4 @@ declare function flowAsync<A extends readonly unknown[], R1, R2, R3, R4, R5, R6>
|
|
|
117
116
|
declare function flowAsync<A extends readonly unknown[], R1, R2, R3, R4, R5, R6, R7>(f1: (...args: A) => MaybePromise<R1>, f2: (a: Awaited<R1>) => MaybePromise<R2>, f3: (a: Awaited<R2>) => MaybePromise<R3>, f4: (a: Awaited<R3>) => MaybePromise<R4>, f5: (a: Awaited<R4>) => MaybePromise<R5>, f6: (a: Awaited<R5>) => MaybePromise<R6>, f7: (a: Awaited<R6>) => MaybePromise<R7>): (...args: A) => Promise<Awaited<R7>>;
|
|
118
117
|
//#endregion
|
|
119
118
|
export { unless as A, retry as C, flowAsync as D, unary as E, call as M, callAsync as N, tap as O, rest as S, throttle as T, negate as _, ThrottledFunction as a, partial as b, asyncNoop as c, curryRight as d, debounce as f, memoize as g, identity as h, ThrottleOptions as i, when as j, ifElse as k, before as l, flowRight as m, DebouncedFunction as n, after as o, flow as p, MemoizeCache as r, ary as s, DebounceOptions as t, curry as u, noop as v, spread as w, partialRight as x, once as y };
|
|
120
|
-
//# sourceMappingURL=index-
|
|
119
|
+
//# sourceMappingURL=index-DlZyDxI_.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DlZyDxI_.d.mts","names":[],"sources":["../src/function/call.ts","../src/function/branching.ts","../src/function/tap.ts","../src/function/flowAsync.ts"],"mappings":";;;;;;;;;;;;;;;;iBAcgB,KAAK,8BAA8B,GAAG,QAAQ,MAAM,MAAM,MAAM,MAAM,IAAI;;;;;;;;;;;;;iBAgBpE,UAAU,8BAA8B,GAC5D,QAAQ,MAAM,MAAM,QAAQ,OACzB,MAAM,IACR,QAAQ;;;;;;;;;;;;;iBCvBK,KAAK,GAAG,YAAY,OAAO,eAAe,KAAK,OAAO,MAAM,KAAK,OAAO,MAAM;;;;;;;;;;;;;;iBAsB9E,OAAO,GAAG,YAAY,OAAO,eAAe,KAAK,OAAO,MAAM,KAAK,OAAO,MAAM;;;;;;;;;;;;;;;iBAuBhF,OAAO,GAAG,GACxB,YAAY,OAAO,eACnB,SAAS,OAAO,MAAM,GACtB,UAAU,OAAO,MAAM,KACrB,OAAO,MAAM;;;;;;;;;;;;;;;;;iBC7CD,IAAI,GAAG,KAAK,OAAO,iBAAiB,OAAO,MAAM;;;KCZ5D,aAAa,KAAK,IAAI,QAAQ;;;;;;;;;;;;;;;;;;iBAmBnB,UAAU,8BAA8B,IACtD,QAAQ,MAAM,MAAM,aAAa,UAC5B,MAAM,MAAM,QAAQ,QAAQ;iBACnB,UAAU,8BAA8B,IAAI,IAC1D,QAAQ,MAAM,MAAM,aAAa,KACjC,KAAK,GAAG,QAAQ,QAAQ,aAAa,UAChC,MAAM,MAAM,QAAQ,QAAQ;iBACnB,UAAU,8BAA8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ACrC,KAAK,GAAG,QAAQ,QAAQ,aAAa,UAChC,MAAM,MAAM,QAAQ,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as union, A as isSubset, B as pullAt, C as forEachRight, D as intersection, E as initial, F as maxBy, G as shuffle, H as remove, I as minBy, J as take, K as sortBy, L as orderBy, M as keyBy, N as last, O as intersectionBy, P as mapAsync, Q as toFilled, R as partition, S as forEachAsync, St as adjust, T as head, U as sample, V as reduceAsync, W as sampleSize, X as takeRightWhile, Y as takeRight, Z as takeWhile, _ as flatMap, _t as descend, a as combinations, at as unzip, b as flatten, bt as reduceWhile, c as difference, ct as without, d as drop, dt as xorWith, et as unionBy, f as dropRight, ft as zip, g as filterAsync, gt as ascend, h as fill, ht as unfold, i as chunkBy, it as uniqWith, j as isSubsetWith, k as intersectionWith, l as differenceBy, lt as xor, m as dropWhile, mt as zipWith, n as cartesianProduct, nt as uniq, o as compact, ot as unzipWith, p as dropRightWhile, pt as zipObject, q as tail, r as chunk, rt as uniqBy, s as countBy, st as windowed, t as at, tt as unionWith, u as differenceWith, ut as xorBy, v as flatMapAsync, vt as sortWith, w as groupBy, x as flattenDeep, xt as dropRepeats, y as flatMapDeep, yt as scan, z as pull } from "./index-BPYJOreI.mjs";
|
|
2
2
|
import { r as Result } from "./types-BsimcHZS.mjs";
|
|
3
|
-
import { a as todo, c as isOk, d as attempt, f as attemptAsync, i as unimplemented, l as ok, n as invariant, o as err, r as unreachable, s as isErr, t as assert, u as unwrap } from "./index-
|
|
3
|
+
import { a as todo, c as isOk, d as attempt, f as attemptAsync, i as unimplemented, l as ok, n as invariant, o as err, r as unreachable, s as isErr, t as assert, u as unwrap } from "./index-D5q3I26j.mjs";
|
|
4
4
|
import { a as toFinite, c as toString, i as toError, n as toArray, o as toInteger, r as toBoolean, s as toNumber, t as stringify } from "./index-C7dxY5U-.mjs";
|
|
5
5
|
import { AbortError, TimeoutError } from "./error/index.mjs";
|
|
6
|
-
import { A as unless, C as retry, D as flowAsync, E as unary, M as call, N as callAsync, O as tap, S as rest, T as throttle, _ as negate, a as ThrottledFunction, b as partial, c as asyncNoop, d as curryRight, f as debounce, g as memoize, h as identity, i as ThrottleOptions, j as when, k as ifElse, l as before, m as flowRight, n as DebouncedFunction, o as after, p as flow, r as MemoizeCache, s as ary, t as DebounceOptions, u as curry, v as noop, w as spread, x as partialRight, y as once } from "./index-
|
|
6
|
+
import { A as unless, C as retry, D as flowAsync, E as unary, M as call, N as callAsync, O as tap, S as rest, T as throttle, _ as negate, a as ThrottledFunction, b as partial, c as asyncNoop, d as curryRight, f as debounce, g as memoize, h as identity, i as ThrottleOptions, j as when, k as ifElse, l as before, m as flowRight, n as DebouncedFunction, o as after, p as flow, r as MemoizeCache, s as ary, t as DebounceOptions, u as curry, v as noop, w as spread, x as partialRight, y as once } from "./index-DlZyDxI_.mjs";
|
|
7
7
|
import { clamp, inRange, mean, meanBy, median, medianBy, percentile, random, randomInt, range, rangeRight, round, sum, sumBy } from "./math/index.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { A as isString, B as isNaN, C as isNull, D as isPromise, E as isPrimitive, F as isWeakSet, G as both, H as isObject, I as isArray, K as either, L as isEmpty, M as isTypedArray, N as isUndefined, O as isRegExp, P as isWeakMap, R as isFiniteNumber, S as isNotNil, T as isPlainObject, U as allPass, V as isNotEmpty, W as anyPass, _ as isJSONValue, a as isBuffer, b as isNil, c as isEqual, d as isFile, f as isFunction, g as isJSONObject, h as isJSONArray, i as isBrowser, j as isSymbol, k as isSet, l as isEqualWith, m as isJSON, n as isBlob, o as isDate, p as isIterable, r as isBoolean, s as isEmptyObject, t as isArrayBuffer, u as isError, v as isLength, w as isNumber, x as isNode, y as isMap, z as isInteger } from "./index-
|
|
10
|
-
import { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout } from "./promise/index.mjs";
|
|
11
|
-
import { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "./string/index.mjs";
|
|
12
|
-
import { a as Err, i as match, n as Pattern, o as Ok, r as isMatching, s as P, t as NonExhaustiveError } from "./index-
|
|
13
|
-
export { AbortError, type DebounceOptions, type DebouncedFunction, type Err, type MemoizeCache, Mutex, NonExhaustiveError, type Ok, P, Pattern, type Result, Semaphore, type ThrottleOptions, type ThrottledFunction, TimeoutError, adjust, after, allKeyed, allPass, anyPass, ary, ascend, assert, asyncNoop, at, attempt, attemptAsync, before, both, call, callAsync, camelCase, capitalize, cartesianProduct, chunk, chunkBy, clamp, clone, cloneDeep, cloneDeepWith, combinations, compact, constantCase, countBy, curry, curryRight, debounce, deburr, delay, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, either, err, escape, escapeRegExp, evolve, fill, filterAsync, findKey, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, flattenObject, flow, flowAsync, flowRight, forEachAsync, forEachRight, groupBy, head, identity, ifElse, inRange, initial, intersection, intersectionBy, intersectionWith, invariant, invert, isArray, isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmpty, isEmptyObject, isEqual, isEqualWith, isErr, isError, isFile, isFiniteNumber, isFunction, isInteger, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isMatching, isNaN, isNil, isNode, isNotEmpty, isNotNil, isNull, isNumber, isObject, isOk, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSubset, isSubsetWith, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, kebabCase, keyBy, last, limitAsync, lowerCase, lowerFirst, mapAsync, mapKeys, mapValues, match, maxBy, mean, meanBy, median, medianBy, memoize, merge, mergeWith, minBy, negate, noop, ok, omit, omitBy, once, orderBy, pad, partial, partialRight, partition, pascalCase, percentile, pick, pickBy, pull, pullAt, random, randomInt, range, rangeRight, reduceAsync, reduceWhile, remove, rest, retry, reverseString, round, sample, sampleSize, scan, shuffle, snakeCase, sortBy, sortKeys, sortWith, spread, startCase, stringify, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, tap, throttle, timeout, toArray, toBoolean, toCamelCaseKeys, toError, toFilled, toFinite, toInteger, toMerged, toNumber, toSnakeCaseKeys, toString, todo, trim, trimEnd, trimStart, unary, unescape, unfold, unimplemented, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unless, unreachable, unwrap, unzip, unzipWith, upperCase, upperFirst, when, windowed, withTimeout, without, words, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
8
|
+
import { A as evolve, C as sortKeys, D as toMerged, E as toKebabCaseKeys, O as toPascalCaseKeys, S as pickBy, T as toConstantCaseKeys, _ as merge, a as ToSnakeCaseKeys, b as omitBy, c as cloneDeepWith, d as flattenObject, f as invert, g as mapValuesAsync, h as mapValues, i as ToPascalCaseKeys, k as toSnakeCaseKeys, l as deepFreeze, m as mapKeysAsync, n as ToConstantCaseKeys, o as clone, p as mapKeys, r as ToKebabCaseKeys, s as cloneDeep, t as ToCamelCaseKeys, u as findKey, v as mergeWith, w as toCamelCaseKeys, x as pick, y as omit } from "./index-DTrYN2UY.mjs";
|
|
9
|
+
import { A as isString, B as isNaN, C as isNull, D as isPromise, E as isPrimitive, F as isWeakSet, G as both, H as isObject, I as isArray, K as either, L as isEmpty, M as isTypedArray, N as isUndefined, O as isRegExp, P as isWeakMap, R as isFiniteNumber, S as isNotNil, T as isPlainObject, U as allPass, V as isNotEmpty, W as anyPass, _ as isJSONValue, a as isBuffer, b as isNil, c as isEqual, d as isFile, f as isFunction, g as isJSONObject, h as isJSONArray, i as isBrowser, j as isSymbol, k as isSet, l as isEqualWith, m as isJSON, n as isBlob, o as isDate, p as isIterable, r as isBoolean, s as isEmptyObject, t as isArrayBuffer, u as isError, v as isLength, w as isNumber, x as isNode, y as isMap, z as isInteger } from "./index-D7DGVrkN.mjs";
|
|
10
|
+
import { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout } from "./promise/index.mjs";
|
|
11
|
+
import { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "./string/index.mjs";
|
|
12
|
+
import { a as Err, i as match, n as Pattern, o as Ok, r as isMatching, s as P, t as NonExhaustiveError } from "./index-DcVpX2Bb.mjs";
|
|
13
|
+
export { AbortError, type DebounceOptions, type DebouncedFunction, type Err, type MemoizeCache, Mutex, NonExhaustiveError, type Ok, P, Pattern, type Result, Semaphore, type ThrottleOptions, type ThrottledFunction, TimeoutError, type ToCamelCaseKeys, type ToConstantCaseKeys, type ToKebabCaseKeys, type ToPascalCaseKeys, type ToSnakeCaseKeys, adjust, after, allKeyed, allPass, anyPass, ary, ascend, assert, asyncNoop, at, attempt, attemptAsync, before, both, call, callAsync, camelCase, capitalize, cartesianProduct, chunk, chunkBy, clamp, clone, cloneDeep, cloneDeepWith, combinations, compact, constantCase, countBy, curry, curryRight, debounce, deburr, dedent, deepFreeze, delay, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, either, err, escape, escapeRegExp, evolve, fill, filterAsync, findKey, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, flattenObject, flow, flowAsync, flowRight, forEachAsync, forEachRight, groupBy, head, identity, ifElse, inRange, initial, intersection, intersectionBy, intersectionWith, invariant, invert, isArray, isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmpty, isEmptyObject, isEqual, isEqualWith, isErr, isError, isFile, isFiniteNumber, isFunction, isInteger, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isMatching, isNaN, isNil, isNode, isNotEmpty, isNotNil, isNull, isNumber, isObject, isOk, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSubset, isSubsetWith, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, kebabCase, keyBy, last, limitAsync, lowerCase, lowerFirst, mapAsync, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, match, maxBy, mean, meanBy, median, medianBy, memoize, merge, mergeWith, minBy, negate, noop, ok, omit, omitBy, once, orderBy, pad, partial, partialRight, partition, pascalCase, percentile, pick, pickBy, pull, pullAt, random, randomInt, range, rangeRight, reduceAsync, reduceWhile, remove, rest, retry, reverseString, round, sample, sampleSize, scan, shuffle, snakeCase, sortBy, sortKeys, sortWith, spread, startCase, stringify, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, tap, throttle, timeout, toArray, toBoolean, toCamelCaseKeys, toConstantCaseKeys, toError, toFilled, toFinite, toInteger, toKebabCaseKeys, toMerged, toNumber, toPascalCaseKeys, toSnakeCaseKeys, toString, todo, trim, trimEnd, trimStart, unary, unescape, unfold, unimplemented, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unless, unreachable, unwrap, unzip, unzipWith, upperCase, upperFirst, when, windowed, withTimeout, without, words, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as union, A as isSubset, B as pullAt, C as forEachRight, D as intersection, E as initial, F as maxBy, G as shuffle, H as remove, I as minBy, J as take, K as sortBy, L as orderBy, M as keyBy, N as last, O as intersectionBy, P as mapAsync, Q as toFilled, R as partition, S as forEachAsync, St as adjust, T as head, U as sample, V as reduceAsync, W as sampleSize, X as takeRightWhile, Y as takeRight, Z as takeWhile, _ as flatMap, _t as descend, a as combinations, at as unzip, b as flatten, bt as reduceWhile, c as difference, ct as without, d as drop, dt as xorWith, et as unionBy, f as dropRight, ft as zip, g as filterAsync, gt as ascend, h as fill, ht as unfold, i as chunkBy, it as uniqWith, j as isSubsetWith, k as intersectionWith, l as differenceBy, lt as xor, m as dropWhile, mt as zipWith, n as cartesianProduct, nt as uniq, o as compact, ot as unzipWith, p as dropRightWhile, pt as zipObject, q as tail, r as chunk, rt as uniqBy, s as countBy, st as windowed, t as at, tt as unionWith, u as differenceWith, ut as xorBy, v as flatMapAsync, vt as sortWith, w as groupBy, x as flattenDeep, xt as dropRepeats, y as flatMapDeep, yt as scan, z as pull } from "./array-glQHknc3.mjs";
|
|
2
2
|
import { AbortError, TimeoutError } from "./error/index.mjs";
|
|
3
3
|
import { C as tap, D as call, E as when, O as callAsync, S as flowAsync, T as unless, _ as rest, a as curry, b as throttle, c as flow, d as memoize, f as negate, g as partialRight, h as partial, i as before, l as flowRight, m as once, n as ary, o as curryRight, p as noop, r as asyncNoop, s as debounce, t as after, u as identity, v as retry, w as ifElse, x as unary, y as spread } from "./function-Brosl7-Y.mjs";
|
|
4
4
|
import { clamp, inRange, mean, meanBy, median, medianBy, percentile, random, randomInt, range, rangeRight, round, sum, sumBy } from "./math/index.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { C as toPascalCaseKeys, S as toMerged, T as evolve, _ as pickBy, a as findKey, b as toConstantCaseKeys, c as mapKeys, d as mapValuesAsync, f as merge, g as pick, h as omitBy, i as deepFreeze, l as mapKeysAsync, m as omit, n as cloneDeep, o as flattenObject, p as mergeWith, r as cloneDeepWith, s as invert, t as clone, u as mapValues, v as sortKeys, w as toSnakeCaseKeys, x as toKebabCaseKeys, y as toCamelCaseKeys } from "./object-CILtZbTT.mjs";
|
|
6
6
|
import { A as isString, B as isNaN, C as isNull, D as isPromise, E as isPrimitive, F as isWeakSet, G as both, H as isObject, I as isArray, K as either, L as isEmpty, M as isTypedArray, N as isUndefined, O as isRegExp, P as isWeakMap, R as isFiniteNumber, S as isNotNil, T as isPlainObject, U as allPass, V as isNotEmpty, W as anyPass, _ as isJSONValue, a as isBuffer, b as isNil, c as isEqual, d as isFile, f as isFunction, g as isJSONObject, h as isJSONArray, i as isBrowser, j as isSymbol, k as isSet, l as isEqualWith, m as isJSON, n as isBlob, o as isDate, p as isIterable, r as isBoolean, s as isEmptyObject, t as isArrayBuffer, u as isError, v as isLength, w as isNumber, x as isNode, y as isMap, z as isInteger } from "./predicate-CleUejOb.mjs";
|
|
7
7
|
import { a as toFinite, c as toString, i as toError, n as toArray, o as toInteger, r as toBoolean, s as toNumber, t as stringify } from "./conversion-BB912-15.mjs";
|
|
8
|
-
import { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout } from "./promise/index.mjs";
|
|
9
|
-
import { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "./string/index.mjs";
|
|
8
|
+
import { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout } from "./promise/index.mjs";
|
|
9
|
+
import { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "./string/index.mjs";
|
|
10
10
|
import { a as todo, c as err, d as ok, f as unwrap, i as unimplemented, l as isErr, n as invariant, o as attempt, r as unreachable, s as attemptAsync, t as assert, u as isOk } from "./control-DCdm8IH6.mjs";
|
|
11
|
-
import { a as P, i as match, n as Pattern, r as isMatching, t as NonExhaustiveError } from "./match-
|
|
12
|
-
export { AbortError, Mutex, NonExhaustiveError, P, Pattern, Semaphore, TimeoutError, adjust, after, allKeyed, allPass, anyPass, ary, ascend, assert, asyncNoop, at, attempt, attemptAsync, before, both, call, callAsync, camelCase, capitalize, cartesianProduct, chunk, chunkBy, clamp, clone, cloneDeep, cloneDeepWith, combinations, compact, constantCase, countBy, curry, curryRight, debounce, deburr, delay, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, either, err, escape, escapeRegExp, evolve, fill, filterAsync, findKey, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, flattenObject, flow, flowAsync, flowRight, forEachAsync, forEachRight, groupBy, head, identity, ifElse, inRange, initial, intersection, intersectionBy, intersectionWith, invariant, invert, isArray, isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmpty, isEmptyObject, isEqual, isEqualWith, isErr, isError, isFile, isFiniteNumber, isFunction, isInteger, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isMatching, isNaN, isNil, isNode, isNotEmpty, isNotNil, isNull, isNumber, isObject, isOk, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSubset, isSubsetWith, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, kebabCase, keyBy, last, limitAsync, lowerCase, lowerFirst, mapAsync, mapKeys, mapValues, match, maxBy, mean, meanBy, median, medianBy, memoize, merge, mergeWith, minBy, negate, noop, ok, omit, omitBy, once, orderBy, pad, partial, partialRight, partition, pascalCase, percentile, pick, pickBy, pull, pullAt, random, randomInt, range, rangeRight, reduceAsync, reduceWhile, remove, rest, retry, reverseString, round, sample, sampleSize, scan, shuffle, snakeCase, sortBy, sortKeys, sortWith, spread, startCase, stringify, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, tap, throttle, timeout, toArray, toBoolean, toCamelCaseKeys, toError, toFilled, toFinite, toInteger, toMerged, toNumber, toSnakeCaseKeys, toString, todo, trim, trimEnd, trimStart, unary, unescape, unfold, unimplemented, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unless, unreachable, unwrap, unzip, unzipWith, upperCase, upperFirst, when, windowed, withTimeout, without, words, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
11
|
+
import { a as P, i as match, n as Pattern, r as isMatching, t as NonExhaustiveError } from "./match-fBetfaIa.mjs";
|
|
12
|
+
export { AbortError, Mutex, NonExhaustiveError, P, Pattern, Semaphore, TimeoutError, adjust, after, allKeyed, allPass, anyPass, ary, ascend, assert, asyncNoop, at, attempt, attemptAsync, before, both, call, callAsync, camelCase, capitalize, cartesianProduct, chunk, chunkBy, clamp, clone, cloneDeep, cloneDeepWith, combinations, compact, constantCase, countBy, curry, curryRight, debounce, deburr, dedent, deepFreeze, delay, descend, difference, differenceBy, differenceWith, drop, dropRepeats, dropRight, dropRightWhile, dropWhile, either, err, escape, escapeRegExp, evolve, fill, filterAsync, findKey, flatMap, flatMapAsync, flatMapDeep, flatten, flattenDeep, flattenObject, flow, flowAsync, flowRight, forEachAsync, forEachRight, groupBy, head, identity, ifElse, inRange, initial, intersection, intersectionBy, intersectionWith, invariant, invert, isArray, isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmpty, isEmptyObject, isEqual, isEqualWith, isErr, isError, isFile, isFiniteNumber, isFunction, isInteger, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isMatching, isNaN, isNil, isNode, isNotEmpty, isNotNil, isNull, isNumber, isObject, isOk, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSubset, isSubsetWith, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, kebabCase, keyBy, last, limitAsync, lowerCase, lowerFirst, mapAsync, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, match, maxBy, mean, meanBy, median, medianBy, memoize, merge, mergeWith, minBy, negate, noop, ok, omit, omitBy, once, orderBy, pad, partial, partialRight, partition, pascalCase, percentile, pick, pickBy, pull, pullAt, random, randomInt, range, rangeRight, reduceAsync, reduceWhile, remove, rest, retry, reverseString, round, sample, sampleSize, scan, shuffle, snakeCase, sortBy, sortKeys, sortWith, spread, startCase, stringify, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, tap, throttle, timeout, toArray, toBoolean, toCamelCaseKeys, toConstantCaseKeys, toError, toFilled, toFinite, toInteger, toKebabCaseKeys, toMerged, toNumber, toPascalCaseKeys, toSnakeCaseKeys, toString, todo, trim, trimEnd, trimStart, unary, unescape, unfold, unimplemented, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unless, unreachable, unwrap, unzip, unzipWith, upperCase, upperFirst, when, windowed, withTimeout, without, words, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/match/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Err, i as match, n as Pattern, o as Ok, r as isMatching, s as P, t as NonExhaustiveError } from "../index-
|
|
1
|
+
import { a as Err, i as match, n as Pattern, o as Ok, r as isMatching, s as P, t as NonExhaustiveError } from "../index-DcVpX2Bb.mjs";
|
|
2
2
|
export { type Err, NonExhaustiveError, type Ok, P, Pattern, isMatching, match };
|
package/dist/match/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as P, i as match, n as Pattern, r as isMatching, t as NonExhaustiveError } from "../match-
|
|
1
|
+
import { a as P, i as match, n as Pattern, r as isMatching, t as NonExhaustiveError } from "../match-fBetfaIa.mjs";
|
|
2
2
|
export { NonExhaustiveError, P, Pattern, isMatching, match };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { NonExhaustiveError, P, Pattern, isMatching, match, match as match$1 } from "ts-pattern";
|
|
2
|
+
//#region src/match/match.ts
|
|
3
|
+
/**
|
|
4
|
+
* Extends ts-pattern's `P` namespace with `P.ok()` and `P.err()` — pattern
|
|
5
|
+
* factories for matching a `Result` and its contained value or error.
|
|
6
|
+
*
|
|
7
|
+
* Mirrors Rust's `Ok(value)` / `Err(error)` match arms, but uses the
|
|
8
|
+
* namespace-method form (`P.ok()` / `P.err()`) so it doesn't collide with
|
|
9
|
+
* the lowercase `ok()` / `err()` constructors from `massaman/control`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { match, P, attempt } from 'massaman'
|
|
14
|
+
*
|
|
15
|
+
* match(attempt(() => JSON.parse(raw)))
|
|
16
|
+
* .with(P.ok(), ({ value }) => use(value))
|
|
17
|
+
* .with(P.err(), ({ error }) => log(error))
|
|
18
|
+
* .exhaustive()
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function okPattern(...patterns) {
|
|
22
|
+
return match(patterns).with([], () => ({ ok: true })).otherwise(([pattern]) => ({
|
|
23
|
+
ok: true,
|
|
24
|
+
value: pattern
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
function errPattern(...patterns) {
|
|
28
|
+
return match(patterns).with([], () => ({ ok: false })).otherwise(([pattern]) => ({
|
|
29
|
+
ok: false,
|
|
30
|
+
error: pattern
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extended ts-pattern `P` namespace. Carries everything ts-pattern exports
|
|
35
|
+
* (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok()` / `P.err()`
|
|
36
|
+
* for matching `Result` values and their contents.
|
|
37
|
+
*
|
|
38
|
+
* For the `P.Pattern<T>` type shorthand, import `Pattern` standalone from
|
|
39
|
+
* `massaman/match` — it's the form ts-pattern's own docs recommend.
|
|
40
|
+
*/
|
|
41
|
+
const P$1 = {
|
|
42
|
+
...P,
|
|
43
|
+
ok: okPattern,
|
|
44
|
+
err: errPattern
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { P$1 as a, match$1 as i, Pattern as n, isMatching as r, NonExhaustiveError as t };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=match-fBetfaIa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-fBetfaIa.mjs","names":["matchValue","P","TsP"],"sources":["../src/match/match.ts"],"sourcesContent":["/**\n * Extends ts-pattern's `P` namespace with `P.ok()` and `P.err()` — pattern\n * factories for matching a `Result` and its contained value or error.\n *\n * Mirrors Rust's `Ok(value)` / `Err(error)` match arms, but uses the\n * namespace-method form (`P.ok()` / `P.err()`) so it doesn't collide with\n * the lowercase `ok()` / `err()` constructors from `massaman/control`.\n *\n * @example\n * ```ts\n * import { match, P, attempt } from 'massaman'\n *\n * match(attempt(() => JSON.parse(raw)))\n * .with(P.ok(), ({ value }) => use(value))\n * .with(P.err(), ({ error }) => log(error))\n * .exhaustive()\n * ```\n */\n\nimport { match as matchValue, P as TsP } from 'ts-pattern'\n\nimport type { Err as ErrType, Ok as OkType } from '../control/types.js'\n\nfunction okPattern(): { ok: true }\nfunction okPattern<const pattern extends TsP.Pattern<unknown>>(\n pattern: pattern\n): { ok: true; value: pattern }\nfunction okPattern(\n ...patterns: readonly [] | readonly [TsP.Pattern<unknown>]\n): { ok: true } | { ok: true; value: TsP.Pattern<unknown> } {\n return matchValue(patterns)\n .with([], () => ({ ok: true as const }))\n .otherwise(([pattern]) => ({ ok: true as const, value: pattern }))\n}\n\nfunction errPattern(): { ok: false }\nfunction errPattern<const pattern extends TsP.Pattern<unknown>>(\n pattern: pattern\n): { ok: false; error: pattern }\nfunction errPattern(\n ...patterns: readonly [] | readonly [TsP.Pattern<unknown>]\n): { ok: false } | { ok: false; error: TsP.Pattern<unknown> } {\n return matchValue(patterns)\n .with([], () => ({ ok: false as const }))\n .otherwise(([pattern]) => ({ ok: false as const, error: pattern }))\n}\n\n/**\n * Extended ts-pattern `P` namespace. Carries everything ts-pattern exports\n * (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok()` / `P.err()`\n * for matching `Result` values and their contents.\n *\n * For the `P.Pattern<T>` type shorthand, import `Pattern` standalone from\n * `massaman/match` — it's the form ts-pattern's own docs recommend.\n */\nexport const P: typeof TsP & { ok: typeof okPattern; err: typeof errPattern } = {\n ...TsP,\n ok: okPattern,\n err: errPattern,\n}\n\n/**\n * The `Ok` variant of a `Result<T>`. Re-exported here so the value-side\n * patterns and the type-side `Ok<T>` live in one module — any consumer\n * import gets both type and value namespaces without cross-module merge\n * issues (TS2300).\n */\nexport type Ok<T> = OkType<T>\n\n/**\n * The `Err` variant of a `Result<T>`. See {@link Ok} for the co-location note.\n */\nexport type Err = ErrType\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,UACP,GAAG,UACuD;CAC1D,OAAOA,MAAW,QAAQ,CAAC,CACxB,KAAK,CAAC,UAAU,EAAE,IAAI,KAAc,EAAE,CAAC,CACvC,WAAW,CAAC,cAAc;EAAE,IAAI;EAAe,OAAO;CAAQ,EAAE;AACrE;AAMA,SAAS,WACP,GAAG,UACyD;CAC5D,OAAOA,MAAW,QAAQ,CAAC,CACxB,KAAK,CAAC,UAAU,EAAE,IAAI,MAAe,EAAE,CAAC,CACxC,WAAW,CAAC,cAAc;EAAE,IAAI;EAAgB,OAAO;CAAQ,EAAE;AACtE;;;;;;;;;AAUA,MAAaC,MAAmE;CAC9E,GAAGC;CACH,IAAI;CACJ,KAAK;AACP"}
|
package/dist/object/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { clone, cloneDeep, cloneDeepWith, evolve, findKey, flattenObject, invert, mapKeys, mapValues, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toMerged, toSnakeCaseKeys };
|
|
1
|
+
import { A as evolve, C as sortKeys, D as toMerged, E as toKebabCaseKeys, O as toPascalCaseKeys, S as pickBy, T as toConstantCaseKeys, _ as merge, a as ToSnakeCaseKeys, b as omitBy, c as cloneDeepWith, d as flattenObject, f as invert, g as mapValuesAsync, h as mapValues, i as ToPascalCaseKeys, k as toSnakeCaseKeys, l as deepFreeze, m as mapKeysAsync, n as ToConstantCaseKeys, o as clone, p as mapKeys, r as ToKebabCaseKeys, s as cloneDeep, t as ToCamelCaseKeys, u as findKey, v as mergeWith, w as toCamelCaseKeys, x as pick, y as omit } from "../index-DTrYN2UY.mjs";
|
|
2
|
+
export { type ToCamelCaseKeys, type ToConstantCaseKeys, type ToKebabCaseKeys, type ToPascalCaseKeys, type ToSnakeCaseKeys, clone, cloneDeep, cloneDeepWith, deepFreeze, evolve, findKey, flattenObject, invert, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toConstantCaseKeys, toKebabCaseKeys, toMerged, toPascalCaseKeys, toSnakeCaseKeys };
|
package/dist/object/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { clone, cloneDeep, cloneDeepWith, evolve, findKey, flattenObject, invert, mapKeys, mapValues, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toMerged, toSnakeCaseKeys };
|
|
1
|
+
import { C as toPascalCaseKeys, S as toMerged, T as evolve, _ as pickBy, a as findKey, b as toConstantCaseKeys, c as mapKeys, d as mapValuesAsync, f as merge, g as pick, h as omitBy, i as deepFreeze, l as mapKeysAsync, m as omit, n as cloneDeep, o as flattenObject, p as mergeWith, r as cloneDeepWith, s as invert, t as clone, u as mapValues, v as sortKeys, w as toSnakeCaseKeys, x as toKebabCaseKeys, y as toCamelCaseKeys } from "../object-CILtZbTT.mjs";
|
|
2
|
+
export { clone, cloneDeep, cloneDeepWith, deepFreeze, evolve, findKey, flattenObject, invert, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toConstantCaseKeys, toKebabCaseKeys, toMerged, toPascalCaseKeys, toSnakeCaseKeys };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { clone, cloneDeep, cloneDeepWith, deepFreeze, findKey, flattenObject, invert, mapKeys, mapKeysAsync, mapValues, mapValuesAsync, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toConstantCaseKeys, toKebabCaseKeys, toMerged, toPascalCaseKeys, toSnakeCaseKeys } from "es-toolkit/object";
|
|
2
|
+
//#region src/object/evolve.ts
|
|
3
|
+
/**
|
|
4
|
+
* Applies a spec of transformation functions to matching keys of an object,
|
|
5
|
+
* returning a new object. Keys not in the spec are copied as-is.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* evolve({ name: ' Alice ', age: 29, role: 'admin' }, {
|
|
10
|
+
* name: (s) => s.trim(),
|
|
11
|
+
* age: (n) => n + 1,
|
|
12
|
+
* })
|
|
13
|
+
* // { name: 'Alice', age: 30, role: 'admin' }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function evolve(obj, spec) {
|
|
17
|
+
const result = { ...obj };
|
|
18
|
+
for (const key of Object.keys(spec)) {
|
|
19
|
+
const transform = spec[key];
|
|
20
|
+
if (transform != null && key in result) result[key] = transform(result[key]);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { toPascalCaseKeys as C, toMerged as S, evolve as T, pickBy as _, findKey as a, toConstantCaseKeys as b, mapKeys as c, mapValuesAsync as d, merge as f, pick as g, omitBy as h, deepFreeze as i, mapKeysAsync as l, omit as m, cloneDeep as n, flattenObject as o, mergeWith as p, cloneDeepWith as r, invert as s, clone as t, mapValues as u, sortKeys as v, toSnakeCaseKeys as w, toKebabCaseKeys as x, toCamelCaseKeys as y };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=object-CILtZbTT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-
|
|
1
|
+
{"version":3,"file":"object-CILtZbTT.mjs","names":[],"sources":["../src/object/evolve.ts"],"sourcesContent":["/**\n * Applies a spec of transformation functions to matching keys of an object,\n * returning a new object. Keys not in the spec are copied as-is.\n *\n * @example\n * ```ts\n * evolve({ name: ' Alice ', age: 29, role: 'admin' }, {\n * name: (s) => s.trim(),\n * age: (n) => n + 1,\n * })\n * // { name: 'Alice', age: 30, role: 'admin' }\n * ```\n */\nexport function evolve<T extends Record<string, unknown>>(\n obj: T,\n spec: { [K in keyof T]?: (value: T[K]) => T[K] }\n): T {\n const result = { ...obj }\n for (const key of Object.keys(spec) as Array<keyof T>) {\n // oxlint-disable-next-line security/detect-object-injection -- key sourced from Object.keys(spec), not user input\n const transform = spec[key]\n if (transform != null && key in result) {\n // oxlint-disable-next-line security/detect-object-injection -- key sourced from Object.keys(spec), not user input\n result[key] = transform(result[key])\n }\n }\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAgB,OACd,KACA,MACG;CACH,MAAM,SAAS,EAAE,GAAG,IAAI;CACxB,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAqB;EAErD,MAAM,YAAY,KAAK;EACvB,IAAI,aAAa,QAAQ,OAAO,QAE9B,OAAO,OAAO,UAAU,OAAO,IAAI;CAEvC;CACA,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as isString, B as isNaN, C as isNull, D as isPromise, E as isPrimitive, F as isWeakSet, G as both, H as isObject, I as isArray, K as either, L as isEmpty, M as isTypedArray, N as isUndefined, O as isRegExp, P as isWeakMap, R as isFiniteNumber, S as isNotNil, T as isPlainObject, U as allPass, V as isNotEmpty, W as anyPass, _ as isJSONValue, a as isBuffer, b as isNil, c as isEqual, d as isFile, f as isFunction, g as isJSONObject, h as isJSONArray, i as isBrowser, j as isSymbol, k as isSet, l as isEqualWith, m as isJSON, n as isBlob, o as isDate, p as isIterable, r as isBoolean, s as isEmptyObject, t as isArrayBuffer, u as isError, v as isLength, w as isNumber, x as isNode, y as isMap, z as isInteger } from "../index-
|
|
1
|
+
import { A as isString, B as isNaN, C as isNull, D as isPromise, E as isPrimitive, F as isWeakSet, G as both, H as isObject, I as isArray, K as either, L as isEmpty, M as isTypedArray, N as isUndefined, O as isRegExp, P as isWeakMap, R as isFiniteNumber, S as isNotNil, T as isPlainObject, U as allPass, V as isNotEmpty, W as anyPass, _ as isJSONValue, a as isBuffer, b as isNil, c as isEqual, d as isFile, f as isFunction, g as isJSONObject, h as isJSONArray, i as isBrowser, j as isSymbol, k as isSet, l as isEqualWith, m as isJSON, n as isBlob, o as isDate, p as isIterable, r as isBoolean, s as isEmptyObject, t as isArrayBuffer, u as isError, v as isLength, w as isNumber, x as isNode, y as isMap, z as isInteger } from "../index-D7DGVrkN.mjs";
|
|
2
2
|
export { allPass, anyPass, both, either, isArray, isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEmpty, isEmptyObject, isEqual, isEqualWith, isError, isFile, isFiniteNumber, isFunction, isInteger, isIterable, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isNaN, isNil, isNode, isNotEmpty, isNotNil, isNull, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet };
|
package/dist/promise/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout } from "es-toolkit/promise";
|
|
2
|
-
export { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout };
|
|
1
|
+
import { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout } from "es-toolkit/promise";
|
|
2
|
+
export { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout };
|
package/dist/promise/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout } from "es-toolkit/promise";
|
|
2
|
-
export { Mutex, Semaphore, allKeyed, delay, timeout, withTimeout };
|
|
1
|
+
import { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout } from "es-toolkit/promise";
|
|
2
|
+
export { Mutex, Semaphore, allKeyed, delay, limitAsync, timeout, withTimeout };
|
package/dist/string/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "es-toolkit/string";
|
|
2
|
-
export { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words };
|
|
1
|
+
import { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "es-toolkit/string";
|
|
2
|
+
export { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words };
|
package/dist/string/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "es-toolkit/string";
|
|
2
|
-
export { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words };
|
|
1
|
+
import { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from "es-toolkit/string";
|
|
2
|
+
export { camelCase, capitalize, constantCase, deburr, dedent, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-BsimcHZS.d.mts","names":[],"sources":["../src/control/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types-BsimcHZS.d.mts","names":[],"sources":["../src/control/types.ts"],"mappings":";;;;;;;;;UAQiB,GAAG;WACT;WACA,OAAO;WACP;;;;;;;;;;UAWM;WACN;WACA;WACA,OAAO;;;;;;;;;;;;;KAcN,OAAO,KAAK,GAAG,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "massaman",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A comprehensive functional programming library and utilities for TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"es-toolkit",
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
"types": "./dist/array/index.d.mts",
|
|
44
44
|
"import": "./dist/array/index.mjs"
|
|
45
45
|
},
|
|
46
|
+
"./bigint": {
|
|
47
|
+
"types": "./dist/bigint/index.d.mts",
|
|
48
|
+
"import": "./dist/bigint/index.mjs"
|
|
49
|
+
},
|
|
46
50
|
"./object": {
|
|
47
51
|
"types": "./dist/object/index.d.mts",
|
|
48
52
|
"import": "./dist/object/index.mjs"
|
|
@@ -89,25 +93,24 @@
|
|
|
89
93
|
"provenance": true
|
|
90
94
|
},
|
|
91
95
|
"dependencies": {
|
|
92
|
-
"es-toolkit": "1.
|
|
96
|
+
"es-toolkit": "1.51.0",
|
|
93
97
|
"ts-pattern": "5.9.0"
|
|
94
98
|
},
|
|
95
99
|
"devDependencies": {
|
|
96
|
-
"@types/node": "^
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"vitest": "^4.1.8",
|
|
100
|
+
"@types/node": "^26.2.0",
|
|
101
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
102
|
+
"tsdown": "0.22.14",
|
|
103
|
+
"typescript": "^7.0.2",
|
|
104
|
+
"vitest": "^4.1.10",
|
|
102
105
|
"@massaman/tsconfig": "0.0.0"
|
|
103
106
|
},
|
|
104
107
|
"engines": {
|
|
105
|
-
"node": ">=
|
|
108
|
+
"node": ">=26.0.0"
|
|
106
109
|
},
|
|
107
110
|
"scripts": {
|
|
108
111
|
"build": "tsdown",
|
|
109
112
|
"test": "vitest run",
|
|
110
113
|
"test:watch": "vitest",
|
|
111
|
-
"typecheck": "
|
|
114
|
+
"typecheck": "tsc --noEmit"
|
|
112
115
|
}
|
|
113
116
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-B9ig68hj.d.mts","names":[],"sources":["../src/array/adjust.ts","../src/array/dropRepeats.ts","../src/array/reduceWhile.ts","../src/array/scan.ts","../src/array/sorting.ts","../src/array/unfold.ts"],"mappings":";;;;;;AAYA;;;;;;;;;iBAAgB,MAAA,IAAU,KAAA,WAAgB,CAAA,IAAK,KAAA,UAAe,EAAA,GAAK,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,CAAA;;;;;;AAApF;;;;;;;;;;;;;;;iBCMgB,WAAA,IAAe,KAAA,WAAgB,CAAA,KAAM,CAAC;;;;;;ADNtD;;;;;;;;;;;;;;;;iBEOgB,WAAA,OACd,KAAA,WAAgB,CAAA,IAChB,SAAA,GAAY,WAAA,EAAa,CAAA,EAAG,KAAA,EAAO,CAAA,cACnC,EAAA,GAAK,WAAA,EAAa,CAAA,EAAG,KAAA,EAAO,CAAA,EAAG,KAAA,aAAkB,CAAA,EACjD,OAAA,EAAS,CAAA,GACR,CAAA;;;;;;AFZH;;;;;;;;;iBGAgB,IAAA,OACd,KAAA,WAAgB,CAAA,IAChB,EAAA,GAAK,WAAA,EAAa,CAAA,EAAG,KAAA,EAAO,CAAA,EAAG,KAAA,aAAkB,CAAA,EACjD,OAAA,EAAS,CAAA,GACR,CAAA;;;;;;AHJH;;;;;iBIJgB,MAAA,IAAU,EAAA,GAAK,KAAA,EAAO,CAAA,wBAAyB,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA;;;;;;;;;iBAsBxD,OAAA,IAAW,EAAA,GAAK,KAAA,EAAO,CAAA,wBAAyB,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA;;;;;AJlBY;;;;ACMrF;;;;;;iBGwCgB,QAAA,IACd,KAAA,WAAgB,CAAA,I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pickBy, sortKeys, toCamelCaseKeys, toMerged, toSnakeCaseKeys } from "es-toolkit/object";
|
|
2
|
-
|
|
3
|
-
//#region src/object/evolve.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Applies a spec of transformation functions to matching keys of an object,
|
|
6
|
-
* returning a new object. Keys not in the spec are copied as-is.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* evolve({ name: ' Alice ', age: 29, role: 'admin' }, {
|
|
11
|
-
* name: (s) => s.trim(),
|
|
12
|
-
* age: (n) => n + 1,
|
|
13
|
-
* })
|
|
14
|
-
* // { name: 'Alice', age: 30, role: 'admin' }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function evolve<T extends Record<string, unknown>>(obj: T, spec: { [K in keyof T]?: (value: T[K]) => T[K] }): T;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { toMerged as _, flattenObject as a, mapValues as c, omit as d, omitBy as f, toCamelCaseKeys as g, sortKeys as h, findKey as i, merge as l, pickBy as m, cloneDeep as n, invert as o, pick as p, cloneDeepWith as r, mapKeys as s, clone as t, mergeWith as u, toSnakeCaseKeys as v, evolve as y };
|
|
20
|
-
//# sourceMappingURL=index-D5qkz-H4.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-D5qkz-H4.d.mts","names":[],"sources":["../src/object/evolve.ts"],"mappings":";;;;;;AAaA;;;;;;;;;;iBAAgB,MAAA,WAAiB,MAAA,mBAC/B,GAAA,EAAK,CAAA,EACL,IAAA,gBAAoB,CAAA,KAAM,KAAA,EAAO,CAAA,CAAE,CAAA,MAAO,CAAA,CAAE,CAAA,MAC3C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DKEiLKtl.d.mts","names":[],"sources":["../src/control/attempt.ts","../src/control/result.ts","../src/control/todo.ts","../src/control/unimplemented.ts","../src/control/unreachable.ts"],"mappings":";;;;;;;AAk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|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { NonExhaustiveError, P, Pattern, isMatching, match } from "ts-pattern";
|
|
2
|
-
//#region src/match/match.ts
|
|
3
|
-
/**
|
|
4
|
-
* Extends ts-pattern's `P` namespace with `P.ok` and `P.err` — structural
|
|
5
|
-
* patterns for matching a `Result` inside `match()`.
|
|
6
|
-
*
|
|
7
|
-
* Mirrors Rust's `Ok(value)` / `Err(error)` match arms, but uses the
|
|
8
|
-
* namespace-property form (`P.ok` / `P.err`) so it doesn't collide with
|
|
9
|
-
* the lowercase `ok()` / `err()` constructors from `massaman/control`.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { match, P, attempt } from 'massaman'
|
|
14
|
-
*
|
|
15
|
-
* match(attempt(() => JSON.parse(raw)))
|
|
16
|
-
* .with(P.ok, ({ value }) => use(value))
|
|
17
|
-
* .with(P.err, ({ error }) => log(error))
|
|
18
|
-
* .exhaustive()
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
const okPattern = { ok: true };
|
|
22
|
-
const errPattern = { ok: false };
|
|
23
|
-
/**
|
|
24
|
-
* Extended ts-pattern `P` namespace. Carries everything ts-pattern exports
|
|
25
|
-
* (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok` / `P.err`
|
|
26
|
-
* for matching `Result` values.
|
|
27
|
-
*
|
|
28
|
-
* Explicit literal-type annotations on the additions (rather than `as const`)
|
|
29
|
-
* keep the values non-`readonly`, which ts-pattern's narrowing requires —
|
|
30
|
-
* a `readonly` pattern collapses the remaining input to `never` after the
|
|
31
|
-
* first arm, breaking exhaustiveness.
|
|
32
|
-
*
|
|
33
|
-
* For the `P.Pattern<T>` type shorthand, import `Pattern` standalone from
|
|
34
|
-
* `massaman/match` — it's the form ts-pattern's own docs recommend.
|
|
35
|
-
*/
|
|
36
|
-
const P$1 = {
|
|
37
|
-
...P,
|
|
38
|
-
ok: okPattern,
|
|
39
|
-
err: errPattern
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { P$1 as a, match as i, Pattern as n, isMatching as r, NonExhaustiveError as t };
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=match-uR6HPDRb.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match-uR6HPDRb.mjs","names":["P","TsP"],"sources":["../src/match/match.ts"],"sourcesContent":["/**\n * Extends ts-pattern's `P` namespace with `P.ok` and `P.err` — structural\n * patterns for matching a `Result` inside `match()`.\n *\n * Mirrors Rust's `Ok(value)` / `Err(error)` match arms, but uses the\n * namespace-property form (`P.ok` / `P.err`) so it doesn't collide with\n * the lowercase `ok()` / `err()` constructors from `massaman/control`.\n *\n * @example\n * ```ts\n * import { match, P, attempt } from 'massaman'\n *\n * match(attempt(() => JSON.parse(raw)))\n * .with(P.ok, ({ value }) => use(value))\n * .with(P.err, ({ error }) => log(error))\n * .exhaustive()\n * ```\n */\n\nimport { P as TsP } from 'ts-pattern'\n\nimport type { Err as ErrType, Ok as OkType } from '../control/types.js'\n\nconst okPattern: { ok: true } = { ok: true }\nconst errPattern: { ok: false } = { ok: false }\n\n/**\n * Extended ts-pattern `P` namespace. Carries everything ts-pattern exports\n * (`P.string`, `P.number`, `P.array`, `P.when`, …) plus `P.ok` / `P.err`\n * for matching `Result` values.\n *\n * Explicit literal-type annotations on the additions (rather than `as const`)\n * keep the values non-`readonly`, which ts-pattern's narrowing requires —\n * a `readonly` pattern collapses the remaining input to `never` after the\n * first arm, breaking exhaustiveness.\n *\n * For the `P.Pattern<T>` type shorthand, import `Pattern` standalone from\n * `massaman/match` — it's the form ts-pattern's own docs recommend.\n */\nexport const P: typeof TsP & { ok: { ok: true }; err: { ok: false } } = {\n ...TsP,\n ok: okPattern,\n err: errPattern,\n}\n\n/**\n * The `Ok` variant of a `Result<T>`. Re-exported here so the value-side\n * patterns and the type-side `Ok<T>` live in one module — any consumer\n * import gets both type and value namespaces without cross-module merge\n * issues (TS2300).\n */\nexport type Ok<T> = OkType<T>\n\n/**\n * The `Err` variant of a `Result<T>`. See {@link Ok} for the co-location note.\n */\nexport type Err = ErrType\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,YAA0B,EAAE,IAAI,KAAK;AAC3C,MAAM,aAA4B,EAAE,IAAI,MAAM;;;;;;;;;;;;;;AAe9C,MAAaA,MAA2D;CACtE,GAAGC;CACH,IAAI;CACJ,KAAK;AACP"}
|
package/dist/object-DUAxOgHi.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { clone, cloneDeep, cloneDeepWith, findKey, flattenObject, invert, mapKeys, mapValues, merge, mergeWith, omit, omitBy, pick, pickBy, sortKeys, toCamelCaseKeys, toMerged, toSnakeCaseKeys } from "es-toolkit/object";
|
|
2
|
-
//#region src/object/evolve.ts
|
|
3
|
-
/**
|
|
4
|
-
* Applies a spec of transformation functions to matching keys of an object,
|
|
5
|
-
* returning a new object. Keys not in the spec are copied as-is.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* evolve({ name: ' Alice ', age: 29, role: 'admin' }, {
|
|
10
|
-
* name: (s) => s.trim(),
|
|
11
|
-
* age: (n) => n + 1,
|
|
12
|
-
* })
|
|
13
|
-
* // { name: 'Alice', age: 30, role: 'admin' }
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
function evolve(obj, spec) {
|
|
17
|
-
const result = { ...obj };
|
|
18
|
-
for (const key of Object.keys(spec)) {
|
|
19
|
-
const transform = spec[key];
|
|
20
|
-
if (transform != null && key in result) result[key] = transform(result[key]);
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
export { toMerged as _, flattenObject as a, mapValues as c, omit as d, omitBy as f, toCamelCaseKeys as g, sortKeys as h, findKey as i, merge as l, pickBy as m, cloneDeep as n, invert as o, pick as p, cloneDeepWith as r, mapKeys as s, clone as t, mergeWith as u, toSnakeCaseKeys as v, evolve as y };
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=object-DUAxOgHi.mjs.map
|