fp-pack 0.13.0 → 0.14.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.
Files changed (64) hide show
  1. package/README.md +42 -26
  2. package/dist/ai-addons/fp-pack-agent-addon.md +112 -97
  3. package/dist/fp-pack.umd.js +1 -1
  4. package/dist/fp-pack.umd.js.map +1 -1
  5. package/dist/implement/array/every.d.ts +4 -2
  6. package/dist/implement/array/every.d.ts.map +1 -1
  7. package/dist/implement/array/every.mjs.map +1 -1
  8. package/dist/implement/array/filter.d.ts +2 -0
  9. package/dist/implement/array/filter.d.ts.map +1 -1
  10. package/dist/implement/array/filter.mjs.map +1 -1
  11. package/dist/implement/array/some.d.ts +2 -0
  12. package/dist/implement/array/some.d.ts.map +1 -1
  13. package/dist/implement/array/some.mjs.map +1 -1
  14. package/dist/implement/async/pipeAsyncStrict.d.ts +4 -1
  15. package/dist/implement/async/pipeAsyncStrict.d.ts.map +1 -1
  16. package/dist/implement/async/pipeAsyncStrict.mjs +12 -10
  17. package/dist/implement/async/pipeAsyncStrict.mjs.map +1 -1
  18. package/dist/implement/composition/pipe.type-test.d.ts +92 -0
  19. package/dist/implement/composition/pipe.type-test.d.ts.map +1 -1
  20. package/dist/implement/composition/pipe.util.array.type-test.d.ts +16 -0
  21. package/dist/implement/composition/pipe.util.array.type-test.d.ts.map +1 -1
  22. package/dist/implement/composition/pipe.util.async.type-test.d.ts +30 -0
  23. package/dist/implement/composition/pipe.util.async.type-test.d.ts.map +1 -1
  24. package/dist/implement/composition/pipe.util.stream.type-test.d.ts +69 -0
  25. package/dist/implement/composition/pipe.util.stream.type-test.d.ts.map +1 -0
  26. package/dist/implement/composition/pipe.util.string-equality.type-test.d.ts +9 -0
  27. package/dist/implement/composition/pipe.util.string-equality.type-test.d.ts.map +1 -1
  28. package/dist/implement/composition/pipe.util.type-test.d.ts +73 -0
  29. package/dist/implement/composition/pipe.util.type-test.d.ts.map +1 -1
  30. package/dist/implement/composition/pipeStrict.d.ts +4 -1
  31. package/dist/implement/composition/pipeStrict.d.ts.map +1 -1
  32. package/dist/implement/composition/pipeStrict.mjs +9 -7
  33. package/dist/implement/composition/pipeStrict.mjs.map +1 -1
  34. package/dist/implement/composition/pipeWithDeps.d.ts +13 -3
  35. package/dist/implement/composition/pipeWithDeps.d.ts.map +1 -1
  36. package/dist/implement/composition/pipeWithDeps.mjs.map +1 -1
  37. package/dist/implement/composition/pipeWithDeps.type-test.d.ts +31 -0
  38. package/dist/implement/composition/pipeWithDeps.type-test.d.ts.map +1 -1
  39. package/dist/implement/composition/runPipeResult.type-test.d.ts +6 -0
  40. package/dist/implement/composition/runPipeResult.type-test.d.ts.map +1 -1
  41. package/dist/skills/fp-pack/SKILL.md +7 -1
  42. package/dist/skills/fp-pack/constraints/common-mistakes.md +44 -0
  43. package/dist/skills/fp-pack/constraints/core-rules.md +22 -0
  44. package/dist/skills/fp-pack/constraints/troubleshooting.md +14 -0
  45. package/dist/skills/fp-pack/examples/quick-examples.md +44 -0
  46. package/dist/skills/fp-pack/reference/composition.md +27 -0
  47. package/dist/skills/fp-pack/reference/currying-data-last.md +5 -0
  48. package/dist/skills/fp-pack/reference/typescript-inference.md +29 -0
  49. package/package.json +1 -1
  50. package/src/implement/array/every.ts +4 -2
  51. package/src/implement/array/filter.ts +2 -0
  52. package/src/implement/array/some.ts +2 -0
  53. package/src/implement/async/pipeAsyncStrict.ts +4 -1
  54. package/src/implement/composition/pipe.type-test.ts +423 -0
  55. package/src/implement/composition/pipe.util.array.type-test.ts +48 -0
  56. package/src/implement/composition/pipe.util.async.type-test.ts +49 -0
  57. package/src/implement/composition/pipe.util.stream.type-test.ts +233 -0
  58. package/src/implement/composition/pipe.util.string-equality.type-test.ts +34 -0
  59. package/src/implement/composition/pipe.util.type-test.ts +260 -3
  60. package/src/implement/composition/pipeStrict.ts +4 -1
  61. package/src/implement/composition/pipeWithDeps.ts +33 -3
  62. package/src/implement/composition/pipeWithDeps.type-test.ts +83 -0
  63. package/src/implement/composition/runPipeResult.type-test.ts +20 -1
  64. package/dist/skills/fp-pack.md +0 -430
package/README.md CHANGED
@@ -6,20 +6,17 @@
6
6
  **A practical functional toolkit for JavaScript and TypeScript.**
7
7
  </div>
8
8
 
9
- Written in TypeScript with full type safety, fp-pack works seamlessly in both JavaScript and TypeScript projects.
9
+ The core philosophy of `fp-pack` is simple: **if you know functions, pipes, and currying, you're ready to use it.** It's a pipe-first toolkit for everyday code—approachable, zero-deps, and tree-shakeable.
10
10
 
11
- fp-pack is a focused collection of functional programming utilities designed for real-world applications.
12
- It emphasizes **function composition, immutability, and declarative code** through `pipe` and `pipeAsync`, while remaining approachable for everyday developers.
11
+ **No complex monads. No wrapper ceremony.** Just plain functions that compose naturally, with an optional `SideEffect` pattern for early exits and error handling.
13
12
 
14
- The concept is simple: if you understand functions, pipes, and currying, you can use fp-pack immediately.
13
+ At a glance:
14
+ - **Composition-first** APIs centered around `pipe` / `pipeAsync`.
15
+ - **TypeScript-native** utilities with strong inference (pipelines often work without manual type annotations).
16
+ - **SideEffect pattern** for early exits and error handling — write normal functions, mark exceptional paths with `SideEffect.of()`, and let the pipeline handle the rest. No monad wrappers required.
15
17
 
16
- There's no framework and no heavy abstractions—just well-chosen helpers that make functional style easier to adopt and maintain in production code.
18
+ If you want functional composition without a lot of ceremony, `fp-pack` is designed to be a practical starting point that still scales to larger codebases.
17
19
 
18
- ---
19
-
20
- > **⚠️ Project Status**
21
- >
22
- > fp-pack is actively evolving as we refine its functional patterns in TypeScript. The core API is stable enough for daily use, but some edges may change as we improve the design.
23
20
 
24
21
  ---
25
22
 
@@ -95,8 +92,20 @@ There's no framework and no heavy abstractions—just well-chosen helpers that m
95
92
  - **Pipe-centric composition**
96
93
  `pipe` (sync) and `pipeAsync` (async) are the primary composition tools. All utilities are designed to work seamlessly in pipe chains.
97
94
 
95
+ - **DX-optimized type inference**
96
+ **"Don't let strictness hinder inference."** fp-pack's standard `pipe` prioritizes **global type stability** over local constraints at connection points. The inference chain, designed without `NoInfer`, lets TypeScript derive perfect result types at the end of your pipeline—even without manual annotations. This **"Global Stability"** approach means you write less, TypeScript infers more, and your pipelines just work.
97
+
98
+ Works best in value-first pipelines where the input anchors generics. Function-first or from-start pipelines may need `pipeHint` or a small wrapper.
99
+
100
+ When users inappropriately use explicit type annotations, TypeScript's natural inference benefits are reduced, and in some edge cases intermediate type mismatches may be allowed to keep the pipeline flowing. When you need stricter mismatch detection, use `pipeStrict`/`pipeAsyncStrict`; for maximum inference power with minimal friction, stick to `pipe`/`pipeAsync`. → **[Pipe Choice Guide](https://superlucky84.github.io/fp-pack/#/ko/guide/pipe-choice-guide)**
101
+
98
102
  - **Pragmatic error handling**
99
- The `SideEffect` pattern handles errors and side effects declaratively in `pipeSideEffect`/`pipeAsyncSideEffect` pipelines. Write normal functions that compose naturally—these pipelines automatically short-circuit when they encounter a `SideEffect`, eliminating the need for wrapper types everywhere. For strict union typing across branches, use `pipeSideEffectStrict` / `pipeAsyncSideEffectStrict`. Use `runPipeResult`/`matchSideEffect` **outside** the pipeline. If the input is narrowed to `SideEffect<R>` (e.g. after `isSideEffect`), `runPipeResult` returns `R`. If the result type is widened (e.g. `SideEffect<any>`), provide generics to recover a safe union. Use `isSideEffect` for precise runtime narrowing.
103
+ The `SideEffect` pattern handles errors declaratively in `pipeSideEffect`/`pipeAsyncSideEffect` and short-circuits on `SideEffect`, so you can keep normal functions.
104
+ For strict union typing across branches, use `pipeSideEffectStrict` / `pipeAsyncSideEffectStrict`.
105
+
106
+ **Usage notes:**
107
+ - Call `runPipeResult`/`matchSideEffect` **outside** the pipeline.
108
+ - After `isSideEffect`, `runPipeResult` returns the effect type; if widened (e.g. `SideEffect<any>`), pass generics to recover a safe union.
100
109
 
101
110
  - **Immutable & Pure by default**
102
111
  Core utilities avoid mutations and side effects. Any exception is explicitly named (e.g. `tap`, `log`).
@@ -157,9 +166,9 @@ yarn add fp-pack
157
166
 
158
167
  ## AI Agent Skills (Optional)
159
168
 
160
- fp-pack includes an AI agent skills file that helps AI coding assistants (Claude Code, GitHub Copilot, Cursor, etc.) automatically write fp-pack-style functional code.
169
+ fp-pack includes an AI agent skills package that helps AI coding assistants (Claude Code, GitHub Copilot, Cursor, etc.) automatically write fp-pack-style functional code.
161
170
 
162
- When you have this skills file in your project, AI assistants will:
171
+ When you have this skills package in your project, AI assistants will:
163
172
  - Default to using `pipe`/`pipeAsync` for pure transformations, and `pipeSideEffect`/`pipeAsyncSideEffect` when SideEffect is involved (use strict variants when you need strict effect unions)
164
173
  - Use the `SideEffect` pattern instead of try-catch
165
174
  - Prefer `stream/*` functions for large datasets
@@ -167,20 +176,24 @@ When you have this skills file in your project, AI assistants will:
167
176
 
168
177
  ### Setup for Claude Code
169
178
 
170
- Copy the skills file to your project's `.claude/skills/` directory:
179
+ Copy the skills folder to your project's `.claude/skills/` directory:
171
180
 
172
181
  ```bash
173
182
  # Unix/macOS/Linux
174
- cp node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
183
+ mkdir -p .claude/skills/fp-pack
184
+ cp -R node_modules/fp-pack/dist/skills/fp-pack/* .claude/skills/fp-pack/
175
185
 
176
186
  # Windows (PowerShell)
177
- Copy-Item node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
187
+ New-Item -ItemType Directory -Force -Path .claude/skills/fp-pack
188
+ Copy-Item node_modules/fp-pack/dist/skills/fp-pack/* .claude/skills/fp-pack -Recurse
178
189
 
179
190
  # Or manually create the directory and copy
180
- mkdir -p .claude/skills
181
- cp node_modules/fp-pack/dist/skills/fp-pack.md .claude/skills/
191
+ mkdir -p .claude/skills/fp-pack
192
+ cp -R node_modules/fp-pack/dist/skills/fp-pack/* .claude/skills/fp-pack/
182
193
  ```
183
194
 
195
+ If your tool expects a single file, point it to `.claude/skills/fp-pack/SKILL.md` or link that file to `.claude/skills/fp-pack.md`.
196
+
184
197
  ### Setup for Codex
185
198
 
186
199
  Copy the Codex skill to your project's `$CODEX_HOME/skills/` directory (default: `~/.codex/skills`):
@@ -188,22 +201,22 @@ Copy the Codex skill to your project's `$CODEX_HOME/skills/` directory (default:
188
201
  ```bash
189
202
  # Unix/macOS/Linux
190
203
  mkdir -p ~/.codex/skills/fp-pack
191
- cp node_modules/fp-pack/dist/skills/fp-pack/SKILL.md ~/.codex/skills/fp-pack/SKILL.md
204
+ cp -R node_modules/fp-pack/dist/skills/fp-pack/* ~/.codex/skills/fp-pack/
192
205
 
193
206
  # Windows (PowerShell)
194
207
  New-Item -ItemType Directory -Force -Path "$HOME/.codex/skills/fp-pack"
195
- Copy-Item node_modules/fp-pack/dist/skills/fp-pack/SKILL.md $HOME/.codex/skills/fp-pack/SKILL.md
208
+ Copy-Item node_modules/fp-pack/dist/skills/fp-pack/* $HOME/.codex/skills/fp-pack -Recurse
196
209
  ```
197
210
 
198
211
  Once configured, AI assistants will automatically apply fp-pack coding patterns when helping you write code.
199
212
 
200
- > **Note:** The skills file is located at `node_modules/fp-pack/dist/skills/fp-pack.md` after installation. You can also view it in the [GitHub repository](https://github.com/superlucky84/fp-pack/blob/main/fp-pack.md).
213
+ > **Note:** The skills package is located at `node_modules/fp-pack/dist/skills/fp-pack/` after installation (includes `SKILL.md`, `examples/`, `reference/`, and `constraints/`). You can also view `SKILL.md` in the [GitHub repository](https://github.com/superlucky84/fp-pack/blob/main/skills/fp-pack/SKILL.md).
201
214
 
202
215
  ### AI Agent Role Add-on (Global)
203
216
 
204
217
  For agents with system prompt support (OpenCode, custom agents), fp-pack provides a **reusable behavior module** that conditionally enforces fp-pack patterns when fp-pack is detected in the project.
205
218
 
206
- Unlike skills files which are project-specific, this add-on is attached directly to your agent's system prompt, making it work across all your projects. It automatically activates only when fp-pack is installed.
219
+ Unlike skills packages which are project-specific, this add-on is attached directly to your agent's system prompt, making it work across all your projects. It automatically activates only when fp-pack is installed.
207
220
 
208
221
  📖 **[View AI Agent Role Add-on Documentation](https://superlucky84.github.io/fp-pack/#/ai-agent-addon)**
209
222
 
@@ -664,9 +677,9 @@ Provide generics when inference is lost; prefer `isSideEffect` for precise narro
664
677
  Most data transformations are pure and don't need SideEffect handling. Use `pipe` for sync operations and `pipeAsync` for async operations. **Only switch to SideEffect-aware pipes when you actually need** early termination or error handling with side effects.
665
678
 
666
679
  **Pure Pipelines:**
667
- - **`pipe`** - Synchronous, **pure** transformations (99% of cases)
668
- - **`pipeStrict`** - Sync pipe with stricter type checking (catches mismatches earlier)
669
- - **`pipeAsync`** - Async, **pure** transformations (99% of cases)
680
+ - **`pipe`** - Synchronous, **pure** transformations (99% of cases) - **DX-optimized** for global type inference
681
+ - **`pipeStrict`** - Sync pipe with stricter type checking (catches mismatches earlier at connection points)
682
+ - **`pipeAsync`** - Async, **pure** transformations (99% of cases) - **DX-optimized** for global type inference
670
683
  - **`pipeAsyncStrict`** - Async pipe with stricter type checking
671
684
 
672
685
  **SideEffect-Aware Pipelines:**
@@ -675,7 +688,9 @@ Most data transformations are pure and don't need SideEffect handling. Use `pipe
675
688
  - **`pipeAsyncSideEffect`** - **Only when you need** SideEffect short-circuiting (async)
676
689
  - **`pipeAsyncSideEffectStrict`** - Async SideEffect pipelines with strict effect unions
677
690
 
678
- **Important:** `pipe` and `pipeAsync` are for **pure** functions only—they don't handle `SideEffect`. If your pipeline can return `SideEffect`, use `pipeSideEffect` or `pipeAsyncSideEffect` instead. Choose the strict variants (`pipeStrict`, `pipeAsyncStrict`, `pipeSideEffectStrict`, `pipeAsyncSideEffectStrict`) when you need stricter type checking or precise unions for SideEffect results.
691
+ **Important:**
692
+ - `pipe` and `pipeAsync` are for **pure** functions only—they don't handle `SideEffect`. If your pipeline can return `SideEffect`, use `pipeSideEffect` or `pipeAsyncSideEffect` instead.
693
+ - **Inference vs Strictness trade-off**: Standard `pipe`/`pipeAsync` prioritize **global type stability** (TypeScript infers the final result perfectly without manual annotations). Strict variants (`pipeStrict`, `pipeAsyncStrict`) catch type mismatches earlier but may require more type hints. Choose based on your needs: maximum inference power (standard) vs early error detection (strict).
679
694
 
680
695
  ```typescript
681
696
  // Pure sync pipe - no SideEffect handling
@@ -814,6 +829,7 @@ fp-pack draws inspiration from excellent functional programming libraries in the
814
829
  - **[Ramda](https://ramdajs.com/)** - A practical functional library that pioneered many of the patterns we use today
815
830
  - **[Remeda](https://remedajs.com/)** - Strongly influential TypeScript-first utility patterns and ergonomics
816
831
  - **[lodash/fp](https://lodash.com/docs/4.17.15#fp)** - Data-last, auto-curried utility style for functional composition
832
+ - **[fp-ts](https://gcanti.github.io/fp-ts/)** - Advanced functional abstractions (e.g. Reader patterns) that influenced parts of this project
817
833
  - **[Rambda](https://github.com/selfrefactor/rambda)** - Lightweight Ramda-inspired functional utilities
818
834
  - **[FxJS](https://github.com/marpple/FxJS)** and **[FxTS](https://github.com/marpple/FxTS)** - Inspired by their exceptional combination of lazy evaluation and functional tooling patterns
819
835
 
@@ -1,10 +1,10 @@
1
1
  # fp-pack Agent Role Add-on
2
2
 
3
- Document Version: 0.13.0
3
+ Document Version: 0.14.0
4
4
 
5
5
  ## What This Document Is
6
6
 
7
- This document is a **reusable Agent Role Add-on** designed to enforce fp-pack functional programming patterns in AI coding agents.
7
+ This document is a **reusable Agent Role Add-on** designed to guide fp-pack functional programming patterns in AI coding agents.
8
8
 
9
9
  This is not:
10
10
  - A human-readable tutorial
@@ -16,7 +16,7 @@ This is:
16
16
  - A self-contained behavior module
17
17
  - Copy-paste ready instructions for agent system prompts
18
18
  - A composable extension that modifies existing agent roles
19
- - A conditional enforcer that activates only when fp-pack is detected
19
+ - A conditional guide that activates only when fp-pack is detected
20
20
 
21
21
  This add-on transforms any general-purpose coding agent into one that prioritizes fp-pack's declarative, functional composition patterns **when fp-pack is installed in the project**. No external documentation is required—all necessary context is embedded within this document.
22
22
 
@@ -24,7 +24,7 @@ This add-on transforms any general-purpose coding agent into one that prioritize
24
24
 
25
25
  **Attach this add-on to your agent when:**
26
26
  - You work across multiple projects, some using fp-pack and others not
27
- - You want automatic pattern enforcement when fp-pack is detected
27
+ - You want automatic pattern guidance when fp-pack is detected
28
28
  - Your team adopts fp-pack selectively per project
29
29
  - You need a single agent configuration that adapts to project context
30
30
 
@@ -32,7 +32,7 @@ This add-on transforms any general-purpose coding agent into one that prioritize
32
32
 
33
33
  The agent will:
34
34
  - Detect fp-pack presence via `package.json` or `node_modules`
35
- - Enforce fp-pack patterns only in projects with fp-pack installed
35
+ - Suggest fp-pack patterns only in projects with fp-pack installed
36
36
  - Use standard coding practices in projects without fp-pack
37
37
  - Never suggest installing fp-pack unless explicitly requested
38
38
 
@@ -44,77 +44,78 @@ The agent will:
44
44
  ## fp-pack Coding Behavior (Copy-Paste Block)
45
45
 
46
46
  ```
47
- You are a coding agent with fp-pack functional programming enforcement enabled.
47
+ You are a coding agent with fp-pack functional programming guidance enabled.
48
48
 
49
49
  ACTIVATION CONDITIONS:
50
50
 
51
- These constraints apply ONLY when fp-pack is installed in the current project.
51
+ These guidelines apply ONLY when fp-pack is installed in the current project.
52
52
 
53
- Before enforcing fp-pack patterns, verify fp-pack availability:
53
+ Before suggesting fp-pack patterns, verify fp-pack availability:
54
54
  1. Check if `package.json` contains fp-pack in dependencies or devDependencies
55
55
  2. Check if `node_modules/fp-pack` directory exists
56
56
  3. Check if fp-pack imports are present in existing code
57
57
 
58
58
  If fp-pack is NOT installed:
59
- - Do not enforce these constraints
59
+ - Do not enforce these guidelines
60
60
  - Use standard coding practices appropriate for the project
61
61
  - Never suggest installing fp-pack unless explicitly requested
62
62
 
63
63
  If fp-pack IS installed:
64
- - Enforce all constraints below strictly
65
- - Refuse code that violates these patterns
66
- - Suggest fp-pack alternatives for all imperative code
64
+ - Apply all guidelines below
65
+ - Suggest fp-pack alternatives for imperative code
66
+ - Prioritize composition patterns for clarity and reuse
67
67
 
68
- BEHAVIORAL CONSTRAINTS:
68
+ CODING GUIDELINES:
69
69
 
70
70
  1. COMPOSITION PRIORITY
71
- - Use `pipe` for all synchronous data transformations
72
- - Use `pipeAsync` for all asynchronous operations
73
- - Never write imperative loops (for, while, forEach)
74
- - Never chain native array methods (.map().filter().slice())
75
- - All data flow must be expressed through function composition
76
-
77
- 2. MUTATION PROHIBITION
78
- - Never mutate objects or arrays
79
- - Never use assignment operators on existing data structures
80
- - Never modify function parameters
81
- - All updates must create new immutable values
82
-
83
- 3. OBJECT-ORIENTED PATTERN PROHIBITION
84
- - Never create classes for business logic
85
- - Never use inheritance hierarchies
86
- - Never implement OOP design patterns (Factory, Strategy, etc.)
87
- - Prefer function composition over object methods
88
-
89
- 4. DECLARATIVE CONTROL FLOW
90
- - Use `ifElse` instead of if/else statements
91
- - Use `when`/`unless` for conditional execution
92
- - Use `cond` instead of switch statements
93
- - All branching logic must remain within pipe chains
94
-
95
- 5. SIDE EFFECT HANDLING
96
- - Use `pipeSideEffect` / `pipeAsyncSideEffect` for early termination patterns
97
- - Use `pipeSideEffectStrict` / `pipeAsyncSideEffectStrict` for strict type unions
71
+ - Use `pipe` / `pipeAsync` for 2+ step transformations
72
+ - For single steps, call the function directly (no pipe needed)
73
+ - Prefer value-first: `pipe(value, ...)` for better type inference
74
+ - Use function-first only for reusable pipelines
75
+ - For trivial one-liners, native JS is acceptable when it's clearer
76
+
77
+ 2. IMMUTABILITY
78
+ - Prefer immutable operations over mutation
79
+ - Use fp-pack's object/array utilities for updates
80
+ - Return new values instead of modifying parameters
81
+ - Suggest immutable alternatives when mutation is detected
82
+
83
+ 3. DECLARATIVE PATTERNS
84
+ - Prefer `ifElse`, `when`, `unless`, `cond` for control flow within pipelines
85
+ - Simple if/else outside pipelines is acceptable
86
+ - Suggest functional control flow when complexity grows
87
+ - Keep branching logic within pipe chains when possible
88
+
89
+ 4. SIDE EFFECT HANDLING
90
+ - Use `pipeSideEffect*` / `pipeAsyncSideEffect*` for early termination
91
+ - Prefer `pipeSideEffectStrict` / `pipeAsyncSideEffectStrict` for strict unions
98
92
  - Wrap side effects in `SideEffect.of()`
99
- - Call `runPipeResult` OUTSIDE pipelines for execution
100
- - Never use try-catch within pipelines (use SideEffect pattern)
93
+ - Call `runPipeResult` OUTSIDE pipelines
94
+ - Use `isSideEffect` for precise type narrowing
95
+ - Try-catch outside pipelines is acceptable; inside pipelines prefer SideEffect
101
96
 
102
- 6. LAZY EVALUATION FOR LARGE DATA
103
- - Use `stream/*` functions for processing large datasets
104
- - Never materialize entire datasets when lazy evaluation is possible
97
+ 5. LAZY EVALUATION FOR LARGE DATA
98
+ - Use `fp-pack/stream` functions for large/unbounded datasets
105
99
  - Prefer `toArray` only when final materialization is required
100
+ - Suggest stream utilities when processing efficiency matters
106
101
 
107
- 7. ERROR HANDLING
108
- - Errors and exceptional paths must use SideEffect pattern
109
- - Never throw exceptions within pipe chains
102
+ 6. ERROR HANDLING
103
+ - Use SideEffect pattern for errors within pipelines
104
+ - Traditional try-catch is acceptable at boundaries/outside pipelines
110
105
  - Use `isSideEffect` for type-safe error branching
111
106
  - Call `runPipeResult` or `matchSideEffect` outside pipelines
112
107
 
113
- 8. CODE REJECTION POLICY
114
- - Refuse to write imperative loops
115
- - Refuse to implement class-based solutions
116
- - Refuse to mutate data structures
117
- - Suggest fp-pack alternatives when requested patterns violate constraints
108
+ 7. PRACTICAL BALANCE
109
+ - Reach for fp-pack when composition adds clarity or reuse
110
+ - Simple imperative code is fine for trivial cases
111
+ - Don't force fp-pack patterns when they reduce readability
112
+ - Suggest refactoring when imperative code becomes complex
113
+
114
+ 8. SUGGESTION POLICY
115
+ - Suggest fp-pack alternatives for imperative patterns
116
+ - Explain benefits of functional approach
117
+ - Provide both imperative and fp-pack solutions when appropriate
118
+ - Respect user preferences if they choose imperative style
118
119
 
119
120
  IMPORT PATHS:
120
121
  - Core functions: `import { pipe, map, filter } from 'fp-pack'`
@@ -122,28 +123,24 @@ IMPORT PATHS:
122
123
  - SideEffect pattern: `import { pipeSideEffect, pipeSideEffectStrict, SideEffect, isSideEffect, runPipeResult } from 'fp-pack'`
123
124
  - Stream functions: `import { map, filter, toArray } from 'fp-pack/stream'`
124
125
 
125
- ENFORCEMENT:
126
- When user requests violate these constraints, respond with:
127
- 1. Explanation of why the request violates fp-pack principles
128
- 2. Alternative solution using fp-pack patterns
129
- 3. Code example demonstrating the fp-pack approach
126
+ GUIDANCE APPROACH:
127
+ When user requests could benefit from fp-pack patterns:
128
+ 1. Provide solution using fp-pack patterns
129
+ 2. Explain advantages of the functional approach
130
+ 3. If user prefers imperative style, respect their choice
130
131
 
131
- When existing code violates these constraints, either:
132
- 1. Refactor to fp-pack patterns automatically
133
- 2. Warn about violations and suggest refactoring
132
+ When existing code could be improved with fp-pack:
133
+ 1. Suggest fp-pack refactoring when it adds clarity
134
+ 2. Explain the benefits of the proposed changes
135
+ 3. Don't force refactoring for trivial improvements
134
136
 
135
137
  REFERENCE MATERIALS (NOT PART OF BEHAVIORAL RULES):
136
138
 
137
- This document is the **sole authoritative specification** for fp-pack-first coding behavior.
138
-
139
- If you need detailed usage examples, API patterns, or additional explanations
140
- for human readers, the following reference material may exist:
141
-
142
- node_modules/fp-pack/dist/skills/fp-pack.md
139
+ For detailed guidance on fp-pack patterns and usage, refer to:
140
+ node_modules/fp-pack/dist/skills/fp-pack/
143
141
 
144
- This reference material is **optional**. Agents must follow the behavioral
145
- constraints defined in this document regardless of whether external
146
- documentation exists or is accessible.
142
+ This reference material provides comprehensive examples, troubleshooting tips,
143
+ and pattern guidance that complements the behavioral guidelines above.
147
144
  ```
148
145
 
149
146
  ## Minimal fp-pack Interface Context
@@ -151,8 +148,10 @@ documentation exists or is accessible.
151
148
  This section provides minimal context to help agents locate and use fp-pack functions without becoming an API reference.
152
149
 
153
150
  ### Core Composition
154
- - **pipe** - Left-to-right synchronous composition
151
+ - **pipe** - Left-to-right synchronous composition (use for 2+ steps)
152
+ - **pipeStrict** - Stricter type checking between steps
155
153
  - **pipeAsync** - Left-to-right asynchronous composition
154
+ - **pipeAsyncStrict** - Async with stricter type checking
156
155
  - **pipeSideEffect** - Composition with early termination (non-strict unions)
157
156
  - **pipeSideEffectStrict** - Composition with early termination (strict unions)
158
157
  - **pipeAsyncSideEffect** - Async composition with early termination (non-strict unions)
@@ -163,11 +162,12 @@ Available in `fp-pack`:
163
162
  - Array operations: `map`, `filter`, `reduce`, `take`, `drop`, `chunk`, `flatten`, `flatMap`, `sort`, `sortBy`, `groupBy`, `uniq`, `zip`
164
163
  - Object operations: `prop`, `pick`, `omit`, `assoc`, `merge`, `mapValues`, `evolve`, `path`
165
164
  - Control flow: `ifElse`, `when`, `unless`, `cond`
165
+ - Utilities: `from`, `tap`, `tap0`, `curry`, `compose`
166
166
 
167
167
  ### SideEffect Pattern
168
168
  Available in `fp-pack`:
169
169
  - `SideEffect.of(fn, label?)` - Create side effect container
170
- - `isSideEffect(value)` - Runtime type guard
170
+ - `isSideEffect(value)` - Runtime type guard (prefer for precise narrowing)
171
171
  - `runPipeResult(result)` - Execute side effect or return value (call OUTSIDE pipelines)
172
172
  - `matchSideEffect(result, handlers)` - Pattern match on result
173
173
 
@@ -181,6 +181,7 @@ Available in `fp-pack/stream`:
181
181
  Some data-last functions require explicit type hints in pipelines:
182
182
  - Use `pipeHint<Input, Output>(fn)` for type annotation
183
183
  - Affected functions: `chunk`, `drop`, `take`, `zip`, `prop`, `pick`, `omit`, `path`, `timeout`
184
+ - Prefer value-first `pipe(value, ...)` to anchor types and avoid hints
184
185
 
185
186
  ## How to Attach This Add-on
186
187
 
@@ -198,10 +199,10 @@ Insert the "fp-pack Coding Behavior" block into your agent's system prompt:
198
199
  [your agent capabilities]...
199
200
  </capabilities>
200
201
 
201
- <!-- INSERT fp-pack BEHAVIORAL CONSTRAINTS HERE -->
202
- <coding-constraints>
202
+ <!-- INSERT fp-pack BEHAVIORAL GUIDELINES HERE -->
203
+ <coding-guidelines>
203
204
  [Copy the entire "fp-pack Coding Behavior (Copy-Paste Block)" section here]
204
- </coding-constraints>
205
+ </coding-guidelines>
205
206
 
206
207
  <workflow>
207
208
  [your agent workflow]...
@@ -211,7 +212,7 @@ Insert the "fp-pack Coding Behavior" block into your agent's system prompt:
211
212
 
212
213
  ### Configuration Files
213
214
 
214
- For agent configuration files (YAML, JSON, etc.), adapt the constraints to the format:
215
+ For agent configuration files (YAML, JSON, etc.), adapt the guidelines to the format:
215
216
 
216
217
  ```yaml
217
218
  agent:
@@ -219,7 +220,7 @@ agent:
219
220
  extensions:
220
221
  - type: "fp-pack-addon"
221
222
  content: |
222
- [Paste fp-pack Coding Behavior constraints here]
223
+ [Paste fp-pack Coding Behavior guidelines here]
223
224
  ```
224
225
 
225
226
  ### Multiple Add-ons
@@ -229,9 +230,9 @@ This add-on composes with other role extensions:
229
230
  ```
230
231
  <agent-role>
231
232
  <base-role>Your agent identity</base-role>
232
- <extension name="fp-pack-addon">[fp-pack constraints]</extension>
233
- <extension name="security-addon">[security constraints]</extension>
234
- <extension name="testing-addon">[testing constraints]</extension>
233
+ <extension name="fp-pack-addon">[fp-pack guidelines]</extension>
234
+ <extension name="security-addon">[security guidelines]</extension>
235
+ <extension name="testing-addon">[testing guidelines]</extension>
235
236
  </agent-role>
236
237
  ```
237
238
 
@@ -243,35 +244,49 @@ This document is structured as an add-on rather than a complete agent definition
243
244
 
244
245
  1. **Role Personalization**: Different teams have different agent personalities, capabilities, and workflows. A complete agent specification would impose unnecessary constraints on these preferences.
245
246
 
246
- 2. **Composition Over Prescription**: Agent roles should be composable. This add-on focuses solely on enforcing fp-pack coding patterns, allowing users to combine it with other behavioral extensions (testing strategies, security policies, documentation standards).
247
+ 2. **Composition Over Prescription**: Agent roles should be composable. This add-on focuses solely on guiding fp-pack coding patterns, allowing users to combine it with other behavioral extensions (testing strategies, security policies, documentation standards).
247
248
 
248
249
  3. **Framework Agnostic**: Complete agent definitions often include framework-specific instructions or tool configurations. This add-on remains purely focused on coding behavior, independent of execution environment.
249
250
 
250
- 4. **Maintenance Simplicity**: Behavioral constraints change less frequently than tool configurations or framework integrations. Separating concerns allows independent versioning and updates.
251
+ 4. **Maintenance Simplicity**: Behavioral guidelines change less frequently than tool configurations or framework integrations. Separating concerns allows independent versioning and updates.
251
252
 
252
- 5. **Reusability Across Platforms**: Different AI platforms (OpenCode, custom agents, IDE extensions) have different configuration formats. A standalone behavioral module adapts more easily than a complete agent specification.
253
+ 5. **Reusability Across Platforms**: Different AI platforms (Claude Code, custom agents, IDE extensions) have different configuration formats. A standalone behavioral module adapts more easily than a complete agent specification.
253
254
 
254
- ### Enforcement vs. Suggestion
255
+ ### Guidance vs. Enforcement
255
256
 
256
- This add-on enforces constraints rather than suggesting best practices. The distinction is critical:
257
+ This add-on provides guidance rather than strict enforcement. The distinction is critical:
257
258
 
259
+ - **Guidance**: Agent suggests fp-pack patterns and explains benefits
258
260
  - **Enforcement**: Agent refuses to generate code that violates constraints
259
- - **Suggestion**: Agent generates code and recommends improvements afterward
260
261
 
261
- fp-pack patterns require enforcement because:
262
- - Mixing imperative and functional styles creates inconsistent codebases
263
- - Partial adoption of composition patterns provides minimal benefit
264
- - Refactoring imperative code to functional style is more costly than writing functionally from the start
262
+ fp-pack patterns benefit from guidance because:
263
+ - **Flexibility**: Some situations genuinely benefit from imperative code
264
+ - **Learning curve**: Developers need time to understand functional patterns
265
+ - **Pragmatism**: Trivial one-liners don't always need composition
266
+ - **Context matters**: Not every data transformation requires pipe
267
+
268
+ ### Balanced Approach
269
+
270
+ This add-on follows the fp-pack SKILL.md philosophy:
271
+ - "Use pipe for 2+ steps; for single steps, call the function directly"
272
+ - "For trivial one-liners, using native JS directly is fine"
273
+ - "Reach for fp-pack when composition adds clarity or reuse"
274
+
275
+ **Why balanced over strict?**
276
+ 1. **Readability first**: Functional patterns should enhance, not obscure
277
+ 2. **Respect developer judgment**: Not every imperative pattern is wrong
278
+ 3. **Gradual adoption**: Teams can adopt fp-pack incrementally
279
+ 4. **Avoid dogma**: Pragmatism over purity
265
280
 
266
- ### Selective Enforcement Based on Project Context
281
+ ### Selective Activation Based on Project Context
267
282
 
268
283
  This add-on activates conditionally based on fp-pack installation status:
269
284
 
270
- **Why selective enforcement?**
285
+ **Why selective activation?**
271
286
  1. **Avoid forcing dependencies**: Agents should not impose architectural decisions on projects that haven't adopted fp-pack
272
287
  2. **Respect existing patterns**: Projects without fp-pack likely have established coding conventions that should be honored
273
- 3. **Prevent confusion**: Enforcing fp-pack patterns without fp-pack available creates import errors and confusion
274
- 4. **Enable experimentation**: Teams can evaluate fp-pack by installing it, triggering automatic pattern adoption
288
+ 3. **Prevent confusion**: Suggesting fp-pack patterns without fp-pack available creates import errors and confusion
289
+ 4. **Enable experimentation**: Teams can evaluate fp-pack by installing it, triggering automatic pattern guidance
275
290
 
276
291
  **Detection mechanism:**
277
292
  The agent verifies fp-pack availability through:
@@ -284,9 +299,9 @@ This detection-based activation allows a single agent configuration to work appr
284
299
  ### Design Constraints
285
300
 
286
301
  This add-on intentionally avoids:
287
- - **Complete API coverage**: Full API documentation belongs in separate references
302
+ - **Complete API coverage**: Full API documentation belongs in separate references (skills/fp-pack/ reference files)
288
303
  - **Framework-specific patterns**: UI framework integration belongs in project-specific documentation
289
304
  - **Implementation details**: Internal fp-pack architecture is irrelevant to usage
290
- - **Philosophical arguments**: Functional programming theory is not required to enforce patterns
305
+ - **Absolute prohibitions**: "Never" statements reduce flexibility and pragmatism
291
306
 
292
- The goal is minimal, actionable instructions that modify agent behavior without overwhelming the context window or duplicating external documentation.
307
+ The goal is minimal, actionable guidance that modifies agent behavior without overwhelming the context window or duplicating external documentation.
@@ -1,2 +1,2 @@
1
- (function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.FpPack={}))})(this,(function(u){"use strict";function p(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return i=>r.reduce((c,o)=>o(c),i)}return e.reduce((r,i)=>i(r),t)}function P(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return i=>r.reduce((c,o)=>o(c),i)}return e.reduce((r,i)=>i(r),t)}function T(n){return n}function M(n){return(...t)=>{if(typeof t[0]=="function"){const i=t;return c=>o=>{const s=i.map(l=>(a=>l(a,o)));return n(c,...s)}}const[e,...r]=t;return i=>{const c=r.map(o=>(s=>o(s,i)));return n(e,...c)}}}class d{effect;label;constructor(t,e){this.effect=t,this.label=e}static of(t,e){return new d(t,e)}}function N(n,t){return n instanceof d?t.effect(n):t.value(n)}function v(n){return h(n)?n.effect():n}function h(n){return n instanceof d}function k(...n){const t=(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function z(...n){const t=(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function W(...n){return t=>n.reduceRight((e,r)=>r(e),t)}function f(n,...t){const e=r=>r.length>=n.length?n(...r):(...i)=>e([...r,...i]);return t.length===0?e([]):e(t)}function D(n,...t){return function(...r){const i=[...t,...r];return n.apply(this,i)}}function I(n){return function(...e){const r=[...e].reverse();return n.apply(this,r)}}function _(n,...t){return t.length===0?(...e)=>!n(...e):!n(...t)}function L(n){return n}function C(n){return()=>n}function K(n){const t=e=>n;return Object.defineProperty(t,"__from",{value:!0}),t}function q(n){return t=>(n(t),t)}function B(n){return()=>{n()}}function V(n){let t=!1,e;return function(...i){return t||(t=!0,e=n.apply(this,i)),e}}function F(n){const t=new Map,e=Symbol("result");return function(...i){let c=t;for(const s of i)c.has(s)||c.set(s,new Map),c=c.get(s);if(c.has(e))return c.get(e);const o=n.apply(this,i);return c.set(e,o),o}}function R(n,t,e,r){return n(r)?t(r):e(r)}const $=f(R);function U(n,t,e){return n(e)?t(e):e}const j=f(U);function H(n,t,e){return n(e)?e:t(e)}const G=f(H);function Z(n){return t=>{for(const[e,r]of n)if(e(t))return r(t)}}function J(n,t,e){try{return n(e)}catch(r){const i=r instanceof Error?r:new Error(String(r));return t(i,e)}}const Q=f(J);function X(n,t,e){return n(e)?e:t}const Y=f(X);function x(n,t){return t.map(n)}const nn=f(x);function tn(n,t){return t.filter(n)}const en=f(tn);function rn(n,t,e){return e.reduce(n,t)}const un=f(rn);function cn(n,t){return t.flatMap(n)}const on=f(cn);function fn(n,t){return t.find(n)}const sn=f(fn);function ln(n,t){for(let e=0;e<t.length;e++)if(n(t[e]))return!0;return!1}const an=f(ln);function dn(n,t){return t.every(n)}const hn=f(dn);function yn(n,t){return n<=0?[]:n>=t.length?[...t]:t.slice(0,n)}const pn=f(yn);function mn(n,t){const e=Math.floor(n);return!Number.isFinite(e)||e<=0?t:t.slice(e)}const gn=f(mn);function wn(n,t){const e=[];let r=!0;for(const i of t)r&&!n(i)&&(r=!1),r||e.push(i);return e}const An=f(wn);function Sn(n,t){const e=Math.floor(n);if(!Number.isFinite(e)||e<=0)return[];const r=[];for(let i=0;i<t.length;i+=e)r.push(t.slice(i,i+e));return r}const bn=f(Sn);function En(n,t){const e=Math.min(t.length,n.length),r=[];for(let i=0;i<e;i+=1)r.push([t[i],n[i]]);return r}const On=f(En);function Pn(n,t,e){const r=Math.min(e.length,t.length),i=[];for(let c=0;c<r;c+=1)i.push(n(e[c],t[c]));return i}const Tn=f(Pn);function Mn(n){const t=[],e=[];for(const[r,i]of n)t.push(r),e.push(i);return[t,e]}function Nn(n){const t=new Set,e=[];for(const r of n)t.has(r)||(t.add(r),e.push(r));return e}function vn(n,t){const e=new Set,r=[];for(const i of t){const c=n(i);e.has(c)||(e.add(c),r.push(i))}return r}const kn=f(vn);function zn(n,t){return[...t].sort((e,r)=>{const i=n(e),c=n(r);return i<c?-1:i>c?1:0})}const Wn=f(zn);function Dn(n,t){return[...t].sort(n)}const In=f(Dn);function _n(n,t){return t.reduce((e,r)=>{const i=n(r);return e[i]||(e[i]=[]),e[i].push(r),e},{})}const Ln=f(_n);function Cn(n){return n.map((t,e)=>[e,t])}function Kn(n,t){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e}const qn=f(Kn);function Bn(n,t,e){const r=[];let i=t;for(const c of e)i=n(i,c),r.push(i);return r}const Vn=f(Bn);function Fn(n,t){return[...t,...n]}const Rn=f(Fn);function $n(n,t){return[...t,n]}const Un=f($n);function jn(n,t){return[n,...t]}const Hn=f(jn);function Gn(n){return n.flat()}function Zn(n){return n[0]}function Jn(n){return n.slice(1)}function Qn(n){if(n.length!==0)return n[n.length-1]}function Xn(n){return n.length<=1?[]:n.slice(0,-1)}function Yn(n,t){if(!Number.isFinite(n)||!Number.isFinite(t))return[];if(n===t)return[];const e=n<t?1:-1,r=[];for(let i=n;e>0?i<t:i>t;i+=e)r.push(i);return r}function xn(n,t){const e=[],r=[];for(const i of t)n(i)?e.push(i):r.push(i);return[e,r]}const nt=f(xn);function tt(n){const t=[],e=r=>{for(const i of r)Array.isArray(i)?e(i):t.push(i)};return e(n),t}function et(n,t){return t?.[n]}const rt=f(et);function it(n,t){const e=t?.[n];if(e==null)throw new Error(`propStrict: "${String(n)}" is null or undefined`);return e}const ut=f(it);function ct(n,t,e){const r=e?.[t];return r??n}const ot=f(ct);function ft(n,t){return n.reduce((e,r)=>e?.[r],t)}const st=f(ft);function lt(n,t,e){const r=t.reduce((i,c)=>i?.[c],e);return r??n}const at=f(lt);function dt(n,t){const e={};for(const r of n)r in t&&(e[r]=t[r]);return e}const ht=f(dt);function yt(n,t){const e={...t};for(const r of n)delete e[r];return e}const pt=f(yt);function mt(n,t,e){if(Array.isArray(e)){const r=e.slice();return r[n]=t,r}return e&&typeof e=="object"?{...e,[n]:t}:{[n]:t}}const gt=f(mt),S=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,wt=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?Math.max(t+e,0):e},b=n=>n!==null&&typeof n=="object";function m(n,t,e){if(n.length===0)return t;const[r,...i]=n,c=S(r),o=Array.isArray(e)?e.slice():b(e)?{...e}:c?[]:{};if(Array.isArray(o)&&S(r)){const a=wt(r,o.length),w=o[a],A=i.length===0?t:m(i,t,w);return o[a]=A,o}const s=b(o)?o[r]:void 0,l=i.length===0?t:m(i,t,s);return o[r]=l,o}const At=f(m);function St(n,t){if(Array.isArray(t)){const e=t.slice(),r=typeof n=="number"?n:Number.isNaN(Number(n))?-1:Number(n);return r>=0&&r<e.length?e.splice(r,1):delete e[n],e}if(t&&typeof t=="object"){const{[n]:e,...r}=t;return r}return t}const bt=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,Et=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?t+e:e},Ot=n=>n!==null&&typeof n=="object";function g(n,t){if(n.length===0||!Ot(t))return t;const[e,...r]=n;if(Array.isArray(t)&&bt(e)){const c=Et(e,t.length);if(c<0||c>=t.length)return t;const o=t.slice();if(r.length===0)return o.splice(c,1),o;const s=g(r,o[c]);return o[c]=s,o}if(!Object.prototype.hasOwnProperty.call(t,e))return t;if(r.length===0){const{[e]:c,...o}=t;return o}const i={...t};return i[e]=g(r,i[e]),i}const Pt=f(g);function Tt(n,t){return{...n,...t}}const Mt=f(Tt);function Nt(n,t){const e=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),r=(i,c)=>{const o={...i};for(const[s,l]of Object.entries(c)){const a=o[s];e(a)&&e(l)?o[s]=r(a,l):o[s]=l}return o};return e(n)&&e(t)?r(n,t):{...n,...t}}const vt=f(Nt);function kt(n){return n.reduce((e,r)=>({...e,...r}),{})}function zt(n){return Object.keys(n)}function Wt(n){return Object.values(n)}function Dt(n){return Object.entries(n)}function It(n){return t=>{const e={};for(const[r,i]of Object.entries(t))e[r]=n(i);return e}}function _t(n,t){const e={...t};for(const r of Object.keys(n)){const i=n[r];typeof i=="function"&&(e[r]=i(t[r]))}return e}const Lt=f(_t);function Ct(n,t){return Object.prototype.hasOwnProperty.call(t,n)}const Kt=f(Ct);function qt(n){return t=>{let e=t;for(const r of n){if(e==null||!Object.prototype.hasOwnProperty.call(e,r))return!1;e=e[r]}return!0}}function Bt(n,t){return y(n,t,new WeakMap)}function y(n,t,e){if(n===t||typeof n=="number"&&typeof t=="number"&&Number.isNaN(n)&&Number.isNaN(t))return!0;if(n===null||t===null||typeof n!="object"||typeof t!="object")return!1;if(e.has(n))return e.get(n)===t;if(e.set(n,t),n instanceof Date&&t instanceof Date)return n.getTime()===t.getTime();if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;const c=Array.from(t.entries());for(const[o,s]of n.entries()){let l=!1;for(let a=0;a<c.length;a++){const[w,A]=c[a];if(y(o,w,e)&&y(s,A,e)){c.splice(a,1),l=!0;break}}if(!l)return!1}return!0}if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;const c=Array.from(t.values());for(const o of n.values()){let s=!1;for(let l=0;l<c.length;l++)if(y(o,c[l],e)){c.splice(l,1),s=!0;break}if(!s)return!1}return!0}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let c=0;c<n.length;c++)if(!y(n[c],t[c],e))return!1;return!0}const r=Reflect.ownKeys(n),i=Reflect.ownKeys(t);if(r.length!==i.length)return!1;for(const c of r)if(!Object.prototype.hasOwnProperty.call(t,c)||!y(n[c],t[c],e))return!1;return!0}const E=f(Bt);function Vt(n){return n==null}function Ft(n){return n==null?!0:typeof n=="string"||Array.isArray(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function Rt(n){const t=n.toLowerCase();return e=>{if(e===null)return t==="null";if(e===void 0)return t==="undefined";const r=typeof e;return r!=="object"?r===t:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()===t}}function $t(n){return t=>t>n}function Ut(n){return t=>t>=n}function jt(n){return t=>t<n}function Ht(n){return t=>t<=n}function Gt(n,t,e){return e<n?n:e>t?t:e}const Zt=f(Gt);function Jt(n,t){if(typeof t=="string"&&typeof n=="string")return t.includes(n);if(Array.isArray(t)){for(let e=0;e<t.length;e++)if(E(t[e],n))return!0;return!1}return!1}function Qt(n,t){return n+t}const Xt=f(Qt);function Yt(n,t){return n-t}const xt=f(Yt);function ne(n,t){return n*t}const te=f(ne);function ee(n,t){return n/t}const re=f(ee);function ie(n){return n.reduce((t,e)=>t+e,0)}function ue(n){return n.length===0?NaN:n.reduce((e,r)=>e+r,0)/n.length}function ce(n){return n.length===0?1/0:Math.min(...n)}function oe(n){return n.length===0?-1/0:Math.max(...n)}function fe(n){return Math.round(n)}function se(n){return Math.floor(n)}function le(n){return Math.ceil(n)}function ae(n,t){const e=Math.ceil(n),r=Math.floor(t);return r<e?e:Math.floor(Math.random()*(r-e+1))+e}const de=f(ae);function he(n){return n.trim()}function ye(n,t){return t.split(n)}const pe=f(ye);function me(n,t){return t.join(n)}const ge=f(me);function we(n,t,e){return e.replace(n,t)}const Ae=f(we);function Se(n){return n.toUpperCase()}function be(n){return n.toLowerCase()}function Ee(n,t){if(typeof t=="string"&&typeof n=="string")return t.startsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!==n[e])return!1;return!0}return!1}function Oe(n,t){if(typeof t=="string"&&typeof n=="string")return t.endsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++){const r=t.length-n.length+e;if(t[r]!==n[e])return!1}return!0}return!1}function Pe(n,t){return t.match(n)}const Te=f(Pe);function Me(...n){const t=async(i,c)=>{let o=i;for(const s of c)o=await s(o);return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function Ne(...n){const t=async(i,c)=>{let o=i;for(const s of c)o=await s(o);return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function ve(...n){const t=async(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function ke(...n){const t=async(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function O(n){return new Promise(t=>{setTimeout(t,n)})}function ze(n,t){return new Promise((e,r)=>{const i=setTimeout(()=>r(new Error(`Timed out after ${n}ms`)),n);t.then(c=>{clearTimeout(i),e(c)}).catch(c=>{clearTimeout(i),r(c)})})}const We=f(ze);function De(n,t,e=0){return(async()=>{let r=0;for(;;)try{return await t()}catch(i){if(r+=1,r>n)throw i;e>0&&await O(e)}})()}const Ie=f(De);function _e(n,t){let e;return function(...i){e&&clearTimeout(e);const c=this;e=setTimeout(()=>{e=void 0,n.apply(c,i)},t)}}const Le=f(_e);function Ce(n,t){let e;return function(...i){e||(n.apply(this,i),e=setTimeout(()=>{e=void 0},t))}}const Ke=f(Ce);function qe(n,t){let e,r=!1,i,c;const o=()=>{e=void 0,r&&i&&(r=!1,n.apply(c,i))};return function(...l){if(!e){n.apply(this,l),e=setTimeout(o,t);return}r=!0,i=l,c=this,clearTimeout(e),e=setTimeout(o,t)}}const Be=f(qe);function Ve(n,t){let e=0,r=null,i=null;const c=(s,l)=>{e=Date.now(),n.apply(s,l)};return function(...s){const l=Date.now(),a=t-(l-e);a<=0?(i&&(clearTimeout(i),i=null),r=null,c(this,s)):(r=s,i||(i=setTimeout(()=>{i=null,r&&(c(this,r),r=null)},a)))}}const Fe=f(Ve);function Re(n){return t=>t==null?null:n(t)}function $e(n){return t=>{const e=[];for(const r of t){const i=n(r);i!=null&&e.push(i)}return e}}function Ue(n){return t=>t??n}function je(n){try{return{ok:!0,value:n()}}catch(t){return{ok:!1,error:t}}}function He(n,t,e){return e==null?n():t(e)}const Ge=f(He);function Ze(n,t){if(!n)throw new Error(t??"Assertion failed")}const Je=f(Ze);function Qe(n,t){if(!n)throw new Error(t??"Invariant failed")}const Xe=f(Qe);function Ye(n){return t=>(n?console.log(n,t):console.log(t),t)}u.SideEffect=d,u.SideEffectClass=d,u.add=Xt,u.append=Un,u.assert=Je,u.assoc=gt,u.assocPath=At,u.ceil=le,u.chunk=bn,u.clamp=Zt,u.complement=_,u.compose=W,u.concat=Rn,u.cond=Z,u.constant=C,u.curry=f,u.debounce=Le,u.debounceLeading=Ke,u.debounceLeadingTrailing=Be,u.delay=O,u.dissoc=St,u.dissocPath=Pt,u.div=re,u.drop=gn,u.dropWhile=An,u.endsWith=Oe,u.entries=Dt,u.equals=E,u.every=hn,u.evolve=Lt,u.filter=en,u.find=sn,u.flatMap=on,u.flatten=Gn,u.flattenDeep=tt,u.flip=I,u.floor=se,u.fold=Ge,u.from=K,u.getOrElse=Ue,u.groupBy=Ln,u.gt=$t,u.gte=Ut,u.guard=Y,u.has=Kt,u.hasPath=qt,u.head=Zn,u.identity=L,u.ifElse=$,u.includes=Jt,u.init=Xn,u.invariant=Xe,u.isEmpty=Ft,u.isNil=Vt,u.isSideEffect=h,u.isType=Rt,u.join=ge,u.keys=zt,u.last=Qn,u.log=Ye,u.lt=jt,u.lte=Ht,u.map=nn,u.mapMaybe=$e,u.mapValues=It,u.match=Te,u.matchSideEffect=N,u.max=oe,u.maybe=Re,u.mean=ue,u.memoize=F,u.merge=Mt,u.mergeAll=kt,u.mergeDeep=vt,u.min=ce,u.mul=te,u.omit=pt,u.once=V,u.partial=D,u.partition=nt,u.path=st,u.pathOr=at,u.pick=ht,u.pipe=p,u.pipeAsync=Me,u.pipeAsyncSideEffect=ve,u.pipeAsyncSideEffectStrict=ke,u.pipeAsyncStrict=Ne,u.pipeHint=T,u.pipeSideEffect=k,u.pipeSideEffectStrict=z,u.pipeStrict=P,u.pipeWithDeps=M,u.prepend=Hn,u.prop=rt,u.propOr=ot,u.propStrict=ut,u.randomInt=de,u.range=Yn,u.reduce=un,u.replace=Ae,u.result=je,u.retry=Ie,u.round=fe,u.runPipeResult=v,u.scan=Vn,u.some=an,u.sort=In,u.sortBy=Wn,u.split=pe,u.startsWith=Ee,u.sub=xt,u.sum=ie,u.tail=Jn,u.take=pn,u.takeWhile=qn,u.tap=q,u.tap0=B,u.throttle=Fe,u.timeout=We,u.toLower=be,u.toUpper=Se,u.trim=he,u.tryCatch=Q,u.uniq=Nn,u.uniqBy=kn,u.unless=G,u.unzip=Mn,u.values=Wt,u.when=j,u.zip=On,u.zipIndex=Cn,u.zipWith=Tn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(u,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(u=typeof globalThis<"u"?globalThis:u||self,y(u.FpPack={}))})(this,(function(u){"use strict";function y(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return i=>r.reduce((c,o)=>o(c),i)}return e.reduce((r,i)=>i(r),t)}function M(...n){if(n.length===0)return;const[t,...e]=n;if(typeof t=="function"){const r=[t,...e];return i=>r.reduce((c,o)=>o(c),i)}return e.reduce((r,i)=>i(r),t)}const S=M;Object.defineProperty(S,"__pipe_strict",{value:!0});function N(n){return n}function v(n){return(...t)=>{if(typeof t[0]=="function"){const i=t;return c=>o=>{const s=i.map(l=>(a=>l(a,o)));return n(c,...s)}}const[e,...r]=t;return i=>{const c=r.map(o=>(s=>o(s,i)));return n(e,...c)}}}class d{effect;label;constructor(t,e){this.effect=t,this.label=e}static of(t,e){return new d(t,e)}}function _(n,t){return n instanceof d?t.effect(n):t.value(n)}function k(n){return h(n)?n.effect():n}function h(n){return n instanceof d}function W(...n){const t=(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function z(...n){const t=(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=s(o)}return o};if(n.length===0)return;const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function D(...n){return t=>n.reduceRight((e,r)=>r(e),t)}function f(n,...t){const e=r=>r.length>=n.length?n(...r):(...i)=>e([...r,...i]);return t.length===0?e([]):e(t)}function I(n,...t){return function(...r){const i=[...t,...r];return n.apply(this,i)}}function L(n){return function(...e){const r=[...e].reverse();return n.apply(this,r)}}function B(n,...t){return t.length===0?(...e)=>!n(...e):!n(...t)}function C(n){return n}function K(n){return()=>n}function q(n){const t=e=>n;return Object.defineProperty(t,"__from",{value:!0}),t}function V(n){return t=>(n(t),t)}function F(n){return()=>{n()}}function R(n){let t=!1,e;return function(...i){return t||(t=!0,e=n.apply(this,i)),e}}function $(n){const t=new Map,e=Symbol("result");return function(...i){let c=t;for(const s of i)c.has(s)||c.set(s,new Map),c=c.get(s);if(c.has(e))return c.get(e);const o=n.apply(this,i);return c.set(e,o),o}}function U(n,t,e,r){return n(r)?t(r):e(r)}const j=f(U);function H(n,t,e){return n(e)?t(e):e}const G=f(H);function Z(n,t,e){return n(e)?e:t(e)}const J=f(Z);function Q(n){return t=>{for(const[e,r]of n)if(e(t))return r(t)}}function X(n,t,e){try{return n(e)}catch(r){const i=r instanceof Error?r:new Error(String(r));return t(i,e)}}const Y=f(X);function x(n,t,e){return n(e)?e:t}const nn=f(x);function tn(n,t){return t.map(n)}const en=f(tn);function rn(n,t){return t.filter(n)}const un=f(rn);function cn(n,t,e){return e.reduce(n,t)}const on=f(cn);function fn(n,t){return t.flatMap(n)}const sn=f(fn);function ln(n,t){return t.find(n)}const an=f(ln);function dn(n,t){for(let e=0;e<t.length;e++)if(n(t[e]))return!0;return!1}const hn=f(dn);function pn(n,t){return t.every(n)}const yn=f(pn);function mn(n,t){return n<=0?[]:n>=t.length?[...t]:t.slice(0,n)}const gn=f(mn);function An(n,t){const e=Math.floor(n);return!Number.isFinite(e)||e<=0?t:t.slice(e)}const wn=f(An);function Sn(n,t){const e=[];let r=!0;for(const i of t)r&&!n(i)&&(r=!1),r||e.push(i);return e}const bn=f(Sn);function On(n,t){const e=Math.floor(n);if(!Number.isFinite(e)||e<=0)return[];const r=[];for(let i=0;i<t.length;i+=e)r.push(t.slice(i,i+e));return r}const Pn=f(On);function En(n,t){const e=Math.min(t.length,n.length),r=[];for(let i=0;i<e;i+=1)r.push([t[i],n[i]]);return r}const Tn=f(En);function Mn(n,t,e){const r=Math.min(e.length,t.length),i=[];for(let c=0;c<r;c+=1)i.push(n(e[c],t[c]));return i}const Nn=f(Mn);function vn(n){const t=[],e=[];for(const[r,i]of n)t.push(r),e.push(i);return[t,e]}function _n(n){const t=new Set,e=[];for(const r of n)t.has(r)||(t.add(r),e.push(r));return e}function kn(n,t){const e=new Set,r=[];for(const i of t){const c=n(i);e.has(c)||(e.add(c),r.push(i))}return r}const Wn=f(kn);function zn(n,t){return[...t].sort((e,r)=>{const i=n(e),c=n(r);return i<c?-1:i>c?1:0})}const Dn=f(zn);function In(n,t){return[...t].sort(n)}const Ln=f(In);function Bn(n,t){return t.reduce((e,r)=>{const i=n(r);return e[i]||(e[i]=[]),e[i].push(r),e},{})}const Cn=f(Bn);function Kn(n){return n.map((t,e)=>[e,t])}function qn(n,t){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e}const Vn=f(qn);function Fn(n,t,e){const r=[];let i=t;for(const c of e)i=n(i,c),r.push(i);return r}const Rn=f(Fn);function $n(n,t){return[...t,...n]}const Un=f($n);function jn(n,t){return[...t,n]}const Hn=f(jn);function Gn(n,t){return[n,...t]}const Zn=f(Gn);function Jn(n){return n.flat()}function Qn(n){return n[0]}function Xn(n){return n.slice(1)}function Yn(n){if(n.length!==0)return n[n.length-1]}function xn(n){return n.length<=1?[]:n.slice(0,-1)}function nt(n,t){if(!Number.isFinite(n)||!Number.isFinite(t))return[];if(n===t)return[];const e=n<t?1:-1,r=[];for(let i=n;e>0?i<t:i>t;i+=e)r.push(i);return r}function tt(n,t){const e=[],r=[];for(const i of t)n(i)?e.push(i):r.push(i);return[e,r]}const et=f(tt);function rt(n){const t=[],e=r=>{for(const i of r)Array.isArray(i)?e(i):t.push(i)};return e(n),t}function it(n,t){return t?.[n]}const ut=f(it);function ct(n,t){const e=t?.[n];if(e==null)throw new Error(`propStrict: "${String(n)}" is null or undefined`);return e}const ot=f(ct);function ft(n,t,e){const r=e?.[t];return r??n}const st=f(ft);function lt(n,t){return n.reduce((e,r)=>e?.[r],t)}const at=f(lt);function dt(n,t,e){const r=t.reduce((i,c)=>i?.[c],e);return r??n}const ht=f(dt);function pt(n,t){const e={};for(const r of n)r in t&&(e[r]=t[r]);return e}const yt=f(pt);function mt(n,t){const e={...t};for(const r of n)delete e[r];return e}const gt=f(mt);function At(n,t,e){if(Array.isArray(e)){const r=e.slice();return r[n]=t,r}return e&&typeof e=="object"?{...e,[n]:t}:{[n]:t}}const wt=f(At),b=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,St=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?Math.max(t+e,0):e},O=n=>n!==null&&typeof n=="object";function m(n,t,e){if(n.length===0)return t;const[r,...i]=n,c=b(r),o=Array.isArray(e)?e.slice():O(e)?{...e}:c?[]:{};if(Array.isArray(o)&&b(r)){const a=St(r,o.length),A=o[a],w=i.length===0?t:m(i,t,A);return o[a]=w,o}const s=O(o)?o[r]:void 0,l=i.length===0?t:m(i,t,s);return o[r]=l,o}const bt=f(m);function Ot(n,t){if(Array.isArray(t)){const e=t.slice(),r=typeof n=="number"?n:Number.isNaN(Number(n))?-1:Number(n);return r>=0&&r<e.length?e.splice(r,1):delete e[n],e}if(t&&typeof t=="object"){const{[n]:e,...r}=t;return r}return t}const Pt=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"?/^-?\d+$/.test(n):!1,Et=(n,t)=>{const e=typeof n=="number"?n:Number(n);return Number.isNaN(e)?-1:e<0?t+e:e},Tt=n=>n!==null&&typeof n=="object";function g(n,t){if(n.length===0||!Tt(t))return t;const[e,...r]=n;if(Array.isArray(t)&&Pt(e)){const c=Et(e,t.length);if(c<0||c>=t.length)return t;const o=t.slice();if(r.length===0)return o.splice(c,1),o;const s=g(r,o[c]);return o[c]=s,o}if(!Object.prototype.hasOwnProperty.call(t,e))return t;if(r.length===0){const{[e]:c,...o}=t;return o}const i={...t};return i[e]=g(r,i[e]),i}const Mt=f(g);function Nt(n,t){return{...n,...t}}const vt=f(Nt);function _t(n,t){const e=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),r=(i,c)=>{const o={...i};for(const[s,l]of Object.entries(c)){const a=o[s];e(a)&&e(l)?o[s]=r(a,l):o[s]=l}return o};return e(n)&&e(t)?r(n,t):{...n,...t}}const kt=f(_t);function Wt(n){return n.reduce((e,r)=>({...e,...r}),{})}function zt(n){return Object.keys(n)}function Dt(n){return Object.values(n)}function It(n){return Object.entries(n)}function Lt(n){return t=>{const e={};for(const[r,i]of Object.entries(t))e[r]=n(i);return e}}function Bt(n,t){const e={...t};for(const r of Object.keys(n)){const i=n[r];typeof i=="function"&&(e[r]=i(t[r]))}return e}const Ct=f(Bt);function Kt(n,t){return Object.prototype.hasOwnProperty.call(t,n)}const qt=f(Kt);function Vt(n){return t=>{let e=t;for(const r of n){if(e==null||!Object.prototype.hasOwnProperty.call(e,r))return!1;e=e[r]}return!0}}function Ft(n,t){return p(n,t,new WeakMap)}function p(n,t,e){if(n===t||typeof n=="number"&&typeof t=="number"&&Number.isNaN(n)&&Number.isNaN(t))return!0;if(n===null||t===null||typeof n!="object"||typeof t!="object")return!1;if(e.has(n))return e.get(n)===t;if(e.set(n,t),n instanceof Date&&t instanceof Date)return n.getTime()===t.getTime();if(n instanceof Map&&t instanceof Map){if(n.size!==t.size)return!1;const c=Array.from(t.entries());for(const[o,s]of n.entries()){let l=!1;for(let a=0;a<c.length;a++){const[A,w]=c[a];if(p(o,A,e)&&p(s,w,e)){c.splice(a,1),l=!0;break}}if(!l)return!1}return!0}if(n instanceof Set&&t instanceof Set){if(n.size!==t.size)return!1;const c=Array.from(t.values());for(const o of n.values()){let s=!1;for(let l=0;l<c.length;l++)if(p(o,c[l],e)){c.splice(l,1),s=!0;break}if(!s)return!1}return!0}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let c=0;c<n.length;c++)if(!p(n[c],t[c],e))return!1;return!0}const r=Reflect.ownKeys(n),i=Reflect.ownKeys(t);if(r.length!==i.length)return!1;for(const c of r)if(!Object.prototype.hasOwnProperty.call(t,c)||!p(n[c],t[c],e))return!1;return!0}const P=f(Ft);function Rt(n){return n==null}function $t(n){return n==null?!0:typeof n=="string"||Array.isArray(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function Ut(n){const t=n.toLowerCase();return e=>{if(e===null)return t==="null";if(e===void 0)return t==="undefined";const r=typeof e;return r!=="object"?r===t:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()===t}}function jt(n){return t=>t>n}function Ht(n){return t=>t>=n}function Gt(n){return t=>t<n}function Zt(n){return t=>t<=n}function Jt(n,t,e){return e<n?n:e>t?t:e}const Qt=f(Jt);function Xt(n,t){if(typeof t=="string"&&typeof n=="string")return t.includes(n);if(Array.isArray(t)){for(let e=0;e<t.length;e++)if(P(t[e],n))return!0;return!1}return!1}function Yt(n,t){return n+t}const xt=f(Yt);function ne(n,t){return n-t}const te=f(ne);function ee(n,t){return n*t}const re=f(ee);function ie(n,t){return n/t}const ue=f(ie);function ce(n){return n.reduce((t,e)=>t+e,0)}function oe(n){return n.length===0?NaN:n.reduce((e,r)=>e+r,0)/n.length}function fe(n){return n.length===0?1/0:Math.min(...n)}function se(n){return n.length===0?-1/0:Math.max(...n)}function le(n){return Math.round(n)}function ae(n){return Math.floor(n)}function de(n){return Math.ceil(n)}function he(n,t){const e=Math.ceil(n),r=Math.floor(t);return r<e?e:Math.floor(Math.random()*(r-e+1))+e}const pe=f(he);function ye(n){return n.trim()}function me(n,t){return t.split(n)}const ge=f(me);function Ae(n,t){return t.join(n)}const we=f(Ae);function Se(n,t,e){return e.replace(n,t)}const be=f(Se);function Oe(n){return n.toUpperCase()}function Pe(n){return n.toLowerCase()}function Ee(n,t){if(typeof t=="string"&&typeof n=="string")return t.startsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!==n[e])return!1;return!0}return!1}function Te(n,t){if(typeof t=="string"&&typeof n=="string")return t.endsWith(n);if(Array.isArray(n)&&Array.isArray(t)){if(n.length===0)return!0;if(n.length>t.length)return!1;for(let e=0;e<n.length;e++){const r=t.length-n.length+e;if(t[r]!==n[e])return!1}return!0}return!1}function Me(n,t){return t.match(n)}const Ne=f(Me);function ve(...n){const t=async(i,c)=>{let o=i;for(const s of c)o=await s(o);return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function _e(...n){const t=async(i,c)=>{let o=i;for(const s of c)o=await s(o);return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}const E=_e;Object.defineProperty(E,"__pipe_async_strict",{value:!0});function ke(...n){const t=async(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function We(...n){const t=async(i,c)=>{let o=i;for(const s of c){if(h(o))return o;o=await s(o)}return o};if(n.length===0)return Promise.resolve(void 0);const[e,...r]=n;if(typeof e=="function"){const i=[e,...r];return c=>t(c,i)}return t(e,r)}function T(n){return new Promise(t=>{setTimeout(t,n)})}function ze(n,t){return new Promise((e,r)=>{const i=setTimeout(()=>r(new Error(`Timed out after ${n}ms`)),n);t.then(c=>{clearTimeout(i),e(c)}).catch(c=>{clearTimeout(i),r(c)})})}const De=f(ze);function Ie(n,t,e=0){return(async()=>{let r=0;for(;;)try{return await t()}catch(i){if(r+=1,r>n)throw i;e>0&&await T(e)}})()}const Le=f(Ie);function Be(n,t){let e;return function(...i){e&&clearTimeout(e);const c=this;e=setTimeout(()=>{e=void 0,n.apply(c,i)},t)}}const Ce=f(Be);function Ke(n,t){let e;return function(...i){e||(n.apply(this,i),e=setTimeout(()=>{e=void 0},t))}}const qe=f(Ke);function Ve(n,t){let e,r=!1,i,c;const o=()=>{e=void 0,r&&i&&(r=!1,n.apply(c,i))};return function(...l){if(!e){n.apply(this,l),e=setTimeout(o,t);return}r=!0,i=l,c=this,clearTimeout(e),e=setTimeout(o,t)}}const Fe=f(Ve);function Re(n,t){let e=0,r=null,i=null;const c=(s,l)=>{e=Date.now(),n.apply(s,l)};return function(...s){const l=Date.now(),a=t-(l-e);a<=0?(i&&(clearTimeout(i),i=null),r=null,c(this,s)):(r=s,i||(i=setTimeout(()=>{i=null,r&&(c(this,r),r=null)},a)))}}const $e=f(Re);function Ue(n){return t=>t==null?null:n(t)}function je(n){return t=>{const e=[];for(const r of t){const i=n(r);i!=null&&e.push(i)}return e}}function He(n){return t=>t??n}function Ge(n){try{return{ok:!0,value:n()}}catch(t){return{ok:!1,error:t}}}function Ze(n,t,e){return e==null?n():t(e)}const Je=f(Ze);function Qe(n,t){if(!n)throw new Error(t??"Assertion failed")}const Xe=f(Qe);function Ye(n,t){if(!n)throw new Error(t??"Invariant failed")}const xe=f(Ye);function nr(n){return t=>(n?console.log(n,t):console.log(t),t)}u.SideEffect=d,u.SideEffectClass=d,u.add=xt,u.append=Hn,u.assert=Xe,u.assoc=wt,u.assocPath=bt,u.ceil=de,u.chunk=Pn,u.clamp=Qt,u.complement=B,u.compose=D,u.concat=Un,u.cond=Q,u.constant=K,u.curry=f,u.debounce=Ce,u.debounceLeading=qe,u.debounceLeadingTrailing=Fe,u.delay=T,u.dissoc=Ot,u.dissocPath=Mt,u.div=ue,u.drop=wn,u.dropWhile=bn,u.endsWith=Te,u.entries=It,u.equals=P,u.every=yn,u.evolve=Ct,u.filter=un,u.find=an,u.flatMap=sn,u.flatten=Jn,u.flattenDeep=rt,u.flip=L,u.floor=ae,u.fold=Je,u.from=q,u.getOrElse=He,u.groupBy=Cn,u.gt=jt,u.gte=Ht,u.guard=nn,u.has=qt,u.hasPath=Vt,u.head=Qn,u.identity=C,u.ifElse=j,u.includes=Xt,u.init=xn,u.invariant=xe,u.isEmpty=$t,u.isNil=Rt,u.isSideEffect=h,u.isType=Ut,u.join=we,u.keys=zt,u.last=Yn,u.log=nr,u.lt=Gt,u.lte=Zt,u.map=en,u.mapMaybe=je,u.mapValues=Lt,u.match=Ne,u.matchSideEffect=_,u.max=se,u.maybe=Ue,u.mean=oe,u.memoize=$,u.merge=vt,u.mergeAll=Wt,u.mergeDeep=kt,u.min=fe,u.mul=re,u.omit=gt,u.once=R,u.partial=I,u.partition=et,u.path=at,u.pathOr=ht,u.pick=yt,u.pipe=y,u.pipeAsync=ve,u.pipeAsyncSideEffect=ke,u.pipeAsyncSideEffectStrict=We,u.pipeAsyncStrict=E,u.pipeHint=N,u.pipeSideEffect=W,u.pipeSideEffectStrict=z,u.pipeStrict=S,u.pipeWithDeps=v,u.prepend=Zn,u.prop=ut,u.propOr=st,u.propStrict=ot,u.randomInt=pe,u.range=nt,u.reduce=on,u.replace=be,u.result=Ge,u.retry=Le,u.round=le,u.runPipeResult=k,u.scan=Rn,u.some=hn,u.sort=Ln,u.sortBy=Dn,u.split=ge,u.startsWith=Ee,u.sub=te,u.sum=ce,u.tail=Xn,u.take=gn,u.takeWhile=Vn,u.tap=V,u.tap0=F,u.throttle=$e,u.timeout=De,u.toLower=Pe,u.toUpper=Oe,u.trim=ye,u.tryCatch=Y,u.uniq=_n,u.uniqBy=Wn,u.unless=J,u.unzip=vn,u.values=Dt,u.when=G,u.zip=Tn,u.zipIndex=Kn,u.zipWith=Nn,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=fp-pack.umd.js.map