@e280/stz 0.0.0-35 → 0.0.0-36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -2
- package/s/constructor.ts +3 -0
- package/s/index.ts +3 -1
- package/s/pipe.ts +7 -8
- package/s/templating.ts +22 -0
- package/x/constructor.d.ts +1 -0
- package/x/constructor.js +2 -0
- package/x/constructor.js.map +1 -0
- package/x/index.d.ts +3 -1
- package/x/index.js +3 -1
- package/x/index.js.map +1 -1
- package/x/pipe.d.ts +3 -3
- package/x/pipe.js +5 -5
- package/x/pipe.js.map +1 -1
- package/x/templating.d.ts +6 -0
- package/x/templating.js +11 -0
- package/x/templating.js.map +1 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e280/stz",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-36",
|
|
4
4
|
"description": "everyday ts fns for everything",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chase Moskal <chasemoskal@gmail.com>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@e280/science": "^0.0.6",
|
|
30
|
-
"@types/node": "^24.
|
|
30
|
+
"@types/node": "^24.3.0",
|
|
31
31
|
"npm-run-all": "^4.1.5",
|
|
32
32
|
"typescript": "^5.9.2"
|
|
33
33
|
},
|
package/s/constructor.ts
ADDED
package/s/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./queue/queue.js"
|
|
|
17
17
|
|
|
18
18
|
export * from "./coalesce.js"
|
|
19
19
|
export * from "./concurrent.js"
|
|
20
|
+
export * from "./constructor.js"
|
|
20
21
|
export * from "./deadline.js"
|
|
21
22
|
export * from "./dedupe.js"
|
|
22
23
|
export * from "./defer.js"
|
|
@@ -32,8 +33,9 @@ export * from "./nap.js"
|
|
|
32
33
|
export * from "./ob.js"
|
|
33
34
|
export * from "./once.js"
|
|
34
35
|
export * from "./pipe.js"
|
|
35
|
-
export * from "./repeat.js"
|
|
36
36
|
export * from "./pubsub.js"
|
|
37
|
+
export * from "./repeat.js"
|
|
38
|
+
export * from "./templating.js"
|
|
37
39
|
export * from "./time.js"
|
|
38
40
|
export * from "./trash.js"
|
|
39
41
|
|
package/s/pipe.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
export type
|
|
2
|
+
export type Piper<I, O> = (input: I) => O
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new this(input)
|
|
8
|
-
}
|
|
4
|
+
export function pipe<I>(input: I) {
|
|
5
|
+
return new Pipe(input)
|
|
6
|
+
}
|
|
9
7
|
|
|
8
|
+
export class Pipe<I> {
|
|
10
9
|
#input: I
|
|
11
10
|
|
|
12
11
|
constructor(input: I) {
|
|
13
12
|
this.#input = input
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
to<O>(
|
|
17
|
-
return new Pipe(
|
|
15
|
+
to<O>(fn: Piper<I, O>) {
|
|
16
|
+
return new Pipe(fn(this.#input))
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
done() {
|
package/s/templating.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
export type TemplateParts = {
|
|
3
|
+
strings: TemplateStringsArray
|
|
4
|
+
values: any[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function templateParts(
|
|
8
|
+
strings: TemplateStringsArray,
|
|
9
|
+
...values: any[]
|
|
10
|
+
): TemplateParts {
|
|
11
|
+
|
|
12
|
+
return {strings, values}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function templateString(strings: TemplateStringsArray, ...values: any[]) {
|
|
16
|
+
const lastIndex = strings.length - 1
|
|
17
|
+
return strings
|
|
18
|
+
.slice(0, lastIndex)
|
|
19
|
+
.reduce((a, b, c) => a + b + values[c], "")
|
|
20
|
+
+ strings[lastIndex]
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Constructor<T extends {} = {}> = new (...args: any[]) => T;
|
package/x/constructor.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constructor.js","sourceRoot":"","sources":["../s/constructor.ts"],"names":[],"mappings":""}
|
package/x/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./deep/deep.js";
|
|
|
12
12
|
export * from "./queue/queue.js";
|
|
13
13
|
export * from "./coalesce.js";
|
|
14
14
|
export * from "./concurrent.js";
|
|
15
|
+
export * from "./constructor.js";
|
|
15
16
|
export * from "./deadline.js";
|
|
16
17
|
export * from "./dedupe.js";
|
|
17
18
|
export * from "./defer.js";
|
|
@@ -27,7 +28,8 @@ export * from "./nap.js";
|
|
|
27
28
|
export * from "./ob.js";
|
|
28
29
|
export * from "./once.js";
|
|
29
30
|
export * from "./pipe.js";
|
|
30
|
-
export * from "./repeat.js";
|
|
31
31
|
export * from "./pubsub.js";
|
|
32
|
+
export * from "./repeat.js";
|
|
33
|
+
export * from "./templating.js";
|
|
32
34
|
export * from "./time.js";
|
|
33
35
|
export * from "./trash.js";
|
package/x/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./deep/deep.js";
|
|
|
12
12
|
export * from "./queue/queue.js";
|
|
13
13
|
export * from "./coalesce.js";
|
|
14
14
|
export * from "./concurrent.js";
|
|
15
|
+
export * from "./constructor.js";
|
|
15
16
|
export * from "./deadline.js";
|
|
16
17
|
export * from "./dedupe.js";
|
|
17
18
|
export * from "./defer.js";
|
|
@@ -27,8 +28,9 @@ export * from "./nap.js";
|
|
|
27
28
|
export * from "./ob.js";
|
|
28
29
|
export * from "./once.js";
|
|
29
30
|
export * from "./pipe.js";
|
|
30
|
-
export * from "./repeat.js";
|
|
31
31
|
export * from "./pubsub.js";
|
|
32
|
+
export * from "./repeat.js";
|
|
33
|
+
export * from "./templating.js";
|
|
32
34
|
export * from "./time.js";
|
|
33
35
|
export * from "./trash.js";
|
|
34
36
|
//# sourceMappingURL=index.js.map
|
package/x/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../s/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAE7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../s/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAE7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA"}
|
package/x/pipe.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Piper<I, O> = (input: I) => O;
|
|
2
|
+
export declare function pipe<I>(input: I): Pipe<I>;
|
|
2
3
|
export declare class Pipe<I> {
|
|
3
4
|
#private;
|
|
4
|
-
static with<I>(input: I): Pipe<I>;
|
|
5
5
|
constructor(input: I);
|
|
6
|
-
to<O>(
|
|
6
|
+
to<O>(fn: Piper<I, O>): Pipe<O>;
|
|
7
7
|
done(): I;
|
|
8
8
|
}
|
package/x/pipe.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
export function pipe(input) {
|
|
2
|
+
return new Pipe(input);
|
|
3
|
+
}
|
|
1
4
|
export class Pipe {
|
|
2
|
-
static with(input) {
|
|
3
|
-
return new this(input);
|
|
4
|
-
}
|
|
5
5
|
#input;
|
|
6
6
|
constructor(input) {
|
|
7
7
|
this.#input = input;
|
|
8
8
|
}
|
|
9
|
-
to(
|
|
10
|
-
return new Pipe(
|
|
9
|
+
to(fn) {
|
|
10
|
+
return new Pipe(fn(this.#input));
|
|
11
11
|
}
|
|
12
12
|
done() {
|
|
13
13
|
return this.#input;
|
package/x/pipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../s/pipe.ts"],"names":[],"mappings":"AAGA,MAAM,
|
|
1
|
+
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../s/pipe.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,IAAI,CAAI,KAAQ;IAC/B,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;AACvB,CAAC;AAED,MAAM,OAAO,IAAI;IAChB,MAAM,CAAG;IAET,YAAY,KAAQ;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,EAAE,CAAI,EAAe;QACpB,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;IAED,IAAI;QACH,OAAO,IAAI,CAAC,MAAM,CAAA;IACnB,CAAC;CACD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type TemplateParts = {
|
|
2
|
+
strings: TemplateStringsArray;
|
|
3
|
+
values: any[];
|
|
4
|
+
};
|
|
5
|
+
export declare function templateParts(strings: TemplateStringsArray, ...values: any[]): TemplateParts;
|
|
6
|
+
export declare function templateString(strings: TemplateStringsArray, ...values: any[]): string;
|
package/x/templating.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function templateParts(strings, ...values) {
|
|
2
|
+
return { strings, values };
|
|
3
|
+
}
|
|
4
|
+
export function templateString(strings, ...values) {
|
|
5
|
+
const lastIndex = strings.length - 1;
|
|
6
|
+
return strings
|
|
7
|
+
.slice(0, lastIndex)
|
|
8
|
+
.reduce((a, b, c) => a + b + values[c], "")
|
|
9
|
+
+ strings[lastIndex];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=templating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templating.js","sourceRoot":"","sources":["../s/templating.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,aAAa,CAC3B,OAA6B,EAC7B,GAAG,MAAa;IAGjB,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,CAAA;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAA6B,EAAE,GAAG,MAAa;IAC7E,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;IACpC,OAAO,OAAO;SACZ,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC;SACnB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;UACxC,OAAO,CAAC,SAAS,CAAC,CAAA;AACvB,CAAC"}
|