@statedelta-libs/operators 0.0.1
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 +455 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2353 -0
- package/dist/index.d.ts +2353 -0
- package/dist/index.js +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
# @statedelta-libs/operators
|
|
2
|
+
|
|
3
|
+
> Functional operators library optimized for JSON DSL. Ramda-inspired, TypeScript-first.
|
|
4
|
+
|
|
5
|
+
[](./dist)
|
|
6
|
+
[](./src)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Complete**: 100+ operators (Core, List, Object, Logic, Math, String, Type, Advanced)
|
|
11
|
+
- **Lightweight**: ~7kb bundle (vs ~50kb Ramda)
|
|
12
|
+
- **TypeScript-first**: Strong type inference
|
|
13
|
+
- **Async native**: `pipeAsync`, `composeAsync`, `mapAsync`
|
|
14
|
+
- **JSON DSL ready**: Designed for `{ $fn: "map", args: [...] }`
|
|
15
|
+
- **Placeholder support**: Skip arguments with `__`
|
|
16
|
+
- **Lens support**: Immutable nested updates
|
|
17
|
+
- **Transducers**: Efficient transformations
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @statedelta-libs/operators
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { pipe, map, filter, sum, prop } from '@statedelta-libs/operators';
|
|
29
|
+
|
|
30
|
+
// Pipe - left-to-right composition
|
|
31
|
+
const totalActiveItems = pipe(
|
|
32
|
+
items,
|
|
33
|
+
filter(prop('active')),
|
|
34
|
+
map(prop('price')),
|
|
35
|
+
sum
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// With operators
|
|
39
|
+
import { curry, __, propEq, pick, merge } from '@statedelta-libs/operators';
|
|
40
|
+
|
|
41
|
+
const getVipDiscount = pipe(
|
|
42
|
+
filter(propEq('isVip', true)),
|
|
43
|
+
map(pick(['id', 'discount'])),
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## API Reference
|
|
50
|
+
|
|
51
|
+
### Core
|
|
52
|
+
|
|
53
|
+
| Function | Description |
|
|
54
|
+
|----------|-------------|
|
|
55
|
+
| `identity(x)` | Returns argument unchanged |
|
|
56
|
+
| `always(x)` | Returns function that always returns x |
|
|
57
|
+
| `T()` / `F()` | Always true / always false |
|
|
58
|
+
| `tap(fn, x)` | Execute side-effect, return original |
|
|
59
|
+
| `curry(fn)` | Curry with placeholder support |
|
|
60
|
+
| `curryN(n, fn)` | Curry with explicit arity |
|
|
61
|
+
| `partial(fn, args)` | Partial application from left |
|
|
62
|
+
| `partialRight(fn, args)` | Partial application from right |
|
|
63
|
+
| `pipe(val, ...fns)` | Left-to-right composition |
|
|
64
|
+
| `pipeBuilder(...fns)` | Create reusable pipe |
|
|
65
|
+
| `compose(...fns)` | Right-to-left composition |
|
|
66
|
+
| `pipeWith(transformer, fns)` | Pipe with custom transformer |
|
|
67
|
+
| `pipeAsync(...fns)` | Async pipe |
|
|
68
|
+
| `composeAsync(...fns)` | Async compose |
|
|
69
|
+
| `pipeK(...fns)` | Reader/context-aware pipe |
|
|
70
|
+
| `composeK(...fns)` | Reader/context-aware compose |
|
|
71
|
+
| `letIn(bindings, fn)` | Let bindings |
|
|
72
|
+
| `__` | Placeholder for skipping args |
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Pipe
|
|
76
|
+
pipe(5, x => x + 1, x => x * 2); // 12
|
|
77
|
+
|
|
78
|
+
// Curry with placeholder
|
|
79
|
+
const subtract = curry((a, b) => a - b);
|
|
80
|
+
const subtractFrom10 = subtract(__, 10);
|
|
81
|
+
subtractFrom10(15); // 5
|
|
82
|
+
|
|
83
|
+
// Let bindings
|
|
84
|
+
letIn(
|
|
85
|
+
{ doubled: x => x * 2, incremented: x => x + 1 },
|
|
86
|
+
({ doubled, incremented }) => doubled + incremented
|
|
87
|
+
)(5); // 10 + 6 = 16
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### List
|
|
93
|
+
|
|
94
|
+
| Function | Description |
|
|
95
|
+
|----------|-------------|
|
|
96
|
+
| `map(fn, list)` | Transform each element |
|
|
97
|
+
| `filter(pred, list)` | Keep elements matching predicate |
|
|
98
|
+
| `reject(pred, list)` | Remove elements matching predicate |
|
|
99
|
+
| `reduce(fn, init, list)` | Reduce to single value |
|
|
100
|
+
| `reduceRight(fn, init, list)` | Reduce from right |
|
|
101
|
+
| `head(list)` | First element |
|
|
102
|
+
| `tail(list)` | All except first |
|
|
103
|
+
| `last(list)` | Last element |
|
|
104
|
+
| `init(list)` | All except last |
|
|
105
|
+
| `nth(n, list)` | Element at index |
|
|
106
|
+
| `take(n, list)` | First n elements |
|
|
107
|
+
| `takeLast(n, list)` | Last n elements |
|
|
108
|
+
| `takeWhile(pred, list)` | Take while predicate true |
|
|
109
|
+
| `drop(n, list)` | Remove first n |
|
|
110
|
+
| `dropLast(n, list)` | Remove last n |
|
|
111
|
+
| `dropWhile(pred, list)` | Drop while predicate true |
|
|
112
|
+
| `slice(start, end, list)` | Slice of list |
|
|
113
|
+
| `find(pred, list)` | First match |
|
|
114
|
+
| `findIndex(pred, list)` | Index of first match |
|
|
115
|
+
| `findLast(pred, list)` | Last match |
|
|
116
|
+
| `indexOf(val, list)` | Index of value |
|
|
117
|
+
| `includes(val, list)` | Contains value? |
|
|
118
|
+
| `flatten(list)` | Flatten one level |
|
|
119
|
+
| `unnest(list)` | Alias for flatten |
|
|
120
|
+
| `chain(fn, list)` | Map then flatten |
|
|
121
|
+
| `uniq(list)` | Remove duplicates |
|
|
122
|
+
| `uniqBy(fn, list)` | Remove duplicates by key |
|
|
123
|
+
| `sort(comparator, list)` | Sort with comparator |
|
|
124
|
+
| `sortBy(fn, list)` | Sort by derived value |
|
|
125
|
+
| `reverse(list)` | Reverse list |
|
|
126
|
+
| `groupBy(fn, list)` | Group by key |
|
|
127
|
+
| `concat(a, b)` | Concatenate lists |
|
|
128
|
+
| `append(val, list)` | Add to end |
|
|
129
|
+
| `prepend(val, list)` | Add to start |
|
|
130
|
+
| `zip(a, b)` | Pair elements |
|
|
131
|
+
| `zipWith(fn, a, b)` | Pair with function |
|
|
132
|
+
| `zipObj(keys, values)` | Create object from pairs |
|
|
133
|
+
| `some(pred, list)` | Any match? |
|
|
134
|
+
| `every(pred, list)` | All match? |
|
|
135
|
+
| `none(pred, list)` | None match? |
|
|
136
|
+
| `length(list)` | Count elements |
|
|
137
|
+
| `sum(list)` | Sum numbers |
|
|
138
|
+
| `product(list)` | Product of numbers |
|
|
139
|
+
| `mean(list)` | Average |
|
|
140
|
+
| `median(list)` | Median |
|
|
141
|
+
| `min(list)` | Minimum |
|
|
142
|
+
| `max(list)` | Maximum |
|
|
143
|
+
| `countBy(fn, list)` | Count by key |
|
|
144
|
+
| `range(start, end)` | Generate range |
|
|
145
|
+
| `partition(pred, list)` | Split by predicate |
|
|
146
|
+
| `splitEvery(n, list)` | Split into chunks |
|
|
147
|
+
| `indexBy(fn, list)` | Index by key |
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// Transform
|
|
151
|
+
pipe(
|
|
152
|
+
[1, 2, 3, 4, 5],
|
|
153
|
+
filter(x => x > 2),
|
|
154
|
+
map(x => x * 2),
|
|
155
|
+
sum
|
|
156
|
+
); // 24
|
|
157
|
+
|
|
158
|
+
// Group and count
|
|
159
|
+
groupBy(prop('category'), products);
|
|
160
|
+
countBy(prop('status'), orders);
|
|
161
|
+
|
|
162
|
+
// Search
|
|
163
|
+
find(propEq('id', 123), users);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### Object
|
|
169
|
+
|
|
170
|
+
| Function | Description |
|
|
171
|
+
|----------|-------------|
|
|
172
|
+
| `prop(key, obj)` | Get property |
|
|
173
|
+
| `path(path, obj)` | Get nested property |
|
|
174
|
+
| `propOr(def, key, obj)` | Get property with default |
|
|
175
|
+
| `pathOr(def, path, obj)` | Get nested with default |
|
|
176
|
+
| `props(keys, obj)` | Get multiple properties |
|
|
177
|
+
| `pluck(key, list)` | Extract property from each |
|
|
178
|
+
| `assoc(key, val, obj)` | Set property (immutable) |
|
|
179
|
+
| `assocPath(path, val, obj)` | Set nested (immutable) |
|
|
180
|
+
| `dissoc(key, obj)` | Remove property |
|
|
181
|
+
| `dissocPath(path, obj)` | Remove nested property |
|
|
182
|
+
| `pick(keys, obj)` | Select properties |
|
|
183
|
+
| `omit(keys, obj)` | Exclude properties |
|
|
184
|
+
| `merge(a, b)` | Shallow merge |
|
|
185
|
+
| `mergeDeep(a, b)` | Deep merge |
|
|
186
|
+
| `evolve(transforms, obj)` | Transform properties |
|
|
187
|
+
| `applySpec(spec, obj)` | Build object from spec |
|
|
188
|
+
| `extend(a, b)` | Extend object |
|
|
189
|
+
| `keys(obj)` | Get keys |
|
|
190
|
+
| `values(obj)` | Get values |
|
|
191
|
+
| `entries(obj)` | Get entries |
|
|
192
|
+
| `fromEntries(entries)` | Create from entries |
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// Access
|
|
196
|
+
prop('name', user); // 'John'
|
|
197
|
+
path(['address', 'city'], user); // 'NYC'
|
|
198
|
+
pathOr('N/A', ['address', 'zip'], user);
|
|
199
|
+
|
|
200
|
+
// Transform (immutable)
|
|
201
|
+
assocPath(['settings', 'theme'], 'dark', user);
|
|
202
|
+
evolve({ age: inc, name: toUpper }, user);
|
|
203
|
+
|
|
204
|
+
// Select
|
|
205
|
+
pick(['id', 'name'], user);
|
|
206
|
+
omit(['password'], user);
|
|
207
|
+
|
|
208
|
+
// Merge
|
|
209
|
+
merge(defaults, userSettings);
|
|
210
|
+
mergeDeep(baseConfig, overrides);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### Logic
|
|
216
|
+
|
|
217
|
+
| Function | Description |
|
|
218
|
+
|----------|-------------|
|
|
219
|
+
| `equals(a, b)` | Deep equality |
|
|
220
|
+
| `identical(a, b)` | Reference equality |
|
|
221
|
+
| `gt(a, b)` | Greater than |
|
|
222
|
+
| `gte(a, b)` | Greater than or equal |
|
|
223
|
+
| `lt(a, b)` | Less than |
|
|
224
|
+
| `lte(a, b)` | Less than or equal |
|
|
225
|
+
| `not(x)` | Boolean not |
|
|
226
|
+
| `and(a, b)` | Boolean and |
|
|
227
|
+
| `or(a, b)` | Boolean or |
|
|
228
|
+
| `both(f, g)` | Both predicates true |
|
|
229
|
+
| `either(f, g)` | Either predicate true |
|
|
230
|
+
| `complement(pred)` | Negate predicate |
|
|
231
|
+
| `allPass(preds)` | All predicates pass |
|
|
232
|
+
| `anyPass(preds)` | Any predicate passes |
|
|
233
|
+
| `ifElse(pred, onTrue, onFalse)` | Conditional |
|
|
234
|
+
| `when(pred, fn)` | Apply if true |
|
|
235
|
+
| `unless(pred, fn)` | Apply if false |
|
|
236
|
+
| `cond(pairs)` | Switch-like conditional |
|
|
237
|
+
| `tryCatch(fn, handler)` | Try/catch wrapper |
|
|
238
|
+
| `propEq(key, val, obj)` | Property equals? |
|
|
239
|
+
| `propSatisfies(pred, key, obj)` | Property satisfies? |
|
|
240
|
+
| `pathEq(path, val, obj)` | Path equals? |
|
|
241
|
+
| `pathSatisfies(pred, path, obj)` | Path satisfies? |
|
|
242
|
+
| `where(spec, obj)` | Match spec |
|
|
243
|
+
| `whereEq(spec, obj)` | Match values |
|
|
244
|
+
| `is(Ctor, val)` | Instance check |
|
|
245
|
+
| `isNil(x)` | Is null/undefined? |
|
|
246
|
+
| `isEmpty(x)` | Is empty? |
|
|
247
|
+
| `isNotNil(x)` | Is not null/undefined? |
|
|
248
|
+
| `isNotEmpty(x)` | Is not empty? |
|
|
249
|
+
| `defaultTo(def, val)` | Default for nil |
|
|
250
|
+
| `coalesce(...vals)` | First non-nil |
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
// Predicates
|
|
254
|
+
filter(propEq('status', 'active'), items);
|
|
255
|
+
filter(where({ age: gte(__, 18), verified: equals(true) }), users);
|
|
256
|
+
|
|
257
|
+
// Conditionals
|
|
258
|
+
ifElse(
|
|
259
|
+
propEq('role', 'admin'),
|
|
260
|
+
always(fullAccess),
|
|
261
|
+
always(limitedAccess)
|
|
262
|
+
)(user);
|
|
263
|
+
|
|
264
|
+
cond([
|
|
265
|
+
[propEq('type', 'A'), handleA],
|
|
266
|
+
[propEq('type', 'B'), handleB],
|
|
267
|
+
[T, handleDefault]
|
|
268
|
+
])(item);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
### Math
|
|
274
|
+
|
|
275
|
+
| Function | Description |
|
|
276
|
+
|----------|-------------|
|
|
277
|
+
| `add(a, b)` | Addition |
|
|
278
|
+
| `subtract(a, b)` | Subtraction |
|
|
279
|
+
| `multiply(a, b)` | Multiplication |
|
|
280
|
+
| `divide(a, b)` | Division |
|
|
281
|
+
| `modulo(a, b)` | Modulo |
|
|
282
|
+
| `negate(x)` | Negate number |
|
|
283
|
+
| `inc(x)` | Increment |
|
|
284
|
+
| `dec(x)` | Decrement |
|
|
285
|
+
| `clamp(min, max, val)` | Clamp to range |
|
|
286
|
+
| `abs(x)` | Absolute value |
|
|
287
|
+
| `round(x)` | Round |
|
|
288
|
+
| `floor(x)` | Floor |
|
|
289
|
+
| `ceil(x)` | Ceiling |
|
|
290
|
+
| `pow(base, exp)` | Power |
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
// Math operations
|
|
294
|
+
map(multiply(2), [1, 2, 3]); // [2, 4, 6]
|
|
295
|
+
clamp(0, 100, value);
|
|
296
|
+
pipe(prices, map(multiply(1.1)), map(round));
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### String
|
|
302
|
+
|
|
303
|
+
| Function | Description |
|
|
304
|
+
|----------|-------------|
|
|
305
|
+
| `toUpper(str)` | Uppercase |
|
|
306
|
+
| `toLower(str)` | Lowercase |
|
|
307
|
+
| `trim(str)` | Trim whitespace |
|
|
308
|
+
| `split(sep, str)` | Split string |
|
|
309
|
+
| `join(sep, list)` | Join list |
|
|
310
|
+
| `replace(pattern, replacement, str)` | Replace |
|
|
311
|
+
| `startsWith(prefix, str)` | Starts with? |
|
|
312
|
+
| `endsWith(suffix, str)` | Ends with? |
|
|
313
|
+
| `test(regex, str)` | Test regex |
|
|
314
|
+
| `match(regex, str)` | Match regex |
|
|
315
|
+
| `substring(start, end, str)` | Substring |
|
|
316
|
+
| `padStart(len, char, str)` | Pad start |
|
|
317
|
+
| `padEnd(len, char, str)` | Pad end |
|
|
318
|
+
| `concatStr(a, b)` | Concatenate strings |
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
pipe(
|
|
322
|
+
' Hello World ',
|
|
323
|
+
trim,
|
|
324
|
+
toLower,
|
|
325
|
+
split(' '),
|
|
326
|
+
map(s => s[0].toUpperCase() + s.slice(1)),
|
|
327
|
+
join(' ')
|
|
328
|
+
); // 'Hello World'
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### Type
|
|
334
|
+
|
|
335
|
+
| Function | Description |
|
|
336
|
+
|----------|-------------|
|
|
337
|
+
| `toString(x)` | Convert to string |
|
|
338
|
+
| `toNumber(x)` | Convert to number |
|
|
339
|
+
| `toBoolean(x)` | Convert to boolean |
|
|
340
|
+
| `toArray(x)` | Convert to array |
|
|
341
|
+
| `toObject(x)` | Convert to object |
|
|
342
|
+
| `type(x)` | Get type name |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
### Advanced
|
|
347
|
+
|
|
348
|
+
#### Lens
|
|
349
|
+
|
|
350
|
+
Immutable nested updates.
|
|
351
|
+
|
|
352
|
+
| Function | Description |
|
|
353
|
+
|----------|-------------|
|
|
354
|
+
| `lens(getter, setter)` | Create lens |
|
|
355
|
+
| `lensProp(key)` | Lens for property |
|
|
356
|
+
| `lensPath(path)` | Lens for nested path |
|
|
357
|
+
| `lensIndex(i)` | Lens for array index |
|
|
358
|
+
| `view(lens, obj)` | Get via lens |
|
|
359
|
+
| `set(lens, val, obj)` | Set via lens |
|
|
360
|
+
| `over(lens, fn, obj)` | Transform via lens |
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
const nameLens = lensProp('name');
|
|
364
|
+
const addressCityLens = lensPath(['address', 'city']);
|
|
365
|
+
|
|
366
|
+
view(nameLens, user); // 'John'
|
|
367
|
+
set(nameLens, 'Jane', user); // { name: 'Jane', ... }
|
|
368
|
+
over(nameLens, toUpper, user); // { name: 'JOHN', ... }
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Async
|
|
372
|
+
|
|
373
|
+
| Function | Description |
|
|
374
|
+
|----------|-------------|
|
|
375
|
+
| `mapAsync(fn, list)` | Parallel async map |
|
|
376
|
+
| `mapSerial(fn, list)` | Sequential async map |
|
|
377
|
+
| `filterAsync(pred, list)` | Async filter |
|
|
378
|
+
| `reduceAsync(fn, init, list)` | Async reduce |
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
await mapAsync(fetchUser, userIds);
|
|
382
|
+
await mapSerial(processInOrder, items);
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### Transducers
|
|
386
|
+
|
|
387
|
+
Efficient transformations without intermediate arrays.
|
|
388
|
+
|
|
389
|
+
| Function | Description |
|
|
390
|
+
|----------|-------------|
|
|
391
|
+
| `mapT(fn)` | Map transducer |
|
|
392
|
+
| `filterT(pred)` | Filter transducer |
|
|
393
|
+
| `takeT(n)` | Take transducer |
|
|
394
|
+
| `dropT(n)` | Drop transducer |
|
|
395
|
+
| `composeT(...xforms)` | Compose transducers |
|
|
396
|
+
| `transduce(xform, reducer, init, list)` | Apply transducer |
|
|
397
|
+
| `into(to, xform, from)` | Transduce into collection |
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
const xform = composeT(
|
|
401
|
+
filterT(x => x > 2),
|
|
402
|
+
mapT(x => x * 2),
|
|
403
|
+
takeT(3)
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
transduce(xform, (acc, x) => acc + x, 0, [1, 2, 3, 4, 5, 6, 7]);
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## TypeScript
|
|
412
|
+
|
|
413
|
+
Full type inference throughout:
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
import { pipe, map, filter, prop, sum } from '@statedelta-libs/operators';
|
|
417
|
+
|
|
418
|
+
// Types flow through pipe
|
|
419
|
+
const result = pipe(
|
|
420
|
+
[{ price: 10, active: true }, { price: 20, active: false }],
|
|
421
|
+
filter(prop('active')), // { price: number, active: boolean }[]
|
|
422
|
+
map(prop('price')), // number[]
|
|
423
|
+
sum // number
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
// Curried functions preserve types
|
|
427
|
+
const getPrice = prop('price'); // <T>(obj: T) => T['price']
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Bundle Size
|
|
433
|
+
|
|
434
|
+
| Build | Size |
|
|
435
|
+
|-------|------|
|
|
436
|
+
| ESM | ~7kb |
|
|
437
|
+
| CJS | ~7kb |
|
|
438
|
+
| Types | ~22kb |
|
|
439
|
+
|
|
440
|
+
## Comparison with Ramda
|
|
441
|
+
|
|
442
|
+
| Aspect | Ramda | @statedelta-libs/operators |
|
|
443
|
+
|--------|-------|------------------------|
|
|
444
|
+
| Functions | 280+ | 100+ |
|
|
445
|
+
| Bundle | ~50kb | ~7kb |
|
|
446
|
+
| TypeScript | Weak types | Strong inference |
|
|
447
|
+
| Async | Not native | Native support |
|
|
448
|
+
| Lens | Yes | Yes |
|
|
449
|
+
| Transducers | Yes | Yes |
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## License
|
|
454
|
+
|
|
455
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function v(n){return n}function E(n){return function(){return n}}function F(){return true}function V(){return false}var w=Symbol.for("@@statedelta/placeholder"),D={[w]:true,__:w};function c(n){return n!==null&&typeof n=="object"&&w in n&&n[w]===true}function p(n){return function e(r){return arguments.length===0?e:n(r)}}function l(n){return function e(r,t){switch(arguments.length){case 0:return e;case 1:return c(r)?e:p(o=>n(r,o));default:return c(r)&&c(t)?e:c(r)?p(o=>n(o,t)):c(t)?p(o=>n(r,o)):n(r,t)}}}var j=l(function(e,r){return e(r),r});function k(n){return function e(r,t,o){switch(arguments.length){case 0:return e;case 1:return c(r)?e:l((s,T)=>n(r,s,T));case 2:return c(r)&&c(t)?e:c(r)?l((s,T)=>n(s,t,T)):c(t)?l((s,T)=>n(r,s,T)):p(s=>n(r,t,s));default:let u=c(r),i=c(t),a=c(o),d=(u?1:0)+(i?1:0)+(a?1:0);return d===3?e:d===2?u?i?l((s,T)=>n(s,T,o)):l((s,T)=>n(s,t,T)):l((s,T)=>n(r,s,T)):d===1?u?p(s=>n(s,t,o)):i?p(s=>n(r,s,o)):p(s=>n(r,t,s)):n(r,t,o)}}}function A(n,e,r){return function t(...o){if(o.length===0)return t;let u=[],i=0;for(let d=0;d<e.length;d++)c(e[d])&&i<o.length?(u.push(o[i]),i++):u.push(e[d]);for(;i<o.length;)u.push(o[i]),i++;let a=0;for(let d=0;d<Math.min(u.length,n);d++)c(u[d])||a++;return a>=n?r.apply(this,u.slice(0,n)):A(n,u,r)}}function N(n){let e=n.length;switch(e){case 0:return n;case 1:return p(n);case 2:return l(n);case 3:return k(n);default:return A(e,[],n)}}function L(n,e){if(n<0)throw new Error(`curryN: arity must be non-negative, got ${n}`);if(n>10)throw new Error(`curryN: arity must be at most 10, got ${n}`);switch(n){case 0:return e;case 1:return p(e);case 2:return l(e);case 3:return k(e);default:return A(n,[],e)}}function O(n,e){return function(...t){let o=[],u=0;for(let i=0;i<e.length;i++)c(e[i])&&u<t.length?(o.push(t[u]),u++):o.push(e[i]);for(;u<t.length;)o.push(t[u]),u++;return n(...o)}}function _(n,e){return function(...t){return n(...t,...e)}}var W=function(e,...r){let t=e;for(let o=0;o<r.length;o++)t=r[o](t);return t},I=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=0;u<e.length;u++)o=e[u](o);return o}};var q=function(...e){return e.length===0?r=>r:e.length===1?e[0]:function(t){let o=t;for(let u=e.length-1;u>=0;u--)o=e[u](o);return o}};function M(n,e){return e.length===0?(r=>r):function(t){let o=t;for(let u=0;u<e.length;u++)o=n(e[u],o);return o}}function z(...n){return async function(r){let t=r;for(let o=0;o<n.length;o++)t=await n[o](t);return t}}function H(...n){return async function(r){let t=r;for(let o=n.length-1;o>=0;o--)t=await n[o](t);return t}}function $(...n){return e=>r=>n.reduce((t,o)=>o(t)(r),e)}function Y(...n){return e=>r=>n.reduceRight((t,o)=>o(t)(r),e)}function dr(n,e){let r={...e};for(let[t,o]of Object.entries(n))r[t]=typeof o=="function"?o(r):o;return r}function U(n,e,r){let t=dr(n,r);return e(t)}function G(n,e,r){return e!==void 0&&r!==void 0?U(n,e,r):e!==void 0?t=>U(n,e,t):(t,o)=>o!==void 0?U(n,t,o):u=>U(n,t,u)}var J=l((n,e)=>{let r=e.length,t=new Array(r);for(let o=0;o<r;o++)t[o]=n(e[o],o,e);return t});var Q=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)&&r.push(e[o]);return r}),X=l((n,e)=>{let r=[],t=e.length;for(let o=0;o<t;o++)n(e[o],o,e)||r.push(e[o]);return r});var Z=k((n,e,r)=>{let t=e,o=r.length;for(let u=0;u<o;u++)t=n(t,r[u],u,r);return t}),nn=k((n,e,r)=>{let t=e;for(let o=r.length-1;o>=0;o--)t=n(t,r[o],o,r);return t});function en(n){return n[0]}function rn(n){return n.slice(1)}function tn(n){return n[n.length-1]}function on(n){return n.slice(0,-1)}function un(n,e){if(e===void 0)return t=>{let o=n<0?t.length+n:n;return t[o]};let r=n<0?e.length+n:n;return e[r]}function an(n,e){return e===void 0?r=>r.slice(0,Math.max(0,n)):e.slice(0,Math.max(0,n))}function dn(n,e){return e===void 0?r=>n<=0?[]:r.slice(-n):n<=0?[]:e.slice(-n)}function sn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length&&n(t[u],u,t);u++)o.push(t[u]);return o};return e===void 0?r:r(e)}function cn(n,e){return e===void 0?r=>r.slice(Math.max(0,n)):e.slice(Math.max(0,n))}function ln(n,e){return e===void 0?r=>n<=0?r.slice():r.slice(0,-n):n<=0?e.slice():e.slice(0,-n)}function fn(n,e){let r=t=>{let o=0;for(;o<t.length&&n(t[o],o,t);)o++;return t.slice(o)};return e===void 0?r:r(e)}function Tn(n,e,r){return e!==void 0&&r!==void 0?r.slice(n,e):e!==void 0?t=>t.slice(n,e):function(o,u){return u!==void 0?u.slice(n,o):i=>i.slice(n,o)}}function pn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function yn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return o;return -1};return e===void 0?r:r(e)}function mn(n,e){let r=t=>{for(let o=t.length-1;o>=0;o--)if(n(t[o],o,t))return t[o]};return e===void 0?r:r(e)}function xn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return o;return -1};return e===void 0?r:r(e)}function bn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(t[o]===n)return true;return false};return e===void 0?r:r(e)}function K(n){let e=[];for(let r=0;r<n.length;r++){let t=n[r];if(Array.isArray(t))for(let o=0;o<t.length;o++)e.push(t[o]);else e.push(t);}return e}var gn=K;function Rn(n,e){let r=t=>{let o=[];for(let u=0;u<t.length;u++){let i=n(t[u],u,t);for(let a=0;a<i.length;a++)o.push(i[a]);}return o};return e===void 0?r:r(e)}function kn(n){let e=new Set,r=[];for(let t=0;t<n.length;t++){let o=n[t];e.has(o)||(e.add(o),r.push(o));}return r}function An(n,e){let r=t=>{let o=new Set,u=[];for(let i=0;i<t.length;i++){let a=t[i],d=n(a);o.has(d)||(o.add(d),u.push(a));}return u};return e===void 0?r:r(e)}function hn(n,e){return e===void 0?r=>[...r].sort(n):[...e].sort(n)}function wn(n,e){let r=(t,o)=>{let u=n(t),i=n(o);return u<i?-1:u>i?1:0};return e===void 0?t=>[...t].sort(r):[...e].sort(r)}function Un(n){let e=new Array(n.length);for(let r=0;r<n.length;r++)e[n.length-1-r]=n[r];return e}function Cn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=t[u],a=n(i);a in o||(o[a]=[]),o[a].push(i);}return o};return e===void 0?r:r(e)}function Sn(n,e){return e===void 0?r=>[...n,...r]:[...n,...e]}function Kn(n,e){return e===void 0?r=>[...r,n]:[...e,n]}function Bn(n,e){return e===void 0?r=>[n,...r]:[n,...e]}function Pn(n,e){if(e===void 0)return o=>{let u=Math.min(n.length,o.length),i=new Array(u);for(let a=0;a<u;a++)i[a]=[n[a],o[a]];return i};let r=Math.min(n.length,e.length),t=new Array(r);for(let o=0;o<r;o++)t[o]=[n[o],e[o]];return t}function vn(n,e,r){if(e!==void 0&&r!==void 0){let t=Math.min(e.length,r.length),o=new Array(t);for(let u=0;u<t;u++)o[u]=n(e[u],r[u]);return o}return e!==void 0?t=>{let o=Math.min(e.length,t.length),u=new Array(o);for(let i=0;i<o;i++)u[i]=n(e[i],t[i]);return u}:function(o,u){if(u!==void 0){let i=Math.min(o.length,u.length),a=new Array(i);for(let d=0;d<i;d++)a[d]=n(o[d],u[d]);return a}return i=>{let a=Math.min(o.length,i.length),d=new Array(a);for(let s=0;s<a;s++)d[s]=n(o[s],i[s]);return d}}}function En(n,e){if(e===void 0)return o=>{let u={},i=Math.min(n.length,o.length);for(let a=0;a<i;a++)u[n[a]]=o[a];return u};let r={},t=Math.min(n.length,e.length);for(let o=0;o<t;o++)r[n[o]]=e[o];return r}function Fn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return true;return false};return e===void 0?r:r(e)}function Vn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(!n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function Dn(n,e){let r=t=>{for(let o=0;o<t.length;o++)if(n(t[o],o,t))return false;return true};return e===void 0?r:r(e)}function jn(n){return n.length}function Nn(n){let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e}function Ln(n){if(n.length===0)return 1;let e=1;for(let r=0;r<n.length;r++)e*=n[r];return e}function On(n){if(n.length===0)return NaN;let e=0;for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}function _n(n){if(n.length===0)return NaN;let e=[...n].sort((t,o)=>t-o),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}function Wn(n){if(n.length===0)return 1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]<e&&(e=n[r]);return e}function In(n){if(n.length===0)return -1/0;let e=n[0];for(let r=1;r<n.length;r++)n[r]>e&&(e=n[r]);return e}function qn(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=(o[i]||0)+1;}return o};return e===void 0?r:r(e)}function Mn(n,e){if(e===void 0)return t=>{if(n>=t)return [];let o=new Array(t-n);for(let u=0;u<o.length;u++)o[u]=n+u;return o};if(n>=e)return [];let r=new Array(e-n);for(let t=0;t<r.length;t++)r[t]=n+t;return r}function zn(n,e){let r=t=>{let o=[],u=[];for(let i=0;i<t.length;i++)n(t[i],i,t)?o.push(t[i]):u.push(t[i]);return [o,u]};return e===void 0?r:r(e)}function Hn(n,e){if(e===void 0)return t=>{if(n<=0)return [];let o=[];for(let u=0;u<t.length;u+=n)o.push(t.slice(u,u+n));return o};if(n<=0)return [];let r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return r}function $n(n,e){let r=t=>{let o={};for(let u=0;u<t.length;u++){let i=n(t[u]);o[i]=t[u];}return o};return e===void 0?r:r(e)}function Yn(n,e){return e===void 0?r=>r[n]:e[n]}function f(n,e){if(e===void 0)return t=>f(n,t);let r=e;for(let t of n){if(r==null)return;r=r[t];}return r}function Gn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=a[o];return d??n};let i=u[o];return i??n};if(r===void 0)return o=>{let u=o[e];return u??n};let t=r[e];return t??n}function Jn(n,e,r){if(e===void 0)return (o,u)=>{if(u===void 0)return a=>{let d=f(o,a);return d??n};let i=f(o,u);return i??n};if(r===void 0)return o=>{let u=f(e,o);return u??n};let t=f(e,r);return t??n}function Qn(n,e){return e===void 0?r=>n.map(t=>r[t]):n.map(r=>e[r])}function Xn(n,e){return e===void 0?r=>r.map(t=>t[n]):e.map(r=>r[n])}function Zn(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>({...u,[n]:t}):{...o,[n]:t}:r===void 0?t=>({...t,[n]:e}):{...r,[n]:e}}function g(n,e,r){if(n.length===0)return e;let[t,...o]=n,u=typeof t=="number";if(r==null){let a=u?[]:{};if(o.length===0){if(u){let d=a;return d[t]=e,d}return {...a,[t]:e}}if(u){let d=a;return d[t]=g(o,e,void 0),d}return {...a,[t]:g(o,e,void 0)}}if(Array.isArray(r)){let a=[...r];return a[t]=o.length===0?e:g(o,e,r[t]),a}let i=r;return {...i,[t]:o.length===0?e:g(o,e,i[t])}}function ne(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>g(n,t,u):g(n,t,o):r===void 0?t=>g(n,e,t):g(n,e,r)}function ee(n,e){if(e===void 0)return o=>{let{[n]:u,...i}=o;return i};let{[n]:r,...t}=e;return t}function C(n,e){if(n.length===0||e===null||e===void 0)return e;let[r,...t]=n;if(t.length===0){if(Array.isArray(e)){let a=[...e];return a.splice(r,1),a}let{[r]:u,...i}=e;return i}if(Array.isArray(e)){let u=[...e];return u[r]=C(t,e[r]),u}let o=e;return {...o,[r]:C(t,o[r])}}function re(n,e){return e===void 0?r=>C(n,r):C(n,e)}function te(n,e){if(e===void 0)return t=>{let o={};for(let u of n)u in t&&(o[u]=t[u]);return o};let r={};for(let t of n)t in e&&(r[t]=e[t]);return r}function oe(n,e){let r=new Set(n);if(e===void 0)return o=>{let u={};for(let i in o)r.has(i)||(u[i]=o[i]);return u};let t={};for(let o in e)r.has(o)||(t[o]=e[o]);return t}function ue(n,e){return e===void 0?r=>({...n,...r}):{...n,...e}}function h(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ie(n,e){let r=(t,o)=>{let u={...t};for(let i in o)h(t[i])&&h(o[i])?u[i]=r(t[i],o[i]):u[i]=o[i];return u};return e===void 0?t=>r(n,t):r(n,e)}function ae(n,e){let r=(t,o)=>{let u={...o};for(let i in t)if(i in o){let a=t[i];typeof a=="function"?u[i]=a(o[i]):h(a)&&h(o[i])&&(u[i]=r(a,o[i]));}return u};return e===void 0?t=>r(n,t):r(n,e)}function de(n){let e=(r,t)=>{let o={};for(let u in r){let i=r[u];typeof i=="function"?o[u]=i(...t):h(i)?o[u]=e(i,t):o[u]=i;}return o};return (...r)=>e(n,r)}function se(n,e){let r=(t,o)=>{let u={};for(let i in t)u[i]=t[i](o);return {...o,...u}};return e===void 0?t=>r(n,t):r(n,e)}function ce(n){return Object.keys(n)}function le(n){return Object.values(n)}function fe(n){return Object.entries(n)}function Te(n){return Object.fromEntries(n)}function S(n,e){if(n===e)return true;if(n===null||e===null)return n===e;if(typeof n!=typeof e)return false;if(typeof n=="object"){if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?false:n.every((i,a)=>S(i,e[a]));if(Array.isArray(n)||Array.isArray(e))return false;let r=n,t=e,o=Object.keys(r),u=Object.keys(t);return o.length!==u.length?false:o.every(i=>S(r[i],t[i]))}return false}function x(n,e){return e===void 0&&arguments.length===1?r=>S(n,r):S(n,e)}function pe(n,e){return e===void 0&&arguments.length===1?r=>n===r:n===e}function ye(n,e){return e===void 0?r=>r>n:n>e}function me(n,e){return e===void 0?r=>r>=n:n>=e}function xe(n,e){return e===void 0?r=>r<n:n<e}function be(n,e){return e===void 0?r=>r<=n:n<=e}function ge(n){return !n}function Re(n,e){return e===void 0&&arguments.length===1?r=>n&&r:n&&e}function ke(n,e){return e===void 0&&arguments.length===1?r=>n||r:n||e}function Ae(n,e){return e===void 0?r=>t=>n(t)&&r(t):r=>n(r)&&e(r)}function he(n,e){return e===void 0?r=>t=>n(t)||r(t):r=>n(r)||e(r)}function we(n){return e=>!n(e)}function Ue(n){return e=>n.every(r=>r(e))}function Ce(n){return e=>n.some(r=>r(e))}function Se(n,e,r){return t=>n(t)?e(t):r(t)}function Ke(n,e){return r=>n(r)?e(r):r}function Be(n,e){return r=>n(r)?r:e(r)}function Pe(n){return e=>{for(let[r,t]of n)if(r(e))return t(e)}}function ve(n,e){return r=>{try{return n(r)}catch(t){return e(t,r)}}}function Ee(n,e,r){return arguments.length===1?(t,o)=>o===void 0?u=>x(u[n],t):x(o[n],t):r===void 0?t=>x(t[n],e):x(r[n],e)}function Fe(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(u[t]):n(o[t]):r===void 0?t=>n(t[e]):n(r[e])}function Ve(n,e,r){return e===void 0&&arguments.length===1?(t,o)=>o===void 0?u=>x(f(n,u),t):x(f(n,o),t):r===void 0?t=>x(f(n,t),e):x(f(n,r),e)}function De(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n(f(t,u)):n(f(t,o)):r===void 0?t=>n(f(e,t)):n(f(e,r))}function je(n,e){let r=t=>{for(let o in n){let u=n[o];if(u&&!u(t[o]))return false}return true};return e===void 0?r:r(e)}function Ne(n,e){let r=t=>{for(let o in n)if(!x(n[o],t[o]))return false;return true};return e===void 0?r:r(e)}function Le(n,e){return e===void 0&&arguments.length===1?r=>r==null?false:r instanceof n||r.constructor===n:e==null?false:e instanceof n||e.constructor===n}function Oe(n){return n==null}function _e(n){return n!=null}function B(n){return n==null?true:typeof n=="string"||Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:false}function We(n){return !B(n)}function Ie(n,e){return e===void 0&&arguments.length===1?r=>r==null||typeof r=="number"&&Number.isNaN(r)?n:r:e==null||typeof e=="number"&&Number.isNaN(e)?n:e}function qe(...n){for(let e of n)if(e!=null)return e}function sr(n,e){return e===void 0?r=>n+r:n+e}function cr(n,e){return e===void 0?r=>n-r:n-e}function lr(n,e){return e===void 0?r=>n*r:n*e}function fr(n,e){return e===void 0?r=>n/r:n/e}function Tr(n,e){return e===void 0?r=>n%r:n%e}function pr(n){return -n}function yr(n){return n+1}function mr(n){return n-1}function xr(n,e,r){return r===void 0?t=>Math.min(e,Math.max(n,t)):Math.min(e,Math.max(n,r))}function br(n){return Math.abs(n)}function gr(n){return Math.round(n)}function Rr(n){return Math.floor(n)}function kr(n){return Math.ceil(n)}function Ar(n,e){return e===void 0?r=>Math.pow(r,n):Math.pow(e,n)}function hr(n){return n.toUpperCase()}function wr(n){return n.toLowerCase()}function Ur(n){return n.trim()}function Cr(n,e){return e===void 0?r=>r.split(n):e.split(n)}function Sr(n,e){return e===void 0?r=>r.join(n):e.join(n)}function Kr(n,e,r){return r===void 0?t=>t.replace(n,e):r.replace(n,e)}function Br(n,e){return e===void 0?r=>r.startsWith(n):e.startsWith(n)}function Pr(n,e){return e===void 0?r=>r.endsWith(n):e.endsWith(n)}function vr(n,e){return e===void 0?r=>n.test(r):n.test(e)}function Er(n,e){return e===void 0?r=>r.match(n):e.match(n)}function Fr(n,e,r){return typeof e=="string"?e.substring(n):r===void 0?t=>t.substring(n,e):r.substring(n,e)}function Vr(n,e,r){return typeof e=="string"&&r===void 0&&e.length>1,r===void 0?t=>t.padStart(n,e):r.padStart(n,e)}function Dr(n,e,r){return r===void 0?t=>t.padEnd(n,e):r.padEnd(n,e)}function jr(n,e){return e===void 0?r=>n+r:n+e}function Nr(n){return n===null?"null":n===void 0?"undefined":String(n)}function Lr(n){return typeof n=="number"?n:typeof n=="string"?Number(n):typeof n=="boolean"?n?1:0:n==null?NaN:Number(n)}function Or(n){return !!n}function _r(n){return Array.isArray(n)?[...n]:n==null?[]:typeof n=="string"?[...n]:typeof n[Symbol.iterator]=="function"?[...n]:[n]}function Wr(n){return n==null?{}:typeof n=="object"?n:Object(n)}function Ir(n){return n===null?"Null":n===void 0?"Undefined":Object.prototype.toString.call(n).slice(8,-1)}function Me(n,e){return {get:n,set:e}}function ze(n){return {get:e=>e[n],set:(e,r)=>({...r,[n]:e})}}function He(n){return {get:e=>{let r=e;for(let t of n){if(r==null)return;r=r[t];}return r},set:(e,r)=>{if(n.length===0)return e;let t=(o,u,i)=>{let[a,...d]=o,s=typeof a=="number";if(d.length===0){if(Array.isArray(i)){let R=[...i];return R[a]=u,R}return {...i,[a]:u}}if(i==null){let R=s?[]:{};if(s){let P=R;return P[a]=t(d,u,void 0),P}return {[a]:t(d,u,void 0)}}if(Array.isArray(i)){let R=[...i];return R[a]=t(d,u,i[a]),R}let T=i;return {...T,[a]:t(d,u,T[a])}};return t(n,e,r)}}}function $e(n){return {get:e=>e[n],set:(e,r)=>{let t=[...r];return t[n]=e,t}}}function Ye(n,e){return e===void 0?r=>n.get(r):n.get(e)}function Ge(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t,u):n.set(t,o):r===void 0?t=>n.set(e,t):n.set(e,r)}function Je(n,e,r){return e===void 0?(t,o)=>o===void 0?u=>n.set(t(n.get(u)),u):n.set(t(n.get(o)),o):r===void 0?t=>n.set(e(n.get(t)),t):n.set(e(n.get(r)),r)}function Qe(n,e){return e===void 0?r=>Promise.all(r.map((t,o)=>n(t,o))):Promise.all(e.map((r,t)=>n(r,t)))}function Xe(n,e){let r=async t=>{let o=[];for(let u=0;u<t.length;u++)o.push(await n(t[u],u));return o};return e===void 0?t=>r(t):r(e)}function Ze(n,e){let r=async t=>(await Promise.all(t.map(async(u,i)=>({item:u,keep:await n(u,i)})))).filter(({keep:u})=>u).map(({item:u})=>u);return e===void 0?t=>r(t):r(e)}function nr(n,e,r){let t=async o=>{let u=e;for(let i=0;i<o.length;i++)u=await n(u,o[i],i);return u};return r===void 0?o=>t(o):t(r)}var b="@@transducer/init",y="@@transducer/step",m="@@transducer/result";function er(n){return e=>({[b]:()=>e[b](),[y]:(r,t)=>e[y](r,n(t)),[m]:r=>e[m](r)})}function rr(n){return e=>({[b]:()=>e[b](),[y]:(r,t)=>n(t)?e[y](r,t):r,[m]:r=>e[m](r)})}function tr(n){return e=>{let r=0;return {[b]:()=>e[b](),[y]:(t,o)=>r<n?(r++,e[y](t,o)):t,[m]:t=>e[m](t)}}}function or(n){return e=>{let r=0;return {[b]:()=>e[b](),[y]:(t,o)=>r<n?(r++,t):e[y](t,o),[m]:t=>e[m](t)}}}function ur(...n){return e=>n.reduceRight((r,t)=>t(r),e)}function qr(){return {[b]:()=>[],[y]:(n,e)=>(n.push(e),n),[m]:n=>n}}function ir(n,e,r,t){let o=u=>{let i=n(e),a=r;for(let d of u)a=i[y](a,d);return i[m](a)};return t===void 0?u=>o(u):o(t)}function ar(n,e){let r=t=>{let o=n(qr()),u=o[b]();for(let i of t)u=o[y](u,i);return o[m](u)};return e===void 0?t=>r(t):r(e)}exports.F=V;exports.T=F;exports.TRANSDUCER_INIT=b;exports.TRANSDUCER_RESULT=m;exports.TRANSDUCER_STEP=y;exports.__=D;exports.abs=br;exports.add=sr;exports.allPass=Ue;exports.always=E;exports.and=Re;exports.anyPass=Ce;exports.append=Kn;exports.applySpec=de;exports.assoc=Zn;exports.assocPath=ne;exports.both=Ae;exports.ceil=kr;exports.chain=Rn;exports.clamp=xr;exports.coalesce=qe;exports.complement=we;exports.compose=q;exports.composeAsync=H;exports.composeK=Y;exports.composeT=ur;exports.concat=Sn;exports.concatStr=jr;exports.cond=Pe;exports.countBy=qn;exports.curry=N;exports.curryN=L;exports.dec=mr;exports.defaultTo=Ie;exports.dissoc=ee;exports.dissocPath=re;exports.divide=fr;exports.drop=cn;exports.dropLast=ln;exports.dropT=or;exports.dropWhile=fn;exports.either=he;exports.endsWith=Pr;exports.entries=fe;exports.equals=x;exports.every=Vn;exports.evolve=ae;exports.extend=se;exports.filter=Q;exports.filterAsync=Ze;exports.filterT=rr;exports.find=pn;exports.findIndex=yn;exports.findLast=mn;exports.flatten=K;exports.floor=Rr;exports.fromEntries=Te;exports.groupBy=Cn;exports.gt=ye;exports.gte=me;exports.head=en;exports.identical=pe;exports.identity=v;exports.ifElse=Se;exports.inc=yr;exports.includes=bn;exports.indexBy=$n;exports.indexOf=xn;exports.init=on;exports.into=ar;exports.is=Le;exports.isEmpty=B;exports.isNil=Oe;exports.isNotEmpty=We;exports.isNotNil=_e;exports.isPlaceholder=c;exports.join=Sr;exports.keys=ce;exports.last=tn;exports.length=jn;exports.lens=Me;exports.lensIndex=$e;exports.lensPath=He;exports.lensProp=ze;exports.letIn=G;exports.lt=xe;exports.lte=be;exports.map=J;exports.mapAsync=Qe;exports.mapSerial=Xe;exports.mapT=er;exports.match=Er;exports.max=In;exports.mean=On;exports.median=_n;exports.merge=ue;exports.mergeDeep=ie;exports.min=Wn;exports.modulo=Tr;exports.multiply=lr;exports.negate=pr;exports.none=Dn;exports.not=ge;exports.nth=un;exports.omit=oe;exports.or=ke;exports.over=Je;exports.padEnd=Dr;exports.padStart=Vr;exports.partial=O;exports.partialRight=_;exports.partition=zn;exports.path=f;exports.pathEq=Ve;exports.pathOr=Jn;exports.pathSatisfies=De;exports.pick=te;exports.pipe=W;exports.pipeAsync=z;exports.pipeBuilder=I;exports.pipeK=$;exports.pipeWith=M;exports.pluck=Xn;exports.pow=Ar;exports.prepend=Bn;exports.product=Ln;exports.prop=Yn;exports.propEq=Ee;exports.propOr=Gn;exports.propSatisfies=Fe;exports.props=Qn;exports.range=Mn;exports.reduce=Z;exports.reduceAsync=nr;exports.reduceRight=nn;exports.reject=X;exports.replace=Kr;exports.reverse=Un;exports.round=gr;exports.set=Ge;exports.slice=Tn;exports.some=Fn;exports.sort=hn;exports.sortBy=wn;exports.split=Cr;exports.splitEvery=Hn;exports.startsWith=Br;exports.substring=Fr;exports.subtract=cr;exports.sum=Nn;exports.tail=rn;exports.take=an;exports.takeLast=dn;exports.takeT=tr;exports.takeWhile=sn;exports.tap=j;exports.test=vr;exports.toArray=_r;exports.toBoolean=Or;exports.toLower=wr;exports.toNumber=Lr;exports.toObject=Wr;exports.toString=Nr;exports.toUpper=hr;exports.transduce=ir;exports.trim=Ur;exports.tryCatch=ve;exports.type=Ir;exports.uniq=kn;exports.uniqBy=An;exports.unless=Be;exports.unnest=gn;exports.values=le;exports.view=Ye;exports.when=Ke;exports.where=je;exports.whereEq=Ne;exports.zip=Pn;exports.zipObj=En;exports.zipWith=vn;
|