functionalscript 0.0.155 → 0.0.162

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/array/index.js ADDED
@@ -0,0 +1,90 @@
1
+ const option = require('../option')
2
+
3
+ /**
4
+ * @template T
5
+ * @typedef {readonly T[]} Array
6
+ */
7
+
8
+ /**
9
+ * @template T
10
+ * @typedef {readonly [T]} Array1
11
+ */
12
+
13
+ /** @typedef {0} Index1 */
14
+
15
+ /**
16
+ * @template T
17
+ * @typedef {readonly [T, T]} Array2
18
+ */
19
+
20
+ /** @typedef {0|1} Index2 */
21
+
22
+ /**
23
+ * @template T
24
+ * @typedef {readonly [T, T, T]} Array3
25
+ */
26
+
27
+ /** @typedef {0|1|2} Index3 */
28
+
29
+ /**
30
+ * @template T
31
+ * @typedef {readonly [T, T, T, T]} Array4
32
+ */
33
+
34
+ /** @typedef {0|1|2|3} Index4 */
35
+
36
+ /**
37
+ * @template T
38
+ * @typedef {readonly [T, T, T, T, T]} Array5
39
+ */
40
+
41
+ /** @typedef {0|1|2|3|4} Index5 */
42
+
43
+ /** @type {<T>(_: Array<T>) => Array<T>} */
44
+ const uncheckTail = a => a.slice(1)
45
+
46
+ /** @type {<T>(_: Array<T>) => Array<T>} */
47
+ const uncheckHead = a => a.slice(0, -1)
48
+
49
+ /** @type {<T>(_: Array<T>) => T|undefined} */
50
+ const first = a => a[0]
51
+
52
+ /** @type {<T>(_: Array<T>) => T|undefined} */
53
+ const last = a => a[a.length - 1]
54
+
55
+ /** @type {<T>(_: Array<T>) => Array<T>|undefined} */
56
+ const tail = a => a.length === 0 ? undefined : uncheckTail(a)
57
+
58
+ /** @type {<T>(_: Array<T>) => readonly [T, Array<T>]|undefined} */
59
+ const splitFirst = a => {
60
+ /** @typedef {typeof a[0]} T*/
61
+ /** @type {(_: T) => readonly [T, Array<T>]} */
62
+ const split = first => [first, uncheckTail(a)]
63
+ return option.map(split)(a[0])
64
+ }
65
+
66
+ /** @type {<T>(_: Array<T>) => Array<T>|undefined} */
67
+ const head = a => a.length === 0 ? undefined : uncheckHead(a)
68
+
69
+ /** @type {<T>(_: Array<T>) => readonly [Array<T>, T]|undefined} */
70
+ const splitLast = a => {
71
+ /** @typedef {typeof a[0]} T*/
72
+ /** @type {(_: T) => readonly [Array<T>, T]} */
73
+ const split = x => [uncheckHead(a), x]
74
+ return option.map(split)(last(a))
75
+ }
76
+
77
+ module.exports = {
78
+ /** @readnly */
79
+ first,
80
+ /** @readonly */
81
+ last,
82
+ /** @readonly */
83
+ head,
84
+ /** @readonly */
85
+ tail,
86
+ /** @readonly */
87
+ splitFirst,
88
+ /** @readonly */
89
+ splitLast,
90
+ }
@@ -0,0 +1,112 @@
1
+ const { todo } = require('../../dev')
2
+ const { pipe } = require('../../func')
3
+ const mapReduce = require('../../map-reduce')
4
+
5
+ /**
6
+ * @template T
7
+ * @typedef {Promise<T>|T} PromiseOrValue
8
+ */
9
+
10
+ /** @type {<T, R>(f: (value: T) => PromiseOrValue<R>) => (c: AsyncIterable<T>) => AsyncIterable<R>} */
11
+ const map = f => c => ({
12
+ async *[Symbol.asyncIterator]() {
13
+ for await (const i of c) {
14
+ yield f(i)
15
+ }
16
+ }
17
+ })
18
+
19
+ /** @type {<T>(c: AsyncIterable<AsyncIterable<T>>) => AsyncIterable<T>} */
20
+ const flatten = c => ({
21
+ async *[Symbol.asyncIterator]() {
22
+ for await (const i of c) {
23
+ yield *i
24
+ }
25
+ }
26
+ })
27
+
28
+ /** @type {<T>(f: (value: T) => Promise<boolean>) => (c: AsyncIterable<T>) => AsyncIterable<T>} */
29
+ const filter = f => c => ({
30
+ async *[Symbol.asyncIterator]() {
31
+ for await (const i of c) {
32
+ if (await f(i)) {
33
+ yield i
34
+ }
35
+ }
36
+ }
37
+ })
38
+
39
+ /** @type {<T, R>(f: (value: T) => AsyncIterable<R>) => (c: AsyncIterable<T>) => AsyncIterable<R>} */
40
+ const flatMap = f => pipe(map(f))(flatten)
41
+
42
+ /**
43
+ * @template A
44
+ * @template T
45
+ * @typedef {(accumulator: A) => (value: T) => PromiseOrValue<A>} Merge
46
+ */
47
+
48
+ /** @type {<A, T>(f: Merge<A, T>) => (init: A) => (c: AsyncIterable<T>) => Promise<A>} */
49
+ const reduce = merge => init => async c => {
50
+ let result = init
51
+ for await (const i of c) {
52
+ result = await merge(result)(i)
53
+ }
54
+ return result
55
+ }
56
+
57
+ /** @type {<A, T>(f: Merge<A, T>) => (init: A) => (c: AsyncIterable<T>) => AsyncIterable<A>} */
58
+ const exclusiveScan = reduceFn => init => c => ({
59
+ async *[Symbol.asyncIterator]() {
60
+ let result = init
61
+ for await (const i of c) {
62
+ result = await reduceFn(result)(i)
63
+ yield result
64
+ }
65
+ }
66
+ })
67
+
68
+ /** @type {<A, T>(f: Merge<A, T>) => (init: A) => (c: AsyncIterable<T>) => AsyncIterable<A>} */
69
+ const inclusiveScan = reduceFn => init => {
70
+ const e = exclusiveScan(reduceFn)(init)
71
+ return c => ({
72
+ async *[Symbol.asyncIterator]() {
73
+ yield init
74
+ yield *e(c)
75
+ }
76
+ })
77
+ }
78
+
79
+ /** @type {<T>(iterable: Iterable<T>) => AsyncIterable<T>} */
80
+ const cast = iterable => ({
81
+ async *[Symbol.asyncIterator]() {
82
+ for (const i of iterable) {
83
+ yield i
84
+ }
85
+ }
86
+ })
87
+
88
+ /** @type {<I, S, R>(op: mapReduce.Operation<I, S, R>) => (_: AsyncIterable<I>) => Promise<R>} */
89
+ const apply = ({ merge, init, result }) => async c => result(await reduce(merge)(init)(c))
90
+
91
+ const sum = apply(mapReduce.sum)
92
+
93
+ module.exports = {
94
+ /** @readonly */
95
+ apply,
96
+ /** @readonly */
97
+ cast,
98
+ /** @readonly */
99
+ map,
100
+ /** @readonly */
101
+ filter,
102
+ /** @readonly */
103
+ flatMap,
104
+ /** @readonly */
105
+ reduce,
106
+ /** @readonly */
107
+ sum,
108
+ /** @readonly */
109
+ exclusiveScan,
110
+ /** @readonly */
111
+ inclusiveScan,
112
+ }
@@ -0,0 +1,24 @@
1
+ const { cast, map, filter, flatMap, sum } = require('.')
2
+
3
+ const test = async () => {
4
+ {
5
+ const a = cast([1, 2, 3])
6
+ const m = map(async x => x * x)(a)
7
+ const result = await sum(m)
8
+ if (result !== 14) { throw 'filter' }
9
+ }
10
+ {
11
+ const a = cast([1, 2, 3, 4])
12
+ const f = filter(async x => x !== 2)(a)
13
+ const result = await sum(f)
14
+ if (result !== 8) { throw 'filter' }
15
+ }
16
+ {
17
+ const a = cast([1, 2])
18
+ const f = flatMap(x => cast([x, x * x]))(a)
19
+ const result = await sum(f)
20
+ if (result !== 8) { throw 'filter' }
21
+ }
22
+ }
23
+
24
+ test()
File without changes
@@ -1,35 +1,35 @@
1
- const { index3, index5 } = require('./cmp')
1
+ const { index3, index5 } = require('../cmp')
2
2
 
3
3
  /**
4
4
  * @template T
5
- * @typedef {import('./lazy').Lazy<T>} Lazy
5
+ * @typedef {() => T} Lazy
6
6
  */
7
7
 
8
8
  /**
9
9
  * @template T
10
- * @typedef {import('./cmp').Cmp<T>} Cmp
10
+ * @typedef {import('../cmp').Cmp<T>} Cmp
11
11
  */
12
12
 
13
13
  /**
14
14
  * @template T
15
- * @typedef {import('./array').Array1<T>} Array1
15
+ * @typedef {import('../array').Array1<T>} Array1
16
16
  */
17
17
 
18
18
  /**
19
19
  * @template T
20
- * @typedef {import('./array').Array2<T>} Array2
20
+ * @typedef {import('../array').Array2<T>} Array2
21
21
  */
22
22
 
23
23
  /**
24
24
  * @template T
25
- * @typedef {import('./array').Array3<T>} Array3
25
+ * @typedef {import('../array').Array3<T>} Array3
26
26
  */
27
27
 
28
- /** @typedef {import('./array').Index2} Index2 */
28
+ /** @typedef {import('../array').Index2} Index2 */
29
29
 
30
- /** @typedef {import('./array').Index3} Index3 */
30
+ /** @typedef {import('../array').Index3} Index3 */
31
31
 
32
- /** @typedef {import('./array').Index5} Index5 */
32
+ /** @typedef {import('../array').Index5} Index5 */
33
33
 
34
34
  //
35
35
 
@@ -55,27 +55,37 @@ const { index3, index5 } = require('./cmp')
55
55
 
56
56
  /**
57
57
  * @template T
58
- * @typedef {Leaf1<T>|Leaf2<T>|Branch3<T>|Branch5<T>} TNode
58
+ * @typedef { Leaf1<T> | Leaf2<T> | Branch3<T> | Branch5<T>} TNode
59
+ */
60
+
61
+ /** @typedef {{ readonly done: false }} NotFoundDone */
62
+
63
+ /**
64
+ * @template T
65
+ * @typedef {{
66
+ * readonly done: true
67
+ * readonly value: T
68
+ * }} FoundDone
59
69
  */
60
70
 
61
71
  /**
62
72
  * @template T
63
- * @typedef {{ done: false } | { done: true, value: T }} Done
73
+ * @typedef { NotFoundDone | FoundDone<T> } Done
64
74
  */
65
75
 
66
76
  /**
67
77
  * @template T
68
- * @typedef {{ replace: TNode<T> }} Replace
78
+ * @typedef {{ readonly replace: TNode<T> }} Replace
69
79
  */
70
80
 
71
81
  /**
72
82
  * @template T
73
- * @typedef {{ overflow: Branch3<T> }} Overflow
83
+ * @typedef {{ readonly overflow: Branch3<T> }} Overflow
74
84
  */
75
85
 
76
86
  /**
77
87
  * @template T
78
- * @typedef {Done<T> | Replace<T> | Overflow<T>} Result
88
+ * @typedef { Done<T> | Replace<T> | Overflow<T> } Result
79
89
  */
80
90
 
81
91
  /** @typedef {<T>(_: Lazy<T>) => (_: Leaf1<T>) => Result<T>} InLeaf1 */
@@ -85,35 +95,35 @@ const { index3, index5 } = require('./cmp')
85
95
 
86
96
  /**
87
97
  * @typedef {{
88
- * leaf1: InLeaf1
89
- * leaf2_left: InLeaf2
90
- * leaf2_right: InLeaf2
91
- * branch3: InBranch3
92
- * branch5_left: InBranch5
93
- * branch5_right: InBranch5
98
+ * readonly leaf1: InLeaf1
99
+ * readonly leaf2_left: InLeaf2
100
+ * readonly leaf2_right: InLeaf2
101
+ * readonly branch3: InBranch3
102
+ * readonly branch5_left: InBranch5
103
+ * readonly branch5_right: InBranch5
94
104
  * }} Found
95
105
  */
96
106
 
97
107
  /**
98
108
  * @typedef {{
99
- * leaf1_left: InLeaf1
100
- * leaf1_right: InLeaf1
101
- * leaf2_left: InLeaf2
102
- * leaf2_middle: InLeaf2
103
- * leaf2_right: InLeaf2
109
+ * readonly leaf1_left: InLeaf1
110
+ * readonly leaf1_right: InLeaf1
111
+ * readonly leaf2_left: InLeaf2
112
+ * readonly leaf2_middle: InLeaf2
113
+ * readonly leaf2_right: InLeaf2
104
114
  * }} NotFound
105
115
  */
106
116
 
107
117
  /**
108
118
  * @typedef {{
109
- * found: Found
110
- * notFound: NotFound
119
+ * readonly found: Found
120
+ * readonly notFound: NotFound
111
121
  * }} Visitor
112
122
  */
113
123
 
114
124
  /**
115
125
  * @template T
116
- * @typedef {readonly [TNode<T>, T, TNode<T>, T, TNode<T>, T, TNode<T>]} Branch7
126
+ * @typedef { readonly [TNode<T>, T, TNode<T>, T, TNode<T>, T, TNode<T>] } Branch7
117
127
  */
118
128
 
119
129
  /** @type {<T>(n: Branch7<T>) => Branch3<T>} */
@@ -221,7 +231,7 @@ const visit = ({ found, notFound }) => cmp => {
221
231
  }
222
232
  }
223
233
 
224
- /** @type {<T>(_: T) => Done<T>} */
234
+ /** @type { <T>(_: T) => Done<T> } */
225
235
  const found = value => ({ done: true, value })
226
236
 
227
237
  /** @type {Found} */
@@ -233,7 +243,7 @@ const foundGet = {
233
243
  branch5_left: () => ([, value]) => found(value),
234
244
  branch5_right: () => ([, , , value]) => found(value),
235
245
  }
236
- /** @type {() => () => { done: false }} */
246
+ /** @type { () => () => NotFoundDone } */
237
247
  const notFound = () => () => ({ done: false })
238
248
 
239
249
  /** @type {NotFound} */
@@ -245,7 +255,7 @@ const notFoundGet = {
245
255
  leaf2_right: notFound,
246
256
  }
247
257
 
248
- /** @type {<T>(_: TNode<T>) => Replace<T>} */
258
+ /** @type { <T>(_: TNode<T>) => Replace<T> } */
249
259
  const replace = node => ({ replace: node })
250
260
 
251
261
  /** @type {Found} */
@@ -288,6 +298,7 @@ const getOrInsertVisitor = {
288
298
  notFound: notFoundInsert,
289
299
  }
290
300
 
301
+ /** @type {Visitor} */
291
302
  const replaceVisitor = {
292
303
  found: foundReplace,
293
304
  notFound: notFoundGet,
@@ -324,7 +335,7 @@ module.exports = {
324
335
  values,
325
336
  /**
326
337
  * @readonly
327
- * @type {<T>(cmp: Cmp<T>) => (node: TNode<T>) => T|undefined}
338
+ * @type { <T>(cmp: Cmp<T>) => (node: TNode<T>) => T|undefined }
328
339
  */
329
340
  getVisitor: cmp => node => {
330
341
  const result = visit(getVisitor)(cmp)(() => { throw '' })(node)
@@ -1,9 +1,9 @@
1
- /** @typedef {import('./array').Index3} Index3 */
2
- /** @typedef {import('./array').Index5} Index5 */
1
+ /** @typedef {import('../array').Index3} Index3 */
2
+ /** @typedef {import('../array').Index5} Index5 */
3
3
 
4
4
  /**
5
5
  * @template T
6
- * @typedef {import('./array').Array2<T>} Array2
6
+ * @typedef {import('../array').Array2<T>} Array2
7
7
  */
8
8
 
9
9
  /** @typedef {-1|0|1} Sign */
package/dev/index.js ADDED
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ /** @readonly */
3
+ todo: () => { throw 'not implemented' },
4
+ }
package/func/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /** @type {<I, X>(_: (_: I) => X) => <O>(_: (_: X) => O) => (_: I) => O} */
2
+ const pipe = g => f => x => f(g(x))
3
+
4
+ /** @type {<T>(value: T) => T} */
5
+ const id = value => value
6
+
7
+ module.exports = {
8
+ /** @readonly */
9
+ id,
10
+ /** @readonly */
11
+ pipe,
12
+ }
package/index.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- const lib = require('./lib')
4
-
5
- const todo = () => lib.panic('not implemented')
6
-
7
1
  /** @type {<F>(c: string, found: (before: string, after: string) => F, notFound: (c: string, source: string) => F) => (source: string) => F} */
8
2
  const splitOne = (c, found, notFound) => source => {
9
3
  const i = source.indexOf(c)
@@ -1,7 +1,8 @@
1
- const lib = require('../')
1
+ const { pipe } = require('../func')
2
+ const mr = require('../map-reduce')
2
3
 
3
- /** @type {<T, R>(_: lib.Reduce<T, R>) => (_: Iterable<T>) => R} */
4
- const reduce = ({ merge, init }) => c => {
4
+ /** @type {<T, R>(merge: (_: R) => (_: T) => R) => (init: R) => (_: Iterable<T>) => R} */
5
+ const reduce = merge => init => c => {
5
6
  let result = init
6
7
  for (const i of c) {
7
8
  result = merge(result)(i)
@@ -9,15 +10,21 @@ const reduce = ({ merge, init }) => c => {
9
10
  return result
10
11
  }
11
12
 
13
+ /** @type {<I, S, R>(op: mr.Operation<I, S, R>) => (_: Iterable<I>) => R} */
14
+ const apply = ({ merge, init, result }) => pipe(reduce(merge)(init))(result)
15
+
12
16
  module.exports = {
17
+ /** @readonly */
18
+ apply,
19
+
13
20
  /** @readonly */
14
21
  reduce,
15
22
 
16
23
  /** @readonly */
17
- join: lib.pipe(lib.join)(reduce),
24
+ join: pipe(mr.join)(apply),
18
25
 
19
26
  /** @readonly */
20
- sum: reduce(lib.sum),
27
+ sum: apply(mr.sum),
21
28
 
22
29
  /**
23
30
  * @readonly
@@ -31,18 +38,6 @@ module.exports = {
31
38
  }
32
39
  }),
33
40
 
34
- /**
35
- * @readonly
36
- * @type {<T, R>(f: (value: T) => Promise<R>) => (c: AsyncIterable<T>) => AsyncIterable<R>}
37
- */
38
- asyncMap: f => c => ({
39
- async *[Symbol.asyncIterator]() {
40
- for await (const i of c) {
41
- yield* [f(i)]
42
- }
43
- }
44
- }),
45
-
46
41
  /**
47
42
  * @readonly
48
43
  * @type {<T>(_: (_: T) => boolean) => (_: Iterable<T>) => T|undefined}
@@ -0,0 +1,41 @@
1
+ const i = require('.')
2
+ const { pipe } = require('../func')
3
+
4
+ {
5
+ const r = i.sum([120, 300, 42])
6
+ if (r !== 462) { throw 'error' }
7
+ }
8
+
9
+ {
10
+ if (i.sum([1, 2]) !== 3) { throw 'error' }
11
+ if (i.sum([1, 2]) !== 3) { throw 'error' }
12
+ }
13
+
14
+ {
15
+ const x = Array.from(i.map(a => a ** 2)([1, 2, 3]))
16
+ if (x.length !== 3) { throw 'error' }
17
+ if (x[0] !== 1) { throw 'error' }
18
+ if (x[1] !== 4) { throw 'error' }
19
+ if (x[2] !== 9) { throw 'error' }
20
+ }
21
+
22
+ {
23
+ if (i.join('/')([]) !== '') { throw 'error' }
24
+ if (i.join('/')(['a']) !== 'a') { throw 'error' }
25
+ if (i.join('/')(['a', 'b']) !== 'a/b') { throw 'error'}
26
+ }
27
+
28
+ {
29
+ if (i.find(x => x === 'c')(['a', 'b', 'c']) !== 'c') { throw 'error' }
30
+ }
31
+
32
+ {
33
+ /** @type {(_: string) => string|undefined} */
34
+ const file = _ => 'x'
35
+ /** @type {(_: string) => string|undefined} */
36
+ const x = p => pipe
37
+ (i.map(x => file(x())))
38
+ (i.find(x => x !== undefined))
39
+ ([() => p, () => `${p}.js`, () => `${p}/index.js`])
40
+ if (x('index.js') !== 'x') { throw 'error' }
41
+ }
@@ -1,21 +1,21 @@
1
- const { optionMap } = require("..")
2
- const { getVisitor, setVisitor, values } = require("../tree")
1
+ const option = require("../option")
2
+ const { getVisitor, setVisitor, values } = require("../btree")
3
3
 
4
- /** @typedef {import("../tree/cmp").Sign} Sign */
4
+ /** @typedef {import("../cmp").Sign} Sign */
5
5
 
6
6
  /**
7
7
  * @template T
8
- * @typedef {import("../tree").Leaf1<T>} Leaf1
8
+ * @typedef {import("../btree").Leaf1<T>} Leaf1
9
9
  */
10
10
 
11
11
  /**
12
12
  * @template T
13
- * @typedef {import("../tree").TNode<T>} TNode
13
+ * @typedef {import("../btree").TNode<T>} TNode
14
14
  */
15
15
 
16
16
  /**
17
17
  * @template T
18
- * @typedef {import("../tree/cmp").Cmp<T>} Cmp
18
+ * @typedef {import("../cmp").Cmp<T>} Cmp
19
19
  */
20
20
 
21
21
  /**
@@ -38,7 +38,7 @@ const cmp = a => ([b]) => a < b ? -1 : a === b ? 0 : 1
38
38
 
39
39
  /** @type {<T>(node: TNode<Entry<T>>) => Map<T>} */
40
40
  const create = root => ({
41
- get: name => optionMap(([,value]) => value)(getVisitor(cmp(name))(root)),
41
+ get: name => option.map(([,value]) => value)(getVisitor(cmp(name))(root)),
42
42
  set: name => value => {
43
43
  const result = setVisitor(cmp(name))(() => [name, value])(root)
44
44
  if ('replace' in result) { return create(result.replace) }
@@ -53,7 +53,7 @@ const create = root => ({
53
53
  * @type {{
54
54
  * readonly get: (name: string) => undefined
55
55
  * readonly set: (name: string) => <T>(value: T) => Map<T>
56
- * readonly entries: () => []
56
+ * readonly entries: () => readonly []
57
57
  * readonly root: undefined
58
58
  * }}
59
59
  */
@@ -1,5 +1,4 @@
1
1
  const { empty } = require('.')
2
- const lib = require('..')
3
2
 
4
3
  {
5
4
  let m = empty.set('a')(1)
@@ -42,18 +41,17 @@ const lib = require('..')
42
41
 
43
42
  {
44
43
  const m = empty.set('x')(12).set('y')(44)
45
- lib.panic_if('map.get(\'x\')')(m.get('x') !== 12)
46
- lib.panic_if('map.get(\'y\')')(m.get('y') !== 44)
47
- lib.panic_if('map.get(\'a\')')(m.get('a') !== undefined)
44
+ if (m.get('x') !== 12) { throw 'error' }
45
+ if (m.get('y') !== 44) { throw 'error' }
46
+ if (m.get('a') !== undefined) { throw 'error' }
48
47
  const entries = Array.from(m.entries())
49
- lib.panic_if('map.entries()')(entries.length !== 2)
48
+ if (entries.length !== 2) { throw 'error' }
50
49
  }
51
50
 
52
-
53
51
  {
54
52
  /** @type {import('.').Map<number>} */
55
53
  let m = empty
56
- for (let i = 0; i < 1_000_000; ++i) {
54
+ for (let i = 0; i < 100_000; ++i) {
57
55
  m = m.set((i*i).toString())(i)
58
56
  /*
59
57
  console.log()
@@ -0,0 +1,48 @@
1
+ const { pipe, id } = require('../func')
2
+
3
+ /**
4
+ * @template S
5
+ * @template I
6
+ * @typedef {(state: S) => (value: I) => S} Merge
7
+ */
8
+
9
+ /**
10
+ * @template I
11
+ * @template S
12
+ * @template O
13
+ * @typedef {{
14
+ * readonly merge: Merge<S, I>
15
+ * readonly result: (state: S) => O
16
+ * readonly init: S
17
+ * }} Operation
18
+ */
19
+
20
+ /** @type {<I, T>(mapFn: (value: I) => T) => <S, O>(op: Operation<T, S, O>) => Operation<I, S, O>} */
21
+ const map = mapFn => ({ merge, result, init}) => ({
22
+ merge: pipe(merge)(pipe(mapFn)),
23
+ result,
24
+ init,
25
+ })
26
+
27
+ /** @type {(separator: string) => Operation<string, string|undefined, string>} */
28
+ const join = separator => ({
29
+ merge: s => i => s === undefined ? i : `${s}${separator}${i}`,
30
+ init: undefined,
31
+ result: s => s === undefined ? '' : s
32
+ })
33
+
34
+ /** @type {Operation<number, number, number>} */
35
+ const sum = {
36
+ merge: a => i => a + i,
37
+ result: id,
38
+ init: 0,
39
+ }
40
+
41
+ module.exports = {
42
+ /** @readonly */
43
+ map,
44
+ /** @readonly */
45
+ join,
46
+ /** @readonly */
47
+ sum,
48
+ }
@@ -1,34 +1,45 @@
1
- const lib = require('../lib')
2
- const iter = require('../lib/iterable')
1
+ const array = require('../array')
2
+ const { pipe } = require('../func')
3
+ const option = require('../option')
4
+ const { head, last, splitLast, splitFirst } = array
5
+ const iter = require('../iterable')
6
+ const mr = require('../map-reduce')
7
+
8
+ /**
9
+ * @template T
10
+ * @typedef {array.Array<T>} Array
11
+ */
12
+
13
+ /** @typedef {Array<string>} Path */
3
14
 
4
15
  /** @typedef {(_: string) => string|undefined} ReadFile */
5
16
 
6
17
  /**
7
18
  * @typedef {{
8
- * id: string[]
9
- * dependencies: Dependencies
10
- * file: ReadFile
19
+ * readonly id: Array<string>
20
+ * readonly dependencies: Dependencies
21
+ * readonly file: ReadFile
11
22
  * }} Package
12
23
  */
13
24
 
14
25
  /**
15
26
  * @typedef {{
16
- * pack: Package,
17
- * local: string[],
27
+ * readonly pack: Package,
28
+ * readonly local: Array<string>,
18
29
  * }} Location
19
30
  */
20
31
 
21
32
  /**
22
33
  * @typedef {{
23
- * fileName: string
24
- * location: Location
25
- * source: string
34
+ * readonly fileName: string
35
+ * readonly location: Location
36
+ * readonly source: string
26
37
  * }} Module
27
38
  */
28
39
 
29
40
  /** @typedef {(_: string) => undefined|Package|Dependencies} Dependencies */
30
41
 
31
- /** @type {lib.Reduce<string, undefined|string[]>} */
42
+ /** @type {mr.Operation<string, undefined|Path, undefined|Path>} */
32
43
  const pathNormReduce = {
33
44
  merge: path => item =>
34
45
  path === undefined ?
@@ -36,49 +47,52 @@ const pathNormReduce = {
36
47
  ['', '.'].includes(item) ?
37
48
  path :
38
49
  item === '..' ?
39
- lib.head(path) :
50
+ head(path) :
40
51
  [...path, item],
41
- init: []
52
+ init: [],
53
+ result: s => s,
42
54
  }
43
55
 
44
- /** @type {(_: string[]) => boolean} */
56
+ /** @type {(_: Array<string>) => boolean} */
45
57
  const isRelative = localId => ['.', '..'].includes(localId[0])
46
58
 
47
- const pathNorm = iter.reduce(pathNormReduce)
59
+ const pathNorm = iter.apply(pathNormReduce)
48
60
 
49
- /** @type {(_: Package) => (_: string[]) => Module|undefined} */
61
+ /** @type {(_: Package) => (_: Path) => Module|undefined} */
50
62
  const internal = pack => {
51
- /** @type {(_: string[]) => (_: string) => Module|undefined} */
63
+ /** @type {(_: Path) => (_: string) => Module|undefined} */
52
64
  const readFile = local => fileName => {
53
65
  const source = pack.file([...local, fileName].join('/'))
54
66
  return source === undefined ? undefined : { fileName, location: { pack, local }, source}
55
67
  }
56
68
  return path => {
57
- /** @type {(_: string[]) => Module|undefined} */
69
+ /** @type {(_: Path) => Module|undefined} */
58
70
  const read = local => {
59
- /** @type {(_: [string[], string]) => Module|undefined} */
60
- const tryFiles = ([head, last]) => {
71
+ /** @type {(_: readonly[Path, string]) => Module|undefined} */
72
+ const tryFiles = ([head, file]) => {
61
73
  /** @type {(_: string) => Module|undefined} */
62
- const one = ext => readFile(head)(last + ext)
63
- return ['.', '..', '', undefined].includes(lib.last(path)) ? undefined : one('') ?? one('.js')
74
+ const one = ext => readFile(head)(file + ext)
75
+ return ['.', '..', '', undefined].includes(last(path)) ? undefined : one('') ?? one('.js')
64
76
  }
65
- return lib.optionMap(tryFiles)(lib.splitLast(local)) ?? readFile(local)('index.js')
77
+ return option.map(tryFiles)(splitLast(local)) ?? readFile(local)('index.js')
66
78
  }
67
- return lib.optionMap(read)(pathNorm(path))
79
+ return option.map(read)(pathNorm(path))
68
80
  }
69
81
  }
70
82
 
71
- /** @type {(_: Package|Dependencies|undefined) => (_: string[]) => Module|undefined} */
83
+ /** @type {(_: Package|Dependencies|undefined) => (_: Path) => Module|undefined} */
72
84
  const externalOrInternal = p =>
73
85
  p === undefined ? () => undefined : (typeof p === 'function' ? external(p) : internal(p))
74
86
 
75
- /** @type {(_: Dependencies) => (_: string[]) => Module|undefined} */
87
+ /** @type {(_: Dependencies) => (_: Path) => Module|undefined} */
76
88
  const external = packages => {
77
- /** @type {(_: [string, string[]]) => Module|undefined} */
89
+ /** @type {(_: readonly [string, Path]) => Module|undefined} */
78
90
  const defined = ([first, tail]) => externalOrInternal(packages(first))(tail)
79
- /** @type {(_: string[]) => [string, string[]]|undefined} */
80
- const splitFirst = lib.splitFirst
81
- return lib.pipe(splitFirst)(lib.optionMap(defined))
91
+ /** @type {(_: Path) => readonly [string, Path]|undefined} */
92
+ const sf = splitFirst
93
+ return pipe
94
+ (sf)
95
+ (option.map(defined))
82
96
  }
83
97
 
84
98
  /** @type {(_: Location) => (_: string) => Module|undefined} */
@@ -91,8 +105,12 @@ const getModule = ({pack, local}) => path => {
91
105
  const moduleId = module => [...module.location.pack.id, ...module.location.local, module.fileName].join('/')
92
106
 
93
107
  module.exports = {
108
+ /** @readonly */
94
109
  isRelative,
110
+ /** @readonly */
95
111
  pathNorm,
112
+ /** @readonly */
96
113
  getModule,
114
+ /** @readonly */
97
115
  moduleId,
98
- }
116
+ }
@@ -1,4 +1,3 @@
1
- const lib = require('../../lib')
2
1
  const mm = require('..')
3
2
  const i = require('.')
4
3
 
@@ -1,23 +1,18 @@
1
1
  const i = require('.')
2
2
 
3
- const lib = require('../lib')
4
-
5
- {
6
- if (require('./test0') !== 'test0.js') { throw './test0' }
7
- if (require('./test0.js') !== 'test0.js') { throw './test0.js'}
8
- if (require('./test0.js.js') !== 'test0.js.js') { throw './test0.js.js'}
9
- }
10
-
11
3
  require('./node/test')
12
4
 
13
5
  /** @type {<T>(_: T | undefined) => T} */
14
- const cast = x => x === undefined ? lib.panic('x') : x
6
+ const cast = x => {
7
+ if (x === undefined) { throw 'x' }
8
+ return x
9
+ }
15
10
 
16
- lib.panic_if('isRelative')(i.isRelative('a/b/c'.split('/')))
17
- lib.panic_if('!isRelative')(!i.isRelative('./a/b/c'.split('/')))
18
- lib.panic_if('pathNorm')(cast(i.pathNorm('a/../b'.split('/'))).join('/') !== 'b')
19
- lib.panic_if('pathNorm')(cast(i.pathNorm('a/../b/../c'.split('/'))).join('/') !== 'c')
20
- lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('/') !== 'b/d')
11
+ if (i.isRelative('a/b/c'.split('/'))) { throw 'error '}
12
+ if (!i.isRelative('./a/b/c'.split('/'))) { throw 'error ' }
13
+ if (cast(i.pathNorm('a/../b'.split('/'))).join('/') !== 'b') { throw 'error ' }
14
+ if (cast(i.pathNorm('a/../b/../c'.split('/'))).join('/') !== 'c') { throw 'error ' }
15
+ if (cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('/') !== 'b/d') { throw 'error ' }
21
16
 
22
17
  {
23
18
  /** @type {i.Package} */
@@ -41,7 +36,8 @@ lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('
41
36
  'index.js': 'b/c ./index.js',
42
37
  'x/index.js': 'b/c ./x/index.js',
43
38
  }
44
- return ['.js', '', 'undefined.js'].includes(path) ? lib.panic('.js') : f[path]
39
+ if (['.js', '', 'undefined.js'].includes(path)) { throw '.js' }
40
+ return f[path]
45
41
  },
46
42
  id: ['c']
47
43
  }
@@ -65,7 +61,8 @@ lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('
65
61
  'a/index.js': './a/index.js',
66
62
  'a/index.js.js': './a/index.js.js',
67
63
  }
68
- return ['.js', '', 'undefined.js'].includes(path) ? lib.panic('.js') : f[path]
64
+ if (['.js', '', 'undefined.js'].includes(path)) { throw '.js' }
65
+ return f[path]
69
66
  },
70
67
  id: ['']
71
68
  }
@@ -78,8 +75,8 @@ lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('
78
75
  }
79
76
  {
80
77
  const g = i.getModule({pack, local: []})
81
- lib.panic_if('getModule')(g('') !== undefined)
82
- lib.panic_if('getModule')(g('..') !== undefined)
78
+ if (g('') !== undefined) { throw 'error' }
79
+ if (g('..') !== undefined) { throw 'error' }
83
80
  expect(g('.'))({ fileName: 'index.js', location: { pack, local: []}, source: './index.js'})
84
81
  expect(g('./index'))({ fileName: 'index.js', location: { pack, local: []}, source: './index.js'})
85
82
  expect(g('./index.js'))({ fileName: 'index.js', location: { pack, local: []}, source: './index.js'})
@@ -87,10 +84,10 @@ lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('
87
84
  expect(g('./a'))({ fileName: 'index.js', location: { pack, local: ['a']}, source: './a/index.js'})
88
85
  expect(g('./a/index'))({ fileName: 'index.js', location: { pack, local: ['a']}, source: './a/index.js'})
89
86
  expect(g('./a/index.js'))({ fileName: 'index.js.js', location: { pack, local: ['a']}, source: './a/index.js'})
90
- lib.panic_if('getModule')(g('./x') !== undefined)
87
+ if (g('./x') !== undefined) { throw 'error' }
91
88
  expect(g('a'))({ fileName: 'index.js', location: { pack: a, local: []}, source: 'a ./index.js'})
92
89
  expect(g('a/index'))({ fileName: 'index.js', location: { pack: a, local: []}, source: 'a ./index.js'})
93
- lib.panic_if('getModule')(g('b') !== undefined)
90
+ if (g('b') !== undefined) { throw 'error' }
94
91
  expect(g('b/c'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
95
92
  expect(g('b/c/index'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
96
93
  expect(g('b/c/index.js'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
@@ -99,21 +96,21 @@ lib.panic_if('pathNorm')(cast(i.pathNorm('./a/../b/c/..//d/'.split('/'))).join('
99
96
  }
100
97
  {
101
98
  const g = i.getModule({pack, local: ['index']})
102
- lib.panic_if('getModule')(g('') !== undefined)
99
+ if (g('') !== undefined) { throw 'error' }
103
100
  expect(g('..'))({ fileName: 'index.js', location: { pack, local: []}, source: './index.js'})
104
101
  expect(g('.'))({ fileName: 'index.js', location: { pack, local: ['index']}, source: './index/index.js'})
105
102
  expect(g('./index'))({ fileName: 'index.js', location: { pack, local: ['index']}, source: './index/index.js'})
106
103
  expect(g('./index.js'))({ fileName: 'index.js', location: { pack, local: ['index']}, source: './index/index.js'})
107
- lib.panic_if('getModule')(g('./index/') !== undefined)
108
- lib.panic_if('getModule')(g('./a') !== undefined)
104
+ if (g('./index/') !== undefined) { throw 'error' }
105
+ if (g('./a') !== undefined) { throw 'error' }
109
106
  expect(g('../a'))({ fileName: 'index.js', location: { pack, local: ['a']}, source: './a/index.js'})
110
107
  expect(g('../a/index'))({ fileName: 'index.js', location: { pack, local: ['a']}, source: './a/index.js'})
111
108
  expect(g('../a/index.js'))({ fileName: 'index.js', location: { pack, local: ['a']}, source: './a/index.js'})
112
109
  expect(g('../a/index.js.js'))({ fileName: 'index.js.js', location: { pack, local: ['a']}, source: './a/index.js.js'})
113
- lib.panic_if('getModule')(g('./x') !== undefined)
110
+ if (g('./x') !== undefined) { throw 'error' }
114
111
  expect(g('a'))({ fileName: 'index.js', location: { pack: a, local: []}, source: 'a ./index.js'})
115
112
  expect(g('a/index'))({ fileName: 'index.js', location: { pack: a, local: []}, source: 'a ./index.js'})
116
- lib.panic_if('getModule')(g('b') !== undefined)
113
+ if (g('b') !== undefined) { throw 'error' }
117
114
  expect(g('b/c'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
118
115
  expect(g('b/c/index'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
119
116
  expect(g('b/c/index.js'))({ fileName: 'index.js', location: { pack: c, local: []}, source: 'b/c ./index.js'})
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @template T
3
+ * @typedef {T|undefined} Option
4
+ */
5
+
6
+ /** @type {<T, R>(_: (_: T) => R) => (_: T|undefined) => R|undefined} */
7
+ const map = f => x => x === undefined ? undefined : f(x)
8
+
9
+ module.exports = {
10
+ /** @readonly */
11
+ map,
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.155",
3
+ "version": "0.0.162",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -1,14 +1,13 @@
1
- const lib = require('./lib')
2
1
  const i = require('./')
3
2
 
3
+ require('./async/iterable/test')
4
4
  require('./module-manager/test')
5
- require('./lib/test')
6
5
 
7
6
  /** @type {() => never} */
8
- const assert = () => lib.panic('assert')
7
+ const assert = () => { throw 'assert' }
9
8
 
10
9
  /** @type {(_: boolean) => void} */
11
- const assert_if = c => lib.panic_if('assert_if')(c)
10
+ const assert_if = c => { if (c) { throw 'assert_if' } }
12
11
 
13
12
  {
14
13
  i.parseModuleUrl('')(
package/lib/index.js DELETED
@@ -1,157 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * @template T
5
- * @typedef {T|undefined} Option
6
- */
7
-
8
- /**
9
- * @template T
10
- * @typedef {() => NotEmptySequence<T>|undefined} Sequence
11
- */
12
-
13
- /**
14
- * @template T
15
- * @typedef {{ first: T, tail: Sequence<T>}} NotEmptySequence
16
- */
17
-
18
- /**
19
- * @template T
20
- * @typedef {() => Continuation<T>} Continue
21
- */
22
-
23
- /**
24
- * @template T
25
- * @typedef {[T]|Continue<T>} Continuation
26
- */
27
-
28
- /** @type {(_: string) => never} */
29
- const panic = message => { throw message }
30
-
31
- /** @type {<A>(_: A) => <B>(_: B) => [A, B]} */
32
- const tuple2 = a => b => [a, b]
33
-
34
- // /** @type {<T>(_: (_: string) => T) => (_: Dictionary<T>) => (_: string) => [T, Dictionary<T>]} */
35
- // const cache = f => d => k => {
36
- // const set = () => {
37
- // const r = f(k)
38
- // return tuple2(r)(d.set(k)(r))
39
- // }
40
- // const result = d.get(k)
41
- // return result !== undefined ? [result, d] : set()
42
- // }
43
-
44
- /**
45
- * @template T
46
- * @template R
47
- * @typedef {{
48
- * merge: (_: R) => (_: T) => R
49
- * init: R
50
- * }} Reduce
51
- */
52
-
53
- /** @type {<I, X>(_: (_: I) => X) => <O>(_: (_: X) => O) => (_: I) => O} */
54
- const pipe = g => f => x => f(g(x))
55
-
56
- /** @type {<T, R>(_: (_: T) => R) => (_: T|undefined) => R|undefined} */
57
- const optionMap = f => x => x === undefined ? undefined : f(x)
58
-
59
- /** @type {<T>(_: T[]) => T[]} */
60
- const uncheckTail = a => a.slice(1)
61
-
62
- /** @type {<T>(_: T[]) => T[]} */
63
- const uncheckHead = a => a.slice(0, -1)
64
-
65
- /** @type {<T>(_: T[]) => T|undefined} */
66
- const last = a => a[a.length - 1]
67
-
68
- /**
69
- * @template I
70
- * @typedef {{
71
- * readonly i: <O>(f: (input: I) => O) => Chain<O>
72
- * readonly result: () => I
73
- * }} Chain
74
- */
75
-
76
- /** @type {<I>(value: I) => Chain<I>} */
77
- const chain = value => ({
78
- i: f => chain(f(value)),
79
- result: () => value
80
- })
81
-
82
- /**
83
- * @template I
84
- * @template T
85
- * @typedef {{
86
- * readonly x: <O>(f: (v: T) => O) => Pipe<I, O>
87
- * readonly f: (input: I) => T
88
- * }} Pipe
89
- */
90
-
91
- /** @type {<I, T>(f: (input: I) => T) => Pipe<I, T>} */
92
- const pipex = f => ({
93
- x: g => pipex(pipe(f)(g)),
94
- f,
95
- })
96
-
97
- module.exports = {
98
-
99
- panic,
100
-
101
- todo: () => panic('not implemented'),
102
-
103
- /** @type {(_: string) => (_: boolean) => void} */
104
- panic_if: message => condition => condition ? panic(message) : undefined,
105
-
106
- /** @type {<T>(_: Continuation<T>) => T} */
107
- trampoline: continuation => {
108
- while (true) {
109
- if (typeof continuation !== 'function') {
110
- return continuation[0]
111
- }
112
- continuation = continuation()
113
- }
114
- },
115
-
116
- /** @type {(s: string) => Reduce<string, string>} */
117
- join: s => ({ merge: a => i => a === '' ? i : a + s + i, init: ''}),
118
-
119
- pipe,
120
-
121
- pipex,
122
-
123
- /** @type {Reduce<number, number>} */
124
- sum: { merge: a => i => a + i, init: 0 },
125
-
126
- /** @type {<I, X>(f: (init: I) => X) => <O>(reduce: Reduce<X, O>) => Reduce<I, O>} */
127
- map: f => ({merge, init}) => ({
128
- merge: pipe(merge)(pipe(f)),
129
- init,
130
- }),
131
-
132
- last,
133
-
134
- optionMap,
135
-
136
- /** @type {<T>(_: T[]) => T[]|undefined} */
137
- tail: a => a.length === 0 ? undefined : uncheckTail(a),
138
-
139
- /** @type {<T>(_: T[]) => [T, T[]]|undefined} */
140
- splitFirst: a => {
141
- /** @typedef {typeof a[0]} T*/
142
- /** @type {(_: T) => [T, T[]]} */
143
- const split = first => [first, uncheckTail(a)]
144
- return optionMap(split)(a[0])
145
- },
146
-
147
- /** @type {<T>(_: T[]) => T[]|undefined} */
148
- head: a => a.length === 0 ? undefined : uncheckHead(a),
149
-
150
- /** @type {<T>(_: T[]) => [T[], T]|undefined} */
151
- splitLast: a => {
152
- /** @typedef {typeof a[0]} T*/
153
- /** @type {(_: T) => [T[], T]} */
154
- const split = x => [uncheckHead(a), x]
155
- return optionMap(split)(last(a))
156
- },
157
- }
@@ -1,41 +0,0 @@
1
- const i = require('.')
2
- const lib = require('..')
3
-
4
- {
5
- const r = i.sum([120, 300, 42])
6
- lib.panic_if('reduce')(r !== 462)
7
- }
8
-
9
- {
10
- lib.panic_if('first sum')(i.sum([1, 2]) !== 3)
11
- lib.panic_if('second sum')(i.sum([1, 2]) !== 3)
12
- }
13
-
14
- {
15
- const x = Array.from(i.map(a => a ** 2)([1, 2, 3]))
16
- lib.panic_if('map')(x.length !== 3)
17
- lib.panic_if('map[0]')(x[0] !== 1)
18
- lib.panic_if('map[1]')(x[1] !== 4)
19
- lib.panic_if('map[2]')(x[2] !== 9)
20
- }
21
-
22
- {
23
- lib.panic_if('join')(i.join('/')([]) !== '')
24
- lib.panic_if('join')(i.join('/')(['a']) !== 'a')
25
- lib.panic_if('join')(i.join('/')(['a', 'b']) !== 'a/b')
26
- }
27
-
28
- {
29
- lib.panic_if('find')(i.find(x => x === 'c')(['a', 'b', 'c']) !== 'c')
30
- }
31
-
32
- {
33
- /** @type {(_: string) => string|undefined} */
34
- const file = _ => 'x'
35
- /** @type {(_: string) => string|undefined} */
36
- const x = p => lib.pipe
37
- (i.map(x => file(x())))
38
- (i.find(x => x !== undefined))
39
- ([() => p, () => `${p}.js`, () => `${p}/index.js`])
40
- lib.panic_if('map.find')(x('index.js') !== 'x')
41
- }
package/lib/test.js DELETED
@@ -1,5 +0,0 @@
1
- const lib = require('./index')
2
-
3
- require('./iterable/test')
4
- require('./map/test')
5
-
package/lib/tree/array.js DELETED
@@ -1,36 +0,0 @@
1
- /**
2
- * @template T
3
- * @typedef {readonly [T]} Array1
4
- */
5
-
6
- /** @typedef {0} Index1 */
7
-
8
- /**
9
- * @template T
10
- * @typedef {readonly [T, T]} Array2
11
- */
12
-
13
- /** @typedef {0|1} Index2 */
14
-
15
- /**
16
- * @template T
17
- * @typedef {readonly [T, T, T]} Array3
18
- */
19
-
20
- /** @typedef {0|1|2} Index3 */
21
-
22
- /**
23
- * @template T
24
- * @typedef {readonly [T, T, T, T]} Array4
25
- */
26
-
27
- /** @typedef {0|1|2|3} Index4 */
28
-
29
- /**
30
- * @template T
31
- * @typedef {readonly [T, T, T, T, T]} Array5
32
- */
33
-
34
- /** @typedef {0|1|2|3|4} Index5 */
35
-
36
- module.exports = {}
package/lib/tree/lazy.js DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * @template T
3
- * @typedef {() => T} Lazy
4
- */
5
-
6
- module.exports = {}
@@ -1 +0,0 @@
1
- module.exports = 'test0.js'
@@ -1 +0,0 @@
1
- module.exports = 'test0.js.js'