diff --git a/.changeset/two-mails-listen.md b/.changeset/two-mails-listen.md
new file mode 100644
index 0000000..e77c6f7
--- /dev/null
+++ b/.changeset/two-mails-listen.md
@@ -0,0 +1,5 @@
+---
+"@opentf/std": minor
+---
+
+Added functions composition related functions, Math avg & Array reverse fns.
diff --git a/.lintstagedrc.json b/.lintstagedrc.json
new file mode 100644
index 0000000..89eaf5c
--- /dev/null
+++ b/.lintstagedrc.json
@@ -0,0 +1 @@
+{ "*.md": "prettier --write" }
diff --git a/README.md b/README.md
index 2534e66..d1746fa 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@
- Practical Default Options
- Includes Async Utils
- TypeScript Support
-- ESM
+- Works with both CJS & ESM
## Installation
@@ -113,6 +113,24 @@ import { sleep } from "@opentf/std";
await sleep(1000); // Suspends execution for 1 second
```
+7. Functions composition using `pipe` & `compose` functions:
+
+```js
+import { pipe, compose } from "@opentf/std";
+
+pipe(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5,
+); //=> 10
+
+compose(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5,
+); //=> 6
+```
+
## API
### Array
@@ -133,6 +151,7 @@ await sleep(1000); // Suspends execution for 1 second
- [min](https://js-std.pages.dev/Array/min)
- [move](https://js-std.pages.dev/Array/move)
- [range](https://js-std.pages.dev/Array/range)
+- [reverse](https://js-std.pages.dev/Array/reverse)
- [sort](https://js-std.pages.dev/Array/sort)
- [sortBy](https://js-std.pages.dev/Array/sortBy)
- [symDiff](https://js-std.pages.dev/Array/symDiff)
@@ -142,12 +161,17 @@ await sleep(1000); // Suspends execution for 1 second
## Async
+- [aCompose](https://js-std.pages.dev/Async/aCompose)
+- [aComposeFn](https://js-std.pages.dev/Async/aComposeFn)
- [aFilter](https://js-std.pages.dev/Async/aFilter)
- [aForEach](https://js-std.pages.dev/Async/aForEach)
- [aMap](https://js-std.pages.dev/Async/aMap)
+- [aPipe](https://js-std.pages.dev/Async/aPipe)
+- [aPipeFn](https://js-std.pages.dev/Async/aPipeFn)
### Maths
+- [avg](https://js-std.pages.dev/Maths/avg)
- [clamp](https://js-std.pages.dev/Maths/clamp)
- [divMod](https://js-std.pages.dev/Maths/divMod)
- [isEven](https://js-std.pages.dev/Maths/isEven)
@@ -168,8 +192,12 @@ await sleep(1000); // Suspends execution for 1 second
### Function
-- [sleep](https://js-std.pages.dev/Timers/sleep)
-- [noop](https://js-std.pages.dev/Timers/noop)
+- [compose](https://js-std.pages.dev/Function/compose)
+- [composeFn](https://js-std.pages.dev/Function/composeFn)
+- [noop](https://js-std.pages.dev/Function/noop)
+- [pipe](https://js-std.pages.dev/Function/pipe)
+- [pipeFn](https://js-std.pages.dev/Function/pipeFn)
+- [sleep](https://js-std.pages.dev/Function/sleep)
### Colors
diff --git a/apps/docs/package.json b/apps/docs/package.json
index b21c566..d8e6896 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -15,7 +15,7 @@
"author": "",
"license": "ISC",
"dependencies": {
- "@opentf/react-node-repl": "^0.12.0",
+ "@opentf/react-node-repl": "^0.14.0",
"next": "^14.1.1",
"next-sitemap": "^4.2.3",
"nextra": "^2.13.4",
diff --git a/apps/docs/pages/Array/_meta.json b/apps/docs/pages/Array/_meta.json
index c0108b9..0a3a1a4 100644
--- a/apps/docs/pages/Array/_meta.json
+++ b/apps/docs/pages/Array/_meta.json
@@ -15,6 +15,7 @@
"min": "min",
"move": "move",
"range": "range",
+ "reverse": "reverse",
"sort": "sort",
"sortBy": "sortBy",
"symDiff": "symDiff",
diff --git a/apps/docs/pages/Array/move.mdx b/apps/docs/pages/Array/move.mdx
index 19fbe03..8ac4bb2 100644
--- a/apps/docs/pages/Array/move.mdx
+++ b/apps/docs/pages/Array/move.mdx
@@ -10,6 +10,8 @@ Immutable: This does not mutate the given array.
## Syntax
```ts
+import { move } from '@opentf/std';
+
move(arr: T[], from: number, to: number): T[];
```
diff --git a/apps/docs/pages/Array/reverse.mdx b/apps/docs/pages/Array/reverse.mdx
new file mode 100644
index 0000000..4869446
--- /dev/null
+++ b/apps/docs/pages/Array/reverse.mdx
@@ -0,0 +1,46 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Reverses the given list of elements order.
+
+
+Immutable: This does not mutate the given array.
+
+
+## Syntax
+
+```ts
+import { reverse } from '@opentf/std';
+
+reverse(arr: T[] = []): T[]
+```
+
+## Examples
+
+```ts
+reverse([1, 2, 3]) //=> [3, 2, 1]
+
+reverse([{ a: 1 }, { b: 2 }, { c: 3 }])
+//=> [
+// {
+// c: 3,
+// },
+// {
+// b: 2,
+// },
+// {
+// a: 1,
+// },
+// ]
+
+reverse('Apple')//=> ['e', 'l', 'p', 'p', 'A']
+
+reverse([1, , 3])//=> [3, undefined, 1]
+```
+
+## Try
+
+
diff --git a/apps/docs/pages/Async/_meta.json b/apps/docs/pages/Async/_meta.json
index 31b01eb..3532eae 100644
--- a/apps/docs/pages/Async/_meta.json
+++ b/apps/docs/pages/Async/_meta.json
@@ -1,5 +1,9 @@
{
+ "aCompose": "aCompose",
+ "aComposeFn": "aComposeFn",
"aFilter": "aFilter",
"aForEach": "aForEach",
- "aMap": "aMap"
+ "aMap": "aMap",
+ "aPipe": "aPipe",
+ "aPipeFn": "aPipeFn"
}
diff --git a/apps/docs/pages/Async/aCompose.mdx b/apps/docs/pages/Async/aCompose.mdx
new file mode 100644
index 0000000..0f9fed0
--- /dev/null
+++ b/apps/docs/pages/Async/aCompose.mdx
@@ -0,0 +1,68 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Performs functions composition from right to left asynchronously.
+
+
+ The `compose` function is equivalent to `a(b(c(val)))`.
+
+
+**Related**
+
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aComposeFn](/Async/aComposeFn)
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+
+## Syntax
+
+```ts
+import { aCompose } from '@opentf/std';
+
+aCompose(
+ val: unknown,
+ ...fns: Function[]
+): Promise
+```
+
+## Examples
+
+```ts
+await aCompose(
+ 1,
+ (x) => Promise.resolve(x + 1),
+ (x) => Promise.resolve(x * 5)
+); //=> 6
+```
+
+## Try
+
+ Promise.resolve(x + 1),
+(x) => Promise.resolve(x \* 5)
+);
+log(out);
+}
+
+main();
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Async/aComposeFn.mdx b/apps/docs/pages/Async/aComposeFn.mdx
new file mode 100644
index 0000000..764c4a9
--- /dev/null
+++ b/apps/docs/pages/Async/aComposeFn.mdx
@@ -0,0 +1,64 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Returns a function that performs functions composition from right to left asynchronously.
+
+
+ The `compose` function is equivalent to `a(b(c(val)))`.
+
+
+**Related**
+
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+
+## Syntax
+
+```ts
+import { aComposeFn } from '@opentf/std';
+
+aComposeFn(
+ ...fns: Function[]
+): (...args: unknown[]) => unknown
+```
+
+## Examples
+
+```ts
+const transform = aComposeFn((x) => Promise.resolve(Math.ceil(x)), Math.pow);
+await transform(1.5, 2.5); //=> 3
+```
+
+## Try
+
+ Promise.resolve(Math.ceil(x)),
+Math.pow
+);
+log(await transform(1.5, 2.5));
+}
+
+main();
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Async/aPipe.mdx b/apps/docs/pages/Async/aPipe.mdx
new file mode 100644
index 0000000..c95d001
--- /dev/null
+++ b/apps/docs/pages/Async/aPipe.mdx
@@ -0,0 +1,68 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Performs functions composition from left to right asynchronously.
+
+
+ The `pipe` function is equivalent to `c(b(a(val)))`.
+
+
+**Related**
+
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipeFn](/Async/aPipeFn)
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+
+## Syntax
+
+```ts
+import { aPipe } from '@opentf/std';
+
+aPipe(
+ val: unknown,
+ ...fns: Function[]
+): Promise
+```
+
+## Examples
+
+```ts
+await aPipe(
+ "guest",
+ (s) => capitalize(s),
+ (x) => Promise.resolve(`Welcome ${x}`)
+); //=> 'Welcome Guest'
+```
+
+## Try
+
+ capitalize(s),
+(x) => Promise.resolve(\`Welcome \${x}\`)
+);
+log(out);
+}
+
+main();
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Async/aPipeFn.mdx b/apps/docs/pages/Async/aPipeFn.mdx
new file mode 100644
index 0000000..efe4dc2
--- /dev/null
+++ b/apps/docs/pages/Async/aPipeFn.mdx
@@ -0,0 +1,70 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Returns a function that performs functions composition from left to right asynchronously.
+
+
+ The `pipe` function is equivalent to `c(b(a(val)))`.
+
+
+**Related**
+
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+
+## Syntax
+
+```ts
+import { aPipeFn } from '@opentf/std';
+
+aPipeFn(
+ ...fns: Function[]
+): (...args: unknown[]) => unknown
+```
+
+## Examples
+
+```ts
+const transform = aPipeFn(
+ (s) => capitalize(s),
+ (x) => Promise.resolve(`Welcome ${x}`),
+ (x) => Promise.resolve(`${x}...`)
+);
+await transform("guest"); //=> 'Welcome Guest...'
+```
+
+## Try
+
+ capitalize(s),
+(x) => Promise.resolve(\`Welcome \${x}\`),
+(x) => Promise.resolve(\`\${x}...\`)
+);
+const out = await transform('guest');
+log(out);
+}
+
+main();
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Function/_meta.json b/apps/docs/pages/Function/_meta.json
index e4017a5..ba26f32 100644
--- a/apps/docs/pages/Function/_meta.json
+++ b/apps/docs/pages/Function/_meta.json
@@ -1,4 +1,8 @@
{
+ "compose": "compose",
+ "composeFn": "composeFn",
"noop": "noop",
+ "pipe": "pipe",
+ "pipeFn": "pipeFn",
"sleep": "sleep"
}
diff --git a/apps/docs/pages/Function/compose.mdx b/apps/docs/pages/Function/compose.mdx
new file mode 100644
index 0000000..20aed3b
--- /dev/null
+++ b/apps/docs/pages/Function/compose.mdx
@@ -0,0 +1,64 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Performs functions composition from right to left.
+
+
+ The `compose` function is equivalent to `a(b(c(val)))`.
+
+
+**Related**
+
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+
+## Syntax
+
+```ts
+import { compose } from '@opentf/std';
+
+compose(val: unknown, ...fns: Function[]): unknown
+```
+
+## Examples
+
+```ts
+compose(1); //=> 1
+
+compose(-1, Math.abs); //=> 1
+
+compose(-4, Math.sqrt, Math.abs); //=> 2
+
+compose(
+ 1.5,
+ Math.ceil,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 9
+```
+
+## Try
+
+ x + 1, (x) => x \* 5);
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Function/composeFn.mdx b/apps/docs/pages/Function/composeFn.mdx
new file mode 100644
index 0000000..5489df0
--- /dev/null
+++ b/apps/docs/pages/Function/composeFn.mdx
@@ -0,0 +1,57 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Returns a function that performs functions composition from right to left.
+
+
+ The `compose` function is equivalent to `a(b(c(val)))`.
+
+
+**Related**
+
+- [compose](/Function/compose)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+- [pipe](/Function/pipe)
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+
+## Syntax
+
+```ts
+import { composeFn } from '@opentf/std';
+
+composeFn(
+ ...fns: Function[]
+): (...args: unknown[]) => unknown
+```
+
+## Examples
+
+```ts
+const transform = composeFn(Math.abs, Math.pow);
+transform(-2, 3); //=> 8
+```
+
+## Try
+
+
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Function/pipe.mdx b/apps/docs/pages/Function/pipe.mdx
new file mode 100644
index 0000000..3f6cd59
--- /dev/null
+++ b/apps/docs/pages/Function/pipe.mdx
@@ -0,0 +1,63 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Performs functions composition from left to right.
+
+
+ The `pipe` function is equivalent to `c(b(a(val)))`.
+
+
+**Related**
+
+- [pipeFn](/Function/pipeFn)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+
+## Syntax
+
+```ts
+import { pipe } from '@opentf/std';
+
+pipe(val: unknown, ...fns: Function[]): unknown
+```
+
+## Examples
+
+```ts
+pipe(1); //=> 1
+
+pipe(-1, Math.abs); //=> 1
+
+pipe(-4, Math.abs, Math.sqrt); //=> 2
+
+pipe(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 10
+```
+
+## Try
+
+ x + 1, (x) => x \* 5);
+`} />
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Function/pipeFn.mdx b/apps/docs/pages/Function/pipeFn.mdx
new file mode 100644
index 0000000..8a1f855
--- /dev/null
+++ b/apps/docs/pages/Function/pipeFn.mdx
@@ -0,0 +1,57 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Returns a function that performs functions composition from left to right.
+
+
+ The `pipe` function is equivalent to `c(b(a(val)))`.
+
+
+**Related**
+
+- [pipe](/Function/pipe)
+- [aPipe](/Async/aPipe)
+- [aPipeFn](/Async/aPipeFn)
+- [compose](/Function/compose)
+- [composeFn](/Function/composeFn)
+- [aCompose](/Async/aCompose)
+- [aComposeFn](/Async/aComposeFn)
+
+## Syntax
+
+```ts
+import { pipeFn } from '@opentf/std';
+
+pipeFn(
+ ...fns: Function[]
+): (...args: unknown[]) => unknown
+```
+
+## Examples
+
+```ts
+const transform = pipeFn(Math.pow, Math.abs);
+transform(-2, 3); //=> 8
+```
+
+## Try
+
+
+
+## Learn
+
+Why we need function composition?
+
+- The deep nesting of functions is hard to read.
+- It eliminates temporary variables.
+- Method chaining is limited, for Eg: await, yeild, etc.
+
+### Resources
+
+- [tc39/proposal-pipeline-operator](https://github.com/tc39/proposal-pipeline-operator)
+
+- [Hack Pipe Operator](https://docs.hhvm.com/hack/expressions-and-operators/pipe)
diff --git a/apps/docs/pages/Maths/_meta.json b/apps/docs/pages/Maths/_meta.json
index 5740f4c..edbf499 100644
--- a/apps/docs/pages/Maths/_meta.json
+++ b/apps/docs/pages/Maths/_meta.json
@@ -1,4 +1,5 @@
{
+ "avg": "avg",
"clamp": "clamp",
"divMod": "divMod",
"isEven": "isEven",
diff --git a/apps/docs/pages/Maths/avg.mdx b/apps/docs/pages/Maths/avg.mdx
new file mode 100644
index 0000000..51d8fdc
--- /dev/null
+++ b/apps/docs/pages/Maths/avg.mdx
@@ -0,0 +1,46 @@
+import { Callout } from "nextra/components";
+import REPL from "../../components/REPL";
+
+> Calculates the `average` value of the given array.
+
+## Syntax
+
+```ts
+import { avg } from '@opentf/std';
+
+avg(
+ arr: number[] = [],
+ cb?: (val: number, index: number) => number
+): number
+```
+
+## Examples
+
+```ts
+avg() //=> 0
+
+avg([]) //=> 0
+
+avg([1]) //=> 1
+
+avg([4, 1, 7]) //=> 4
+
+avg([4, 2, 8]) //=> 4.666666666666667
+
+avg([1, 4, 2, 5, 0]) //=> 2.4
+
+avg([10, 20, 40, 50]) //=> 30
+
+avg([1, 2, 3, 4, 5]) //=> 3
+
+avg([-1, -2]) //=> -1.5
+
+avg([1, 2, 3, 4, 5], (n) => n ** 2) //=> 11
+```
+
+## Try
+
+
\ No newline at end of file
diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx
index 90f4238..1431a15 100644
--- a/apps/docs/pages/index.mdx
+++ b/apps/docs/pages/index.mdx
@@ -10,11 +10,11 @@ import { Tabs, Callout } from "nextra/components";
- Practical Default Options
- Includes Async Utils
- TypeScript Support
-- ESM
+- Works with both CJS & ESM
## Installation
-
+
```sh copy
pnpm add @opentf/std
@@ -35,6 +35,11 @@ import { Tabs, Callout } from "nextra/components";
bun add @opentf/std
```
+
+ ```sh copy
+ deno add @opentf/std
+ ```
+
## Usage
@@ -44,14 +49,14 @@ Let’s explore some of the library’s capabilities:
```js
import { isNum } from "@opentf/std";
-console.log(isNum(NaN)); //=> false
+isNum(NaN); //=> false
```
2. Converting Strings to PascalCase:
```js
import { pascalCase } from "@opentf/std";
-console.log(pascalCase("pascal case")); //=> PascalCase
+pascalCase("pascal case"); //=> PascalCase
```
3. Sorting an Array in Descending Order:
@@ -59,7 +64,7 @@ console.log(pascalCase("pascal case")); //=> PascalCase
```js
import { sort } from "@opentf/std";
-console.log(sort([1, 10, 21, 2], "desc")); //=> [21, 10, 2, 1]
+sort([1, 10, 21, 2], "desc"); //=> [21, 10, 2, 1]
```
4. Deep Cloning an Object:
@@ -68,7 +73,7 @@ console.log(sort([1, 10, 21, 2], "desc")); //=> [21, 10, 2, 1]
import { clone } from "@opentf/std";
const obj = { a: 1, b: "abc", c: new Map([["key", "val"]]) };
-console.log(clone(obj)); // Deeply cloned value
+clone(obj); // Returns deeply cloned value
```
5. Checking Equality of Objects & Arrays:
@@ -78,9 +83,9 @@ import { isEql, isEqlArr } from "@opentf/std";
const mapA = new Map([["a", 1], ["b", 2]]);
const mapB = new Map([["b", 2], ["a", 1]]);
-console.log(isEql(mapA, mapB)); //=> false
+isEql(mapA, mapB); //=> false
-console.log(isEqlArr([1, 2, 3], [2, 3, 1])); //=> true
+isEqlArr([1, 2, 3], [2, 3, 1]); //=> true
```
6. Adding a Delay (1 second) with sleep:
@@ -91,6 +96,23 @@ import { sleep } from "@opentf/std";
await sleep(1000); // Suspends execution for 1 second
```
+7. Functions composition using `pipe` & `compose` functions:
+
+```js
+import { pipe, compose } from "@opentf/std";
+
+pipe(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 10
+
+compose(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 6
+```
diff --git a/packages/std/.lintstagedrc.json b/packages/std/.lintstagedrc.json
new file mode 100644
index 0000000..4e1fefe
--- /dev/null
+++ b/packages/std/.lintstagedrc.json
@@ -0,0 +1 @@
+{ "*.{ts,tsx}": ["prettier --write", "pnpm run lint --"] }
diff --git a/packages/std/README.md b/packages/std/README.md
index 46807c2..aa34545 100644
--- a/packages/std/README.md
+++ b/packages/std/README.md
@@ -24,7 +24,7 @@
- Practical Default Options
- Includes Async Utils
- TypeScript Support
-- ESM
+- Works with both CJS & ESM
## Installation
@@ -57,7 +57,7 @@ Let’s explore some of the library’s capabilities:
1. Checking if a Value is Numeric:
```js
-import { isNum } from '@opentf/std';
+import { isNum } from "@opentf/std";
console.log(isNum(NaN)); //=> false
```
@@ -65,40 +65,40 @@ console.log(isNum(NaN)); //=> false
2. Converting Strings to PascalCase:
```js
-import { pascalCase } from '@opentf/std';
+import { pascalCase } from "@opentf/std";
-console.log(pascalCase('pascal case')); //=> PascalCase
+console.log(pascalCase("pascal case")); //=> PascalCase
```
3. Sorting an Array in Descending Order:
```js
-import { sort } from '@opentf/std';
+import { sort } from "@opentf/std";
-console.log(sort([1, 10, 21, 2], 'desc')); //=> [21, 10, 2, 1]
+console.log(sort([1, 10, 21, 2], "desc")); //=> [21, 10, 2, 1]
```
4. Deep Cloning an Object:
```js
-import { clone } from '@opentf/std';
+import { clone } from "@opentf/std";
-const obj = { a: 1, b: 'abc', c: new Map([['key', 'val']]) };
+const obj = { a: 1, b: "abc", c: new Map([["key", "val"]]) };
console.log(clone(obj)); // Deeply cloned value
```
5. Checking Equality of Objects & Arrays:
```js
-import { isEql, isEqlArr } from '@opentf/std';
+import { isEql, isEqlArr } from "@opentf/std";
const mapA = new Map([
- ['a', 1],
- ['b', 2],
+ ["a", 1],
+ ["b", 2],
]);
const mapB = new Map([
- ['b', 2],
- ['a', 1],
+ ["b", 2],
+ ["a", 1],
]);
console.log(isEql(mapA, mapB)); //=> false
@@ -108,11 +108,29 @@ console.log(isEqlArr([1, 2, 3], [2, 3, 1])); //=> true
6. Adding a Delay (1 second) with sleep:
```js
-import { sleep } from '@opentf/std';
+import { sleep } from "@opentf/std";
await sleep(1000); // Suspends execution for 1 second
```
+7. Functions composition using `pipe` & `compose` functions:
+
+```js
+import { pipe, compose } from "@opentf/std";
+
+pipe(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 10
+
+compose(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+); //=> 6
+```
+
## API
### Array
@@ -133,6 +151,7 @@ await sleep(1000); // Suspends execution for 1 second
- [min](https://js-std.pages.dev/Array/min)
- [move](https://js-std.pages.dev/Array/move)
- [range](https://js-std.pages.dev/Array/range)
+- [reverse](https://js-std.pages.dev/Array/reverse)
- [sort](https://js-std.pages.dev/Array/sort)
- [sortBy](https://js-std.pages.dev/Array/sortBy)
- [symDiff](https://js-std.pages.dev/Array/symDiff)
@@ -142,12 +161,17 @@ await sleep(1000); // Suspends execution for 1 second
## Async
+- [aCompose](https://js-std.pages.dev/Async/aCompose)
+- [aComposeFn](https://js-std.pages.dev/Async/aComposeFn)
- [aFilter](https://js-std.pages.dev/Async/aFilter)
- [aForEach](https://js-std.pages.dev/Async/aForEach)
- [aMap](https://js-std.pages.dev/Async/aMap)
+- [aPipe](https://js-std.pages.dev/Async/aPipe)
+- [aPipeFn](https://js-std.pages.dev/Async/aPipeFn)
### Maths
+- [avg](https://js-std.pages.dev/Maths/avg)
- [clamp](https://js-std.pages.dev/Maths/clamp)
- [divMod](https://js-std.pages.dev/Maths/divMod)
- [isEven](https://js-std.pages.dev/Maths/isEven)
@@ -168,8 +192,12 @@ await sleep(1000); // Suspends execution for 1 second
### Function
-- [sleep](https://js-std.pages.dev/Timers/sleep)
-- [noop](https://js-std.pages.dev/Timers/noop)
+- [compose](https://js-std.pages.dev/Function/compose)
+- [composeFn](https://js-std.pages.dev/Function/composeFn)
+- [noop](https://js-std.pages.dev/Function/noop)
+- [pipe](https://js-std.pages.dev/Function/pipe)
+- [pipeFn](https://js-std.pages.dev/Function/pipeFn)
+- [sleep](https://js-std.pages.dev/Function/sleep)
### Colors
diff --git a/packages/std/__tests__/array/reverse.spec.ts b/packages/std/__tests__/array/reverse.spec.ts
new file mode 100644
index 0000000..3802d84
--- /dev/null
+++ b/packages/std/__tests__/array/reverse.spec.ts
@@ -0,0 +1,34 @@
+import { reverse } from '../../src';
+
+describe('Array > reverse', () => {
+ test('empty array', () => {
+ expect(reverse()).toEqual([]);
+ expect(reverse([])).toEqual([]);
+ });
+
+ test('array of numbers', () => {
+ expect(reverse([1, 2, 3])).toEqual([3, 2, 1]);
+ });
+
+ test('array of objects', () => {
+ expect(reverse([{ a: 1 }, { b: 2 }, { c: 3 }])).toEqual([
+ {
+ c: 3,
+ },
+ {
+ b: 2,
+ },
+ {
+ a: 1,
+ },
+ ]);
+ });
+
+ test('strings', () => {
+ expect(reverse('Apple')).toEqual(['e', 'l', 'p', 'p', 'A']);
+ });
+
+ test('sparse array', () => {
+ expect(reverse([1, , 3])).toStrictEqual([3, undefined, 1]);
+ });
+});
diff --git a/packages/std/__tests__/async/aCompose.spec.js b/packages/std/__tests__/async/aCompose.spec.js
new file mode 100644
index 0000000..7f5808f
--- /dev/null
+++ b/packages/std/__tests__/async/aCompose.spec.js
@@ -0,0 +1,25 @@
+import { aCompose } from '../../src';
+
+describe('Function > aCompose', () => {
+ test('empty aCompose', async () => {
+ await expect(aCompose()).resolves.toBe(undefined);
+ });
+
+ test('single functions', async () => {
+ await expect(aCompose(-5, Math.abs)).resolves.toBe(5);
+ });
+
+ test('two functions', async () => {
+ await expect(aCompose(-4, Math.sqrt, Math.abs)).resolves.toBe(2);
+ });
+
+ test('multiple functions', async () => {
+ await expect(
+ aCompose(
+ 1,
+ (x) => Promise.resolve(x + 1),
+ (x) => Promise.resolve(x * 5)
+ )
+ ).resolves.toBe(6);
+ });
+});
diff --git a/packages/std/__tests__/async/aComposeFn.spec.js b/packages/std/__tests__/async/aComposeFn.spec.js
new file mode 100644
index 0000000..e39583a
--- /dev/null
+++ b/packages/std/__tests__/async/aComposeFn.spec.js
@@ -0,0 +1,36 @@
+import { aComposeFn } from '../../src';
+
+describe('Function > aComposeFn', () => {
+ test('empty compose', async () => {
+ const fn = aComposeFn();
+ expect(typeof fn).toBe('function');
+ await expect(fn()).resolves.toBe(undefined);
+ });
+
+ test('single args compose fn with single function', async () => {
+ const fn = aComposeFn(Math.abs);
+ expect(typeof fn).toBe('function');
+ await expect(fn(-5)).resolves.toBe(5);
+ });
+
+ test('two args compose fn with single function', async () => {
+ const fn = aComposeFn(Math.pow);
+ expect(typeof fn).toBe('function');
+ await expect(fn(2, 3)).resolves.toBe(8);
+ });
+
+ test('multiple args compose fn with single function', async () => {
+ const fn = aComposeFn(Math.max);
+ expect(typeof fn).toBe('function');
+ await expect(fn(2, 3, 5)).resolves.toBe(5);
+ });
+
+ test('single args compose fn with two functions', async () => {
+ const fn = aComposeFn(
+ (x) => Promise.resolve(Math.ceil(x)),
+ (x) => Promise.resolve(Math.abs(x))
+ );
+ expect(typeof fn).toBe('function');
+ await expect(fn(-1.235)).resolves.toBe(2);
+ });
+});
diff --git a/packages/std/__tests__/async/aPipe.spec.js b/packages/std/__tests__/async/aPipe.spec.js
new file mode 100644
index 0000000..33aa2e9
--- /dev/null
+++ b/packages/std/__tests__/async/aPipe.spec.js
@@ -0,0 +1,36 @@
+import { aPipe, capitalize } from '../../src';
+
+describe('Function > Pipe', () => {
+ test('empty aPipe', async () => {
+ await expect(aPipe()).resolves.toBe(undefined);
+ });
+
+ test('returns passed value if no functions', async () => {
+ await expect(aPipe(1)).resolves.toBe(1);
+ });
+
+ test('single functions', async () => {
+ await expect(aPipe(-1, Math.abs)).resolves.toBe(1);
+ });
+
+ test('two functions', async () => {
+ await expect(
+ aPipe(
+ 'guest',
+ (s) => capitalize(s),
+ (x) => new Promise((resolve) => resolve(`Welcome ${x}`))
+ )
+ ).resolves.toBe('Welcome Guest');
+ });
+
+ test('multiple functions', async () => {
+ await expect(
+ aPipe(
+ 'guest',
+ (s) => capitalize(s),
+ (x) => new Promise((resolve) => resolve(`Welcome ${x}`)),
+ (x) => new Promise((resolve) => resolve(`${x}...`))
+ )
+ ).resolves.toBe('Welcome Guest...');
+ });
+});
diff --git a/packages/std/__tests__/async/aPipeFn.spec.js b/packages/std/__tests__/async/aPipeFn.spec.js
new file mode 100644
index 0000000..c35c78b
--- /dev/null
+++ b/packages/std/__tests__/async/aPipeFn.spec.js
@@ -0,0 +1,39 @@
+import { aPipeFn, capitalize } from '../../src';
+
+describe('Function > Pipe', () => {
+ test('empty aPipeFn', async () => {
+ const fn = aPipeFn();
+ expect(typeof fn).toBe('function');
+ await expect(fn()).resolves.toBe(undefined);
+ });
+
+ test('returns undefined value if no functions', async () => {
+ const fn = aPipeFn();
+ expect(typeof fn).toBe('function');
+ await expect(fn(1)).resolves.toBe(undefined);
+ });
+
+ test('single functions', async () => {
+ const fn = aPipeFn((x) => Promise.resolve(Math.abs(x)));
+ await expect(fn(-1)).resolves.toBe(1);
+ });
+
+ test('two functions', async () => {
+ const fn = aPipeFn(
+ (s) => capitalize(s),
+ (x) => new Promise((resolve) => resolve(`Welcome ${x}`))
+ );
+ expect(typeof fn).toBe('function');
+ await expect(fn('guest')).resolves.toBe('Welcome Guest');
+ });
+
+ test('multiple functions', async () => {
+ const fn = aPipeFn(
+ (s) => capitalize(s),
+ (x) => new Promise((resolve) => resolve(`Welcome ${x}`)),
+ (x) => new Promise((resolve) => resolve(`${x}...`))
+ );
+ expect(typeof fn).toBe('function');
+ await expect(fn('guest')).resolves.toBe('Welcome Guest...');
+ });
+});
diff --git a/packages/std/__tests__/function/compose.spec.js b/packages/std/__tests__/function/compose.spec.js
new file mode 100644
index 0000000..b932e58
--- /dev/null
+++ b/packages/std/__tests__/function/compose.spec.js
@@ -0,0 +1,29 @@
+import { compose } from '../../src';
+
+describe('Function > compose', () => {
+ test('empty compose', () => {
+ expect(compose()).toBe(undefined);
+ });
+
+ test('returns passed value if no functions', () => {
+ expect(compose(1)).toBe(1);
+ });
+
+ test('single functions', () => {
+ expect(compose(-1, Math.abs)).toBe(1);
+ });
+
+ test('two functions', () => {
+ expect(compose(-4, Math.sqrt, Math.abs)).toBe(2);
+ });
+
+ test('multiple functions', () => {
+ expect(
+ compose(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+ )
+ ).toBe(6);
+ });
+});
diff --git a/packages/std/__tests__/function/composeFn.spec.js b/packages/std/__tests__/function/composeFn.spec.js
new file mode 100644
index 0000000..fa8555e
--- /dev/null
+++ b/packages/std/__tests__/function/composeFn.spec.js
@@ -0,0 +1,33 @@
+import { composeFn } from '../../src';
+
+describe('Function > composeFn', () => {
+ test('empty compose', () => {
+ const fn = composeFn();
+ expect(typeof fn).toBe('function');
+ expect(fn()).toBe(undefined);
+ });
+
+ test('single args compose fn with single function', () => {
+ const fn = composeFn(Math.abs);
+ expect(typeof fn).toBe('function');
+ expect(fn(-5)).toBe(5);
+ });
+
+ test('two args compose fn with single function', () => {
+ const fn = composeFn(Math.pow);
+ expect(typeof fn).toBe('function');
+ expect(fn(2, 3)).toBe(8);
+ });
+
+ test('multiple args compose fn with single function', () => {
+ const fn = composeFn(Math.max);
+ expect(typeof fn).toBe('function');
+ expect(fn(2, 3, 5)).toBe(5);
+ });
+
+ test('single args compose fn with two functions', () => {
+ const fn = composeFn(Math.abs, Math.ceil);
+ expect(typeof fn).toBe('function');
+ expect(fn(-1.235)).toBe(1);
+ });
+});
diff --git a/packages/std/__tests__/function/pipe.spec.js b/packages/std/__tests__/function/pipe.spec.js
new file mode 100644
index 0000000..26322c7
--- /dev/null
+++ b/packages/std/__tests__/function/pipe.spec.js
@@ -0,0 +1,29 @@
+import { pipe } from '../../src';
+
+describe('Function > Pipe', () => {
+ test('empty pipe', () => {
+ expect(pipe()).toBe(undefined);
+ });
+
+ test('returns passed value if no functions', () => {
+ expect(pipe(1)).toBe(1);
+ });
+
+ test('single functions', () => {
+ expect(pipe(-1, Math.abs)).toBe(1);
+ });
+
+ test('two functions', () => {
+ expect(pipe(-4, Math.abs, Math.sqrt)).toBe(2);
+ });
+
+ test('multiple functions', () => {
+ expect(
+ pipe(
+ 1,
+ (x) => x + 1,
+ (x) => x * 5
+ )
+ ).toBe(10);
+ });
+});
diff --git a/packages/std/__tests__/function/pipeFn.spec.js b/packages/std/__tests__/function/pipeFn.spec.js
new file mode 100644
index 0000000..3948308
--- /dev/null
+++ b/packages/std/__tests__/function/pipeFn.spec.js
@@ -0,0 +1,33 @@
+import { pipeFn } from '../../src';
+
+describe('Function > pipeFn', () => {
+ test('empty pipe', () => {
+ const fn = pipeFn();
+ expect(typeof fn).toBe('function');
+ expect(fn()).toBe(undefined);
+ });
+
+ test('single args pipe fn with single function', () => {
+ const fn = pipeFn(Math.abs);
+ expect(typeof fn).toBe('function');
+ expect(fn(-5)).toBe(5);
+ });
+
+ test('two args pipe fn with single function', () => {
+ const fn = pipeFn(Math.pow);
+ expect(typeof fn).toBe('function');
+ expect(fn(2, 3)).toBe(8);
+ });
+
+ test('multiple args pipe fn with single function', () => {
+ const fn = pipeFn(Math.max);
+ expect(typeof fn).toBe('function');
+ expect(fn(2, 3, 5)).toBe(5);
+ });
+
+ test('single args pipe fn with two functions', () => {
+ const fn = pipeFn(Math.abs, Math.ceil);
+ expect(typeof fn).toBe('function');
+ expect(fn(-1.235)).toBe(2);
+ });
+});
diff --git a/packages/std/__tests__/maths/avg.spec.ts b/packages/std/__tests__/maths/avg.spec.ts
new file mode 100644
index 0000000..fbf8ab7
--- /dev/null
+++ b/packages/std/__tests__/maths/avg.spec.ts
@@ -0,0 +1,16 @@
+import { avg } from '../../src';
+
+describe('Number', () => {
+ test('avg', () => {
+ expect(avg()).toBe(0);
+ expect(avg([])).toBe(0);
+ expect(avg([1])).toBe(1);
+ expect(avg([4, 1, 7])).toBe(4);
+ expect(avg([4, 2, 8])).toBeCloseTo(4.666);
+ expect(avg([1, 4, 2, 5, 0])).toBe(2.4);
+ expect(avg([10, 20, 40, 50])).toBe(30);
+ expect(avg([1, 2, 3, 4, 5])).toBe(3);
+ expect(avg([-1, -2])).toBe(-1.5);
+ expect(avg([1, 2, 3, 4, 5], (n) => n ** 2)).toBe(11);
+ });
+});
diff --git a/packages/std/jsr.json b/packages/std/jsr.json
index 8fa6032..d7f2d65 100644
--- a/packages/std/jsr.json
+++ b/packages/std/jsr.json
@@ -1,5 +1,5 @@
{
"name": "@opentf/std",
- "version": "0.5.0",
+ "version": "0.6.0",
"exports": "./src/index.ts"
}
diff --git a/packages/std/package.json b/packages/std/package.json
index a4d2a9e..c9a650f 100644
--- a/packages/std/package.json
+++ b/packages/std/package.json
@@ -55,6 +55,9 @@
}
},
"sideEffects": false,
+ "engines": {
+ "node": ">=16.20.2"
+ },
"scripts": {
"build": "tsup",
"test": "jest",
@@ -74,12 +77,12 @@
"@swc/core": "^1.4.0",
"@swc/jest": "^0.2.24",
"@types/jest": "^29.5.1",
- "@types/node": "^20.11.16",
- "@typescript-eslint/eslint-plugin": "^7.3.1",
- "@typescript-eslint/parser": "^7.3.1",
+ "@types/node": "^20.12.5",
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
+ "@typescript-eslint/parser": "^7.6.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
- "eslint-plugin-jest": "^27.9.0",
+ "eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
diff --git a/packages/std/src/array/reverse.ts b/packages/std/src/array/reverse.ts
new file mode 100644
index 0000000..9d59f5a
--- /dev/null
+++ b/packages/std/src/array/reverse.ts
@@ -0,0 +1,15 @@
+/**
+ * Reverses the given list of elements order.
+ *
+ * @example
+ * reverse([1, 2, 3]) //=> [3, 2, 1]
+ */
+export default function reverse(arr: T[] = []): T[] {
+ const a = [];
+
+ for (let i = arr.length - 1; i >= 0; i--) {
+ a.push(arr[i]);
+ }
+
+ return a;
+}
diff --git a/packages/std/src/async/aCompose.ts b/packages/std/src/async/aCompose.ts
new file mode 100644
index 0000000..26debe0
--- /dev/null
+++ b/packages/std/src/async/aCompose.ts
@@ -0,0 +1,20 @@
+import reverse from '../array/reverse';
+
+/** Performs functions composition from right to left asynchronously.
+ *
+ * @example
+ *
+ * await aCompose(1, (x) => Promise.resolve(x + 1), (x) => Promise.resolve(x * 5)) //=> 6
+ */
+export default async function aCompose(
+ val: unknown,
+ ...fns: ((...args: unknown[]) => unknown)[]
+): Promise {
+ let out = val;
+
+ for (const fn of reverse(fns)) {
+ out = await fn(out);
+ }
+
+ return out;
+}
diff --git a/packages/std/src/async/aComposeFn.ts b/packages/std/src/async/aComposeFn.ts
new file mode 100644
index 0000000..40da3cd
--- /dev/null
+++ b/packages/std/src/async/aComposeFn.ts
@@ -0,0 +1,28 @@
+import reverse from '../array/reverse';
+
+/** Returns a function that performs functions composition from right to left asynchronously.
+ *
+ * @example
+ * const transform = aComposeFn((x) => Promise.resolve(x + 1), (x) => Promise.resolve(x * 5))
+ * await transform(1) //=> 6
+ */
+export default function aComposeFn(
+ ...fns: ((...args: unknown[]) => unknown)[]
+): (...args: unknown[]) => unknown {
+ return async function (...args) {
+ const revFns = reverse(fns);
+ const firstFn = revFns.shift();
+
+ if (!firstFn) {
+ return;
+ }
+
+ let out = await firstFn(...args);
+
+ for (const fn of revFns) {
+ out = await fn(out);
+ }
+
+ return out;
+ };
+}
diff --git a/packages/std/src/async/aPipe.ts b/packages/std/src/async/aPipe.ts
new file mode 100644
index 0000000..e75b73b
--- /dev/null
+++ b/packages/std/src/async/aPipe.ts
@@ -0,0 +1,17 @@
+/** Performs functions composition from left to right asynchronously.
+ *
+ * @example
+ * await aPipe(5, (x) => Promise.resolve(x ** 2), (x) => Promise.resolve(x - 5)) //=> 20
+ */
+export default async function aPipe(
+ val: unknown,
+ ...fns: ((...args: unknown[]) => unknown)[]
+): Promise {
+ let out = val;
+
+ for (const fn of fns) {
+ out = await fn(out);
+ }
+
+ return out;
+}
diff --git a/packages/std/src/async/aPipeFn.ts b/packages/std/src/async/aPipeFn.ts
new file mode 100644
index 0000000..695f220
--- /dev/null
+++ b/packages/std/src/async/aPipeFn.ts
@@ -0,0 +1,25 @@
+/** Returns a function that performs functions composition from left to right asynchronously.
+ *
+ * @example
+ * const transform = aPipe((x) => Promise.resolve(x ** 2), (x) => Promise.resolve(x - 5))
+ * await transform(5) //=> 20
+ */
+export default function aPipeFn(
+ ...fns: ((...args: unknown[]) => unknown)[]
+): (...args: unknown[]) => unknown {
+ return async function (...args) {
+ const firstFn = fns.shift();
+
+ if (!firstFn) {
+ return;
+ }
+
+ let out = await firstFn(...args);
+
+ for (const fn of fns) {
+ out = await fn(out);
+ }
+
+ return out;
+ };
+}
diff --git a/packages/std/src/function/compose.ts b/packages/std/src/function/compose.ts
new file mode 100644
index 0000000..63bcaf1
--- /dev/null
+++ b/packages/std/src/function/compose.ts
@@ -0,0 +1,20 @@
+import reverse from '../array/reverse';
+
+/** Performs functions composition from right to left.
+ *
+ * @example
+ *
+ * compose(1, (x) => x + 1, (x) => x * 5) //=> 6
+ */
+export default function compose(
+ val: unknown,
+ ...fns: ((...args: unknown[]) => unknown)[]
+): unknown {
+ let out = val;
+
+ for (const fn of reverse(fns)) {
+ out = fn(out);
+ }
+
+ return out;
+}
diff --git a/packages/std/src/function/composeFn.ts b/packages/std/src/function/composeFn.ts
new file mode 100644
index 0000000..13ba8f7
--- /dev/null
+++ b/packages/std/src/function/composeFn.ts
@@ -0,0 +1,29 @@
+import reverse from '../array/reverse';
+
+/** Returns a function that performs functions composition from right to left.
+ *
+ * @example
+ * const transform = composeFn(Math.abs, Math.pow);
+ * transform(-2, 3) //=> 8
+ */
+export default function composeFn(
+ ...fns: ((...args: unknown[]) => unknown)[]
+): (...args: unknown[]) => unknown {
+ return function (...args) {
+ const revFns = reverse(fns);
+
+ const firstFn = revFns.shift();
+
+ if (!firstFn) {
+ return;
+ }
+
+ let out = firstFn(...args);
+
+ for (const fn of revFns) {
+ out = fn(out);
+ }
+
+ return out;
+ };
+}
diff --git a/packages/std/src/function/pipe.ts b/packages/std/src/function/pipe.ts
new file mode 100644
index 0000000..c39b261
--- /dev/null
+++ b/packages/std/src/function/pipe.ts
@@ -0,0 +1,18 @@
+/** Performs functions composition from left to right.
+ *
+ * @example
+ *
+ * pipe(1, (x) => x + 1, (x) => x * 5) //=> 10
+ */
+export default function pipe(
+ val: unknown,
+ ...fns: ((...args: unknown[]) => unknown)[]
+): unknown {
+ let out = val;
+
+ for (const fn of fns) {
+ out = fn(out);
+ }
+
+ return out;
+}
diff --git a/packages/std/src/function/pipeFn.ts b/packages/std/src/function/pipeFn.ts
new file mode 100644
index 0000000..7548040
--- /dev/null
+++ b/packages/std/src/function/pipeFn.ts
@@ -0,0 +1,25 @@
+/** Returns a function that performs functions composition from left to right.
+ *
+ * @example
+ * const transform = pipeFn(Math.pow, Math.abs)
+ * transform(-2, 3) //=> 8
+ */
+export default function pipeFn(
+ ...fns: ((...args: unknown[]) => unknown)[]
+): (...args: unknown[]) => unknown {
+ return function (...args) {
+ const firstFn = fns.shift();
+
+ if (!firstFn) {
+ return;
+ }
+
+ let out = firstFn(...args);
+
+ for (const fn of fns) {
+ out = fn(out);
+ }
+
+ return out;
+ };
+}
diff --git a/packages/std/src/index.ts b/packages/std/src/index.ts
index c10622a..d16057c 100644
--- a/packages/std/src/index.ts
+++ b/packages/std/src/index.ts
@@ -30,11 +30,16 @@ export { default as bounds } from './array/bounds';
export { default as take } from './array/take';
export { default as drop } from './array/drop';
export { default as intersperse } from './array/intersperse';
+export { default as reverse } from './array/reverse';
// Async
export { default as aFilter } from './async/aFilter';
export { default as aMap } from './async/aMap';
export { default as aForEach } from './async/aForEach';
+export { default as aPipe } from './async/aPipe';
+export { default as aPipeFn } from './async/aPipeFn';
+export { default as aCompose } from './async/aCompose';
+export { default as aComposeFn } from './async/aComposeFn';
// Maths
export { default as percentage } from './maths/percentage';
@@ -48,6 +53,7 @@ export { default as mean } from './maths/mean';
export { default as median } from './maths/median';
export { default as mode } from './maths/mode';
export { default as clamp } from './maths/clamp';
+export { default as avg } from './maths/avg';
// Types
export { default as isNum } from './types/isNum';
@@ -106,6 +112,10 @@ export { default as isEqlArr } from './assert/isEqlArr';
// function
export { default as sleep } from './function/sleep';
export { default as noop } from './function/noop';
+export { default as pipe } from './function/pipe';
+export { default as pipeFn } from './function/pipeFn';
+export { default as compose } from './function/compose';
+export { default as composeFn } from './function/composeFn';
// colors
export { default as hexToRGB } from './colors/hexToRGB';
diff --git a/packages/std/src/maths/avg.ts b/packages/std/src/maths/avg.ts
new file mode 100644
index 0000000..45f02bd
--- /dev/null
+++ b/packages/std/src/maths/avg.ts
@@ -0,0 +1,18 @@
+import sum from './sum';
+
+/**
+ * Calculates the average of values in the given array.
+ *
+ * @example
+ *
+ * avg([1, 2, 3, 4, 5]) //=> 3
+ * avg([-1, -2]) //=> -1.5
+ */
+export default function avg(
+ arr: number[] = [],
+ cb?: (val: number, index: number) => number
+): number {
+ const s = sum(arr, cb);
+
+ return s / arr.length || 0;
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b7a9196..4d77cd6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,7 +13,7 @@ importers:
version: 2.27.1
'@commitlint/cli':
specifier: ^18.6.0
- version: 18.6.0(@types/node@20.11.16)(typescript@5.4.3)
+ version: 18.6.0(@types/node@20.12.5)(typescript@5.4.3)
'@commitlint/config-conventional':
specifier: ^18.6.0
version: 18.6.0
@@ -57,8 +57,8 @@ importers:
apps/docs:
dependencies:
'@opentf/react-node-repl':
- specifier: ^0.12.0
- version: 0.12.0(@codemirror/language@6.6.0)(@lezer/common@1.2.1)(@xterm/xterm@5.4.0)(react-dom@18.2.0)(react@18.2.0)
+ specifier: ^0.14.0
+ version: 0.14.0(@codemirror/language@6.6.0)(@lezer/common@1.2.1)(@xterm/xterm@5.4.0)(react-dom@18.2.0)(react@18.2.0)
next:
specifier: ^14.1.1
version: 14.1.1(react-dom@18.2.0)(react@18.2.0)
@@ -96,14 +96,14 @@ importers:
specifier: ^29.5.1
version: 29.5.1
'@types/node':
- specifier: ^20.11.16
- version: 20.11.16
+ specifier: ^20.12.5
+ version: 20.12.5
'@typescript-eslint/eslint-plugin':
- specifier: ^7.3.1
- version: 7.3.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3)
+ specifier: ^7.6.0
+ version: 7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.3)
'@typescript-eslint/parser':
- specifier: ^7.3.1
- version: 7.4.0(eslint@8.57.0)(typescript@5.4.3)
+ specifier: ^7.6.0
+ version: 7.6.0(eslint@8.57.0)(typescript@5.4.3)
eslint:
specifier: ^8.57.0
version: 8.57.0
@@ -111,14 +111,14 @@ importers:
specifier: ^9.1.0
version: 9.1.0(eslint@8.57.0)
eslint-plugin-jest:
- specifier: ^27.9.0
- version: 27.9.0(@typescript-eslint/eslint-plugin@7.3.1)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3)
+ specifier: ^28.2.0
+ version: 28.2.0(@typescript-eslint/eslint-plugin@7.6.0)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3)
eslint-plugin-prettier:
specifier: ^5.1.3
version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5)
jest:
specifier: ^29.7.0
- version: 29.7.0(@types/node@20.11.16)
+ version: 29.7.0(@types/node@20.12.5)
prettier:
specifier: ^3.2.5
version: 3.2.5
@@ -752,14 +752,14 @@ packages:
w3c-keyname: 2.2.6
dev: false
- /@commitlint/cli@18.6.0(@types/node@20.11.16)(typescript@5.4.3):
+ /@commitlint/cli@18.6.0(@types/node@20.12.5)(typescript@5.4.3):
resolution: {integrity: sha512-FiH23cr9QG8VdfbmvJJZmdfHGVMCouOOAzoXZ3Cd7czGC52RbycwNt8YCI7SA69pAl+t30vh8LMaO/N+kcel6w==}
engines: {node: '>=v18'}
hasBin: true
dependencies:
'@commitlint/format': 18.6.0
'@commitlint/lint': 18.6.0
- '@commitlint/load': 18.6.0(@types/node@20.11.16)(typescript@5.4.3)
+ '@commitlint/load': 18.6.0(@types/node@20.12.5)(typescript@5.4.3)
'@commitlint/read': 18.6.0
'@commitlint/types': 18.6.0
execa: 5.1.1
@@ -830,7 +830,7 @@ packages:
'@commitlint/types': 18.6.0
dev: true
- /@commitlint/load@18.6.0(@types/node@20.11.16)(typescript@5.4.3):
+ /@commitlint/load@18.6.0(@types/node@20.12.5)(typescript@5.4.3):
resolution: {integrity: sha512-RRssj7TmzT0bowoEKlgwg8uQ7ORXWkw7lYLsZZBMi9aInsJuGNLNWcMxJxRZbwxG3jkCidGUg85WmqJvRjsaDA==}
engines: {node: '>=v18'}
dependencies:
@@ -840,7 +840,7 @@ packages:
'@commitlint/types': 18.6.0
chalk: 4.1.2
cosmiconfig: 8.3.6(typescript@5.4.3)
- cosmiconfig-typescript-loader: 5.0.0(@types/node@20.11.16)(cosmiconfig@8.3.6)(typescript@5.4.3)
+ cosmiconfig-typescript-loader: 5.0.0(@types/node@20.12.5)(cosmiconfig@8.3.6)(typescript@5.4.3)
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
lodash.uniq: 4.5.0
@@ -1137,6 +1137,11 @@ packages:
eslint-visitor-keys: 3.4.3
dev: true
+ /@eslint-community/regexpp@4.10.0:
+ resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==}
+ engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
+ dev: true
+
/@eslint-community/regexpp@4.8.1:
resolution: {integrity: sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
@@ -1149,7 +1154,7 @@ packages:
ajv: 6.12.6
debug: 4.3.4
espree: 9.6.1
- globals: 13.20.0
+ globals: 13.24.0
ignore: 5.2.4
import-fresh: 3.3.0
js-yaml: 4.1.0
@@ -1181,7 +1186,7 @@ packages:
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
engines: {node: '>=10.10.0'}
dependencies:
- '@humanwhocodes/object-schema': 2.0.2
+ '@humanwhocodes/object-schema': 2.0.3
debug: 4.3.4
minimatch: 3.1.2
transitivePeerDependencies:
@@ -1193,8 +1198,8 @@ packages:
engines: {node: '>=12.22'}
dev: true
- /@humanwhocodes/object-schema@2.0.2:
- resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==}
+ /@humanwhocodes/object-schema@2.0.3:
+ resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
dev: true
/@istanbuljs/load-nyc-config@1.1.0:
@@ -1218,7 +1223,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
@@ -1239,14 +1244,14 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
ansi-escapes: 4.3.2
chalk: 4.1.2
ci-info: 3.8.0
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
- jest-config: 29.7.0(@types/node@20.11.16)
+ jest-config: 29.7.0(@types/node@20.12.5)
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@@ -1281,7 +1286,7 @@ packages:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
jest-mock: 29.7.0
dev: true
@@ -1308,7 +1313,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.0.2
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@@ -1341,7 +1346,7 @@ packages:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.19
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
collect-v8-coverage: 1.0.1
exit: 0.1.2
@@ -1428,7 +1433,7 @@ packages:
dependencies:
'@types/istanbul-lib-coverage': 2.0.4
'@types/istanbul-reports': 3.0.1
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
'@types/yargs': 16.0.5
chalk: 4.1.2
dev: true
@@ -1440,7 +1445,7 @@ packages:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.4
'@types/istanbul-reports': 3.0.1
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
'@types/yargs': 17.0.22
chalk: 4.1.2
dev: true
@@ -1788,12 +1793,12 @@ packages:
peerDependencies:
eslint: '>8.35.0'
dependencies:
- '@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3)
- '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.3)
eslint: 8.57.0
eslint-config-prettier: 9.1.0(eslint@8.57.0)
eslint-config-turbo: 1.13.0(eslint@8.57.0)
- eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@7.3.1)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3)
+ eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@7.6.0)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3)
eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5)
transitivePeerDependencies:
- '@types/eslint'
@@ -1803,8 +1808,8 @@ packages:
- typescript
dev: true
- /@opentf/react-node-repl@0.12.0(@codemirror/language@6.6.0)(@lezer/common@1.2.1)(@xterm/xterm@5.4.0)(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-FExIpCDxBwnbMHcFnWWSnMNVWeDspru/oSh2nEqZdiGxsOFeMOZHmtYv3hs4jTQjjMBXUfNp2QgaRD+sVfEySA==}
+ /@opentf/react-node-repl@0.14.0(@codemirror/language@6.6.0)(@lezer/common@1.2.1)(@xterm/xterm@5.4.0)(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-lO2gdrryWKhPwPvz4SHD5Nn6L5lTz9rTtv6B7qKs3tCZsIcd8C0Pf86f0Nf2b9E9fUTtHqgK//s93e4ob6lDyg==}
peerDependencies:
react: ^18.2.0
react-dom: ^18.2.0
@@ -1813,11 +1818,11 @@ packages:
'@codemirror/lang-javascript': 6.2.2
'@codemirror/state': 6.4.1
'@codemirror/view': 6.26.0
- '@opentf/react-state': 0.15.0(react-dom@18.2.0)(react@18.2.0)
- '@opentf/std': 0.1.1
+ '@opentf/react-state': 0.16.0(react-dom@18.2.0)(react@18.2.0)
+ '@opentf/std': 0.5.1
'@uiw/codemirror-theme-monokai': 4.21.24(@codemirror/language@6.6.0)(@codemirror/state@6.4.1)(@codemirror/view@6.26.0)
'@webcontainer/api': 1.1.9
- '@xterm/addon-fit': 0.9.0(@xterm/xterm@5.4.0)
+ '@xterm/addon-fit': 0.10.0(@xterm/xterm@5.4.0)
codemirror: 6.0.1(@lezer/common@1.2.1)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
@@ -1829,25 +1834,25 @@ packages:
- '@xterm/xterm'
dev: false
- /@opentf/react-state@0.15.0(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-fxSVMHw3vOib54rOLs98QcZJnrq68gTcO9HpdWMaFW4leltMjbIYAgUsL5CJuDpjmBLY0TD6z++HTd0Ie2eA7A==}
+ /@opentf/react-state@0.16.0(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-q7tzlDzwV8qEk31/sGgSCWvjIHCW8N9022lCnO5J/NGD6dNSW8Pl0tX+TgtgQlh4CqTDDv78UgHpHO2twpOFsg==}
peerDependencies:
react: '*'
react-dom: '*'
dependencies:
- '@opentf/utils': 0.27.0
+ '@opentf/std': 0.3.0
+ immer: 10.0.4
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
use-sync-external-store: 1.2.0(react@18.2.0)
dev: false
- /@opentf/std@0.1.1:
- resolution: {integrity: sha512-Op9o//50b1FlNDBDER6ffN8XYlIGv59ngPMbJe/4r1E392BYNk70m3dS6eJZSn/+PYDt9K9oBtnI8MCRESfnOg==}
+ /@opentf/std@0.3.0:
+ resolution: {integrity: sha512-8Dtm0NqgoRi30FAUORo74SEruw2t2YlICxUy9nRpozzpbORCu4drpcAUq4stLsUY0bGHmFSZfZGpdA3wFamcwg==}
dev: false
- /@opentf/utils@0.27.0:
- resolution: {integrity: sha512-O9Geu5zQpDZy4aYoe1w3hfCovNrtOoSq7kYfk8Di9XTbchrvcbIzyCyw8+lUZcgHEsOv4pf+jc0soD2CydQd2g==}
- deprecated: Please use the @opentf/std pkg and checkout our new site at https://js-std.pages.dev
+ /@opentf/std@0.5.1:
+ resolution: {integrity: sha512-WIK/3Zwg8t6XeI3CJEEbK6wrC/uPkR7dk2DNWAhXqfql7NBCPjTb4NdXNSyChqMRY1qk+6E4/l32MaXk9x7+zA==}
dev: false
/@pkgr/core@0.1.1:
@@ -2220,7 +2225,7 @@ packages:
/@types/graceful-fs@4.1.6:
resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==}
dependencies:
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
dev: true
/@types/hast@2.3.4:
@@ -2266,6 +2271,10 @@ packages:
resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==}
dev: true
+ /@types/json-schema@7.0.15:
+ resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
+ dev: true
+
/@types/katex@0.16.7:
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
dev: false
@@ -2298,8 +2307,8 @@ packages:
resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==}
dev: true
- /@types/node@20.11.16:
- resolution: {integrity: sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==}
+ /@types/node@20.12.5:
+ resolution: {integrity: sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==}
dependencies:
undici-types: 5.26.5
dev: true
@@ -2328,6 +2337,10 @@ packages:
resolution: {integrity: sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==}
dev: true
+ /@types/semver@7.5.8:
+ resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==}
+ dev: true
+
/@types/stack-utils@2.0.1:
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
dev: true
@@ -2356,8 +2369,8 @@ packages:
'@types/yargs-parser': 21.0.0
dev: true
- /@typescript-eslint/eslint-plugin@7.3.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3):
- resolution: {integrity: sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==}
+ /@typescript-eslint/eslint-plugin@7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-gKmTNwZnblUdnTIJu3e9kmeRRzV2j1a/LUO27KNNAnIC5zjy1aSvXSRp4rVNlmAoHlQ7HzX42NbKpcSr4jF80A==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
'@typescript-eslint/parser': ^7.0.0
@@ -2367,26 +2380,26 @@ packages:
typescript:
optional: true
dependencies:
- '@eslint-community/regexpp': 4.8.1
- '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3)
- '@typescript-eslint/scope-manager': 7.3.1
- '@typescript-eslint/type-utils': 7.3.1(eslint@8.57.0)(typescript@5.4.3)
- '@typescript-eslint/utils': 7.3.1(eslint@8.57.0)(typescript@5.4.3)
- '@typescript-eslint/visitor-keys': 7.3.1
+ '@eslint-community/regexpp': 4.10.0
+ '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/scope-manager': 7.6.0
+ '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/visitor-keys': 7.6.0
debug: 4.3.4
eslint: 8.57.0
graphemer: 1.4.0
- ignore: 5.2.4
+ ignore: 5.3.1
natural-compare: 1.4.0
- semver: 7.5.4
- ts-api-utils: 1.0.3(typescript@5.4.3)
+ semver: 7.6.0
+ ts-api-utils: 1.3.0(typescript@5.4.3)
typescript: 5.4.3
transitivePeerDependencies:
- supports-color
dev: true
- /@typescript-eslint/parser@7.4.0(eslint@8.57.0)(typescript@5.4.3):
- resolution: {integrity: sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==}
+ /@typescript-eslint/parser@7.6.0(eslint@8.57.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-usPMPHcwX3ZoPWnBnhhorc14NJw9J4HpSXQX4urF2TPKG0au0XhJoZyX62fmvdHONUkmyUe74Hzm1//XA+BoYg==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
@@ -2395,10 +2408,10 @@ packages:
typescript:
optional: true
dependencies:
- '@typescript-eslint/scope-manager': 7.4.0
- '@typescript-eslint/types': 7.4.0
- '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.3)
- '@typescript-eslint/visitor-keys': 7.4.0
+ '@typescript-eslint/scope-manager': 7.6.0
+ '@typescript-eslint/types': 7.6.0
+ '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.3)
+ '@typescript-eslint/visitor-keys': 7.6.0
debug: 4.3.4
eslint: 8.57.0
typescript: 5.4.3
@@ -2414,24 +2427,24 @@ packages:
'@typescript-eslint/visitor-keys': 5.59.5
dev: true
- /@typescript-eslint/scope-manager@7.3.1:
- resolution: {integrity: sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==}
- engines: {node: ^18.18.0 || >=20.0.0}
+ /@typescript-eslint/scope-manager@6.21.0:
+ resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
- '@typescript-eslint/types': 7.3.1
- '@typescript-eslint/visitor-keys': 7.3.1
+ '@typescript-eslint/types': 6.21.0
+ '@typescript-eslint/visitor-keys': 6.21.0
dev: true
- /@typescript-eslint/scope-manager@7.4.0:
- resolution: {integrity: sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==}
+ /@typescript-eslint/scope-manager@7.6.0:
+ resolution: {integrity: sha512-ngttyfExA5PsHSx0rdFgnADMYQi+Zkeiv4/ZxGYUWd0nLs63Ha0ksmp8VMxAIC0wtCFxMos7Lt3PszJssG/E6w==}
engines: {node: ^18.18.0 || >=20.0.0}
dependencies:
- '@typescript-eslint/types': 7.4.0
- '@typescript-eslint/visitor-keys': 7.4.0
+ '@typescript-eslint/types': 7.6.0
+ '@typescript-eslint/visitor-keys': 7.6.0
dev: true
- /@typescript-eslint/type-utils@7.3.1(eslint@8.57.0)(typescript@5.4.3):
- resolution: {integrity: sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==}
+ /@typescript-eslint/type-utils@7.6.0(eslint@8.57.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-NxAfqAPNLG6LTmy7uZgpK8KcuiS2NZD/HlThPXQRGwz6u7MDBWRVliEEl1Gj6U7++kVJTpehkhZzCJLMK66Scw==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
@@ -2440,11 +2453,11 @@ packages:
typescript:
optional: true
dependencies:
- '@typescript-eslint/typescript-estree': 7.3.1(typescript@5.4.3)
- '@typescript-eslint/utils': 7.3.1(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.3)
+ '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.3)
debug: 4.3.4
eslint: 8.57.0
- ts-api-utils: 1.0.3(typescript@5.4.3)
+ ts-api-utils: 1.3.0(typescript@5.4.3)
typescript: 5.4.3
transitivePeerDependencies:
- supports-color
@@ -2455,13 +2468,13 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
- /@typescript-eslint/types@7.3.1:
- resolution: {integrity: sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==}
- engines: {node: ^18.18.0 || >=20.0.0}
+ /@typescript-eslint/types@6.21.0:
+ resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
dev: true
- /@typescript-eslint/types@7.4.0:
- resolution: {integrity: sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==}
+ /@typescript-eslint/types@7.6.0:
+ resolution: {integrity: sha512-h02rYQn8J+MureCvHVVzhl69/GAfQGPQZmOMjG1KfCl7o3HtMSlPaPUAPu6lLctXI5ySRGIYk94clD/AUMCUgQ==}
engines: {node: ^18.18.0 || >=20.0.0}
dev: true
@@ -2486,17 +2499,17 @@ packages:
- supports-color
dev: true
- /@typescript-eslint/typescript-estree@7.3.1(typescript@5.4.3):
- resolution: {integrity: sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==}
- engines: {node: ^18.18.0 || >=20.0.0}
+ /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.3):
+ resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==}
+ engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
- '@typescript-eslint/types': 7.3.1
- '@typescript-eslint/visitor-keys': 7.3.1
+ '@typescript-eslint/types': 6.21.0
+ '@typescript-eslint/visitor-keys': 6.21.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
@@ -2508,8 +2521,8 @@ packages:
- supports-color
dev: true
- /@typescript-eslint/typescript-estree@7.4.0(typescript@5.4.3):
- resolution: {integrity: sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==}
+ /@typescript-eslint/typescript-estree@7.6.0(typescript@5.4.3):
+ resolution: {integrity: sha512-+7Y/GP9VuYibecrCQWSKgl3GvUM5cILRttpWtnAu8GNL9j11e4tbuGZmZjJ8ejnKYyBRb2ddGQ3rEFCq3QjMJw==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
typescript: '*'
@@ -2517,14 +2530,14 @@ packages:
typescript:
optional: true
dependencies:
- '@typescript-eslint/types': 7.4.0
- '@typescript-eslint/visitor-keys': 7.4.0
+ '@typescript-eslint/types': 7.6.0
+ '@typescript-eslint/visitor-keys': 7.6.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
- minimatch: 9.0.3
- semver: 7.5.4
- ts-api-utils: 1.0.3(typescript@5.4.3)
+ minimatch: 9.0.4
+ semver: 7.6.0
+ ts-api-utils: 1.3.0(typescript@5.4.3)
typescript: 5.4.3
transitivePeerDependencies:
- supports-color
@@ -2550,18 +2563,18 @@ packages:
- typescript
dev: true
- /@typescript-eslint/utils@7.3.1(eslint@8.57.0)(typescript@5.4.3):
- resolution: {integrity: sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==}
- engines: {node: ^18.18.0 || >=20.0.0}
+ /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==}
+ engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
- eslint: ^8.56.0
+ eslint: ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
'@types/json-schema': 7.0.13
'@types/semver': 7.5.2
- '@typescript-eslint/scope-manager': 7.3.1
- '@typescript-eslint/types': 7.3.1
- '@typescript-eslint/typescript-estree': 7.3.1(typescript@5.4.3)
+ '@typescript-eslint/scope-manager': 6.21.0
+ '@typescript-eslint/types': 6.21.0
+ '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.3)
eslint: 8.57.0
semver: 7.5.4
transitivePeerDependencies:
@@ -2569,6 +2582,25 @@ packages:
- typescript
dev: true
+ /@typescript-eslint/utils@7.6.0(eslint@8.57.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-x54gaSsRRI+Nwz59TXpCsr6harB98qjXYzsRxGqvA5Ue3kQH+FxS7FYU81g/omn22ML2pZJkisy6Q+ElK8pBCA==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ eslint: ^8.56.0
+ dependencies:
+ '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
+ '@types/json-schema': 7.0.15
+ '@types/semver': 7.5.8
+ '@typescript-eslint/scope-manager': 7.6.0
+ '@typescript-eslint/types': 7.6.0
+ '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.3)
+ eslint: 8.57.0
+ semver: 7.6.0
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+ dev: true
+
/@typescript-eslint/visitor-keys@5.59.5:
resolution: {integrity: sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -2577,19 +2609,19 @@ packages:
eslint-visitor-keys: 3.4.3
dev: true
- /@typescript-eslint/visitor-keys@7.3.1:
- resolution: {integrity: sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==}
- engines: {node: ^18.18.0 || >=20.0.0}
+ /@typescript-eslint/visitor-keys@6.21.0:
+ resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==}
+ engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
- '@typescript-eslint/types': 7.3.1
+ '@typescript-eslint/types': 6.21.0
eslint-visitor-keys: 3.4.3
dev: true
- /@typescript-eslint/visitor-keys@7.4.0:
- resolution: {integrity: sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==}
+ /@typescript-eslint/visitor-keys@7.6.0:
+ resolution: {integrity: sha512-4eLB7t+LlNUmXzfOu1VAIAdkjbu5xNSerURS9X/S5TUKWFRpXRQZbmtPqgKmYx8bj3J0irtQXSiWAOY82v+cgw==}
engines: {node: ^18.18.0 || >=20.0.0}
dependencies:
- '@typescript-eslint/types': 7.4.0
+ '@typescript-eslint/types': 7.6.0
eslint-visitor-keys: 3.4.3
dev: true
@@ -2622,8 +2654,8 @@ packages:
resolution: {integrity: sha512-Sp6PV0K9D/3f8fSbCubqhfmBFH8XbngZCBOCF+aExyGqnz2etmw+KYvbQ/JxYvYX5KPaSxM+asFQwoP2RHl5cg==}
dev: false
- /@xterm/addon-fit@0.9.0(@xterm/xterm@5.4.0):
- resolution: {integrity: sha512-hDlPPbTVPYyvwXu/asW8HbJkI/2RMi0cMaJnBZYVeJB0SWP2NeESMCNr+I7CvBlyI0sAxpxOg8Wk4OMkxBz9WA==}
+ /@xterm/addon-fit@0.10.0(@xterm/xterm@5.4.0):
+ resolution: {integrity: sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==}
peerDependencies:
'@xterm/xterm': ^5.0.0
dependencies:
@@ -2648,11 +2680,27 @@ packages:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
acorn: 8.10.0
+ dev: false
+
+ /acorn-jsx@5.3.2(acorn@8.11.3):
+ resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
+ peerDependencies:
+ acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
+ dependencies:
+ acorn: 8.11.3
+ dev: true
/acorn@8.10.0:
resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==}
engines: {node: '>=0.4.0'}
hasBin: true
+ dev: false
+
+ /acorn@8.11.3:
+ resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+ dev: true
/ajv@6.12.6:
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
@@ -3254,7 +3302,7 @@ packages:
layout-base: 1.0.2
dev: false
- /cosmiconfig-typescript-loader@5.0.0(@types/node@20.11.16)(cosmiconfig@8.3.6)(typescript@5.4.3):
+ /cosmiconfig-typescript-loader@5.0.0(@types/node@20.12.5)(cosmiconfig@8.3.6)(typescript@5.4.3):
resolution: {integrity: sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==}
engines: {node: '>=v16'}
peerDependencies:
@@ -3262,7 +3310,7 @@ packages:
cosmiconfig: '>=8.2'
typescript: '>=4'
dependencies:
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
cosmiconfig: 8.3.6(typescript@5.4.3)
jiti: 1.21.0
typescript: 5.4.3
@@ -3284,7 +3332,7 @@ packages:
typescript: 5.4.3
dev: true
- /create-jest@29.7.0(@types/node@20.11.16):
+ /create-jest@29.7.0(@types/node@20.12.5):
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -3293,7 +3341,7 @@ packages:
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
- jest-config: 29.7.0(@types/node@20.11.16)
+ jest-config: 29.7.0(@types/node@20.12.5)
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -3956,7 +4004,7 @@ packages:
eslint-plugin-turbo: 1.13.0(eslint@8.57.0)
dev: true
- /eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@7.3.1)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3):
+ /eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@7.6.0)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3):
resolution: {integrity: sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@@ -3969,10 +4017,32 @@ packages:
jest:
optional: true
dependencies:
- '@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.3)
'@typescript-eslint/utils': 5.59.5(eslint@8.57.0)(typescript@5.4.3)
eslint: 8.57.0
- jest: 29.7.0(@types/node@20.11.16)
+ jest: 29.7.0(@types/node@20.12.5)
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+ dev: true
+
+ /eslint-plugin-jest@28.2.0(@typescript-eslint/eslint-plugin@7.6.0)(eslint@8.57.0)(jest@29.7.0)(typescript@5.4.3):
+ resolution: {integrity: sha512-yRDti/a+f+SMSmNTiT9/M/MzXGkitl8CfzUxnpoQcTyfq8gUrXMriVcWU36W1X6BZSUoyUCJrDAWWUA2N4hE5g==}
+ engines: {node: ^16.10.0 || ^18.12.0 || >=20.0.0}
+ peerDependencies:
+ '@typescript-eslint/eslint-plugin': ^6.0.0 || ^7.0.0
+ eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
+ jest: '*'
+ peerDependenciesMeta:
+ '@typescript-eslint/eslint-plugin':
+ optional: true
+ jest:
+ optional: true
+ dependencies:
+ '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.3)
+ '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.3)
+ eslint: 8.57.0
+ jest: 29.7.0(@types/node@20.12.5)
transitivePeerDependencies:
- supports-color
- typescript
@@ -4057,7 +4127,7 @@ packages:
file-entry-cache: 6.0.1
find-up: 5.0.0
glob-parent: 6.0.2
- globals: 13.20.0
+ globals: 13.24.0
graphemer: 1.4.0
ignore: 5.2.4
imurmurhash: 0.1.4
@@ -4080,8 +4150,8 @@ packages:
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
- acorn: 8.10.0
- acorn-jsx: 5.3.2(acorn@8.10.0)
+ acorn: 8.11.3
+ acorn-jsx: 5.3.2(acorn@8.11.3)
eslint-visitor-keys: 3.4.3
dev: true
@@ -4297,7 +4367,7 @@ packages:
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
engines: {node: ^10.12.0 || >=12.0.0}
dependencies:
- flat-cache: 3.0.4
+ flat-cache: 3.2.0
dev: true
/fill-range@7.0.1:
@@ -4329,16 +4399,17 @@ packages:
pkg-dir: 4.2.0
dev: true
- /flat-cache@3.0.4:
- resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==}
+ /flat-cache@3.2.0:
+ resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==}
engines: {node: ^10.12.0 || >=12.0.0}
dependencies:
- flatted: 3.2.7
+ flatted: 3.3.1
+ keyv: 4.5.4
rimraf: 3.0.2
dev: true
- /flatted@3.2.7:
- resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==}
+ /flatted@3.3.1:
+ resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
dev: true
/flexsearch@0.7.43:
@@ -4530,8 +4601,8 @@ packages:
engines: {node: '>=4'}
dev: true
- /globals@13.20.0:
- resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==}
+ /globals@13.24.0:
+ resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==}
engines: {node: '>=8'}
dependencies:
type-fest: 0.20.2
@@ -4844,6 +4915,15 @@ packages:
engines: {node: '>= 4'}
dev: true
+ /ignore@5.3.1:
+ resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==}
+ engines: {node: '>= 4'}
+ dev: true
+
+ /immer@10.0.4:
+ resolution: {integrity: sha512-cuBuGK40P/sk5IzWa9QPUaAdvPHjkk1c+xYsd9oZw+YQQEV+10G0P5uMpGctZZKnyQ+ibRO08bD25nWLmYi2pw==}
+ dev: false
+
/import-fresh@3.3.0:
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
engines: {node: '>=6'}
@@ -5252,7 +5332,7 @@ packages:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.1
@@ -5273,7 +5353,7 @@ packages:
- supports-color
dev: true
- /jest-cli@29.7.0(@types/node@20.11.16):
+ /jest-cli@29.7.0(@types/node@20.12.5):
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -5287,10 +5367,10 @@ packages:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
- create-jest: 29.7.0(@types/node@20.11.16)
+ create-jest: 29.7.0(@types/node@20.12.5)
exit: 0.1.2
import-local: 3.1.0
- jest-config: 29.7.0(@types/node@20.11.16)
+ jest-config: 29.7.0(@types/node@20.12.5)
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.1
@@ -5301,7 +5381,7 @@ packages:
- ts-node
dev: true
- /jest-config@29.7.0(@types/node@20.11.16):
+ /jest-config@29.7.0(@types/node@20.12.5):
resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@@ -5316,7 +5396,7 @@ packages:
'@babel/core': 7.21.0
'@jest/test-sequencer': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
babel-jest: 29.7.0(@babel/core@7.21.0)
chalk: 4.1.2
ci-info: 3.8.0
@@ -5376,7 +5456,7 @@ packages:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
jest-mock: 29.7.0
jest-util: 29.7.0
dev: true
@@ -5392,7 +5472,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.6
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@@ -5443,7 +5523,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
jest-util: 29.7.0
dev: true
@@ -5498,7 +5578,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@@ -5529,7 +5609,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
cjs-module-lexer: 1.2.2
collect-v8-coverage: 1.0.1
@@ -5581,7 +5661,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
chalk: 4.1.2
ci-info: 3.8.0
graceful-fs: 4.2.11
@@ -5606,7 +5686,7 @@ packages:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@@ -5618,13 +5698,13 @@ packages:
resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
- '@types/node': 20.11.16
+ '@types/node': 20.12.5
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
dev: true
- /jest@29.7.0(@types/node@20.11.16):
+ /jest@29.7.0(@types/node@20.12.5):
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -5637,7 +5717,7 @@ packages:
'@jest/core': 29.7.0
'@jest/types': 29.6.3
import-local: 3.1.0
- jest-cli: 29.7.0(@types/node@20.11.16)
+ jest-cli: 29.7.0(@types/node@20.12.5)
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@@ -5677,6 +5757,10 @@ packages:
hasBin: true
dev: true
+ /json-buffer@3.0.1:
+ resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
+ dev: true
+
/json-parse-even-better-errors@2.3.1:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
dev: true
@@ -5720,6 +5804,12 @@ packages:
commander: 8.3.0
dev: false
+ /keyv@4.5.4:
+ resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
+ dependencies:
+ json-buffer: 3.0.1
+ dev: true
+
/khroma@2.1.0:
resolution: {integrity: sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==}
dev: false
@@ -6652,6 +6742,13 @@ packages:
brace-expansion: 2.0.1
dev: true
+ /minimatch@9.0.4:
+ resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==}
+ engines: {node: '>=16 || 14 >=14.17'}
+ dependencies:
+ brace-expansion: 2.0.1
+ dev: true
+
/minimist-options@4.1.0:
resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==}
engines: {node: '>= 6'}
@@ -7648,6 +7745,14 @@ packages:
lru-cache: 6.0.0
dev: true
+ /semver@7.6.0:
+ resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
+ engines: {node: '>=10'}
+ hasBin: true
+ dependencies:
+ lru-cache: 6.0.0
+ dev: true
+
/set-blocking@2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
dev: true
@@ -8164,6 +8269,15 @@ packages:
typescript: 5.4.3
dev: true
+ /ts-api-utils@1.3.0(typescript@5.4.3):
+ resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==}
+ engines: {node: '>=16'}
+ peerDependencies:
+ typescript: '>=4.2.0'
+ dependencies:
+ typescript: 5.4.3
+ dev: true
+
/ts-dedent@2.2.0:
resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==}
engines: {node: '>=6.10'}