functionalscript 0.0.391 → 0.0.394
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/commonjs/build/module.f.cjs +1 -1
- package/dev/test/module.f.cjs +19 -0
- package/package.json +1 -1
- package/test.f.cjs +3 -1
- package/types/bigint/module.f.cjs +10 -0
- package/types/bigint/test.f.cjs +8 -0
- package/types/function/operator/module.f.cjs +11 -11
- package/types/list/module.f.cjs +8 -23
- package/types/list/test.f.cjs +0 -20
- package/types/module.f.cjs +5 -1
- package/types/number/module.f.cjs +17 -0
- package/types/number/test.f.cjs +23 -0
- /package/types/{stringset → string_set}/module.f.cjs +0 -0
- /package/types/{stringset → string_set}/test.f.cjs +0 -0
|
@@ -8,7 +8,7 @@ const object = require('../../types/object/module.f.cjs')
|
|
|
8
8
|
const { fromMap } = object
|
|
9
9
|
const path = require('../path/module.f.cjs')
|
|
10
10
|
const { parseAndFind } = path
|
|
11
|
-
const stringSet = require('../../types/
|
|
11
|
+
const stringSet = require('../../types/string_set/module.f.cjs')
|
|
12
12
|
const { set: setSet, contains: setContains } = stringSet
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { todo } = require('../module.f.cjs')
|
|
2
|
+
const list = require('../../types/list/module.f.cjs')
|
|
3
|
+
const function_ = require('../../commonjs/module/function/module.f.cjs')
|
|
4
|
+
const package_ = require('../../commonjs/package/module.f.cjs')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @type {(c: function_.Compile) =>
|
|
8
|
+
* (files: string) =>
|
|
9
|
+
* (packageGet: package_.Get) =>
|
|
10
|
+
* never}
|
|
11
|
+
*/
|
|
12
|
+
const test = compile => files => packageGet => {
|
|
13
|
+
return todo()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
/** @readonly */
|
|
18
|
+
test,
|
|
19
|
+
}
|
package/package.json
CHANGED
package/test.f.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const i = require('./module.f.cjs')
|
|
2
2
|
|
|
3
3
|
require('./types/list/test.f.cjs')
|
|
4
|
+
require('./types/number/test.f.cjs')
|
|
5
|
+
require('./types/bigint/module.f.cjs')
|
|
4
6
|
require('./types/array/test.f.cjs')
|
|
5
7
|
require('./types/btree/test.f.cjs')
|
|
6
8
|
require('./sha2/test.f.cjs')
|
|
@@ -12,7 +14,7 @@ require('./commonjs/package/dependencies/test.f.cjs')
|
|
|
12
14
|
require('./commonjs/package/test.f.cjs')
|
|
13
15
|
require('./commonjs/path/test.f.cjs')
|
|
14
16
|
require('./types/function/compare/test.f.cjs')
|
|
15
|
-
require('./types/
|
|
17
|
+
require('./types/string_set/test.f.cjs')
|
|
16
18
|
require('./types/option/test.f.cjs')
|
|
17
19
|
require('./commonjs/build/test.f.cjs')
|
|
18
20
|
require('./types/range/test.f.cjs')
|
|
@@ -16,11 +16,6 @@ const join = separator => value => prior => `${prior}${separator}${value}`
|
|
|
16
16
|
/** @type {Fold<string>} */
|
|
17
17
|
const concat = i => acc => `${acc}${i}`
|
|
18
18
|
|
|
19
|
-
/** @type {Fold<number>} */
|
|
20
|
-
const addition = a => b => a + b
|
|
21
|
-
|
|
22
|
-
const increment = addition(1)
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* @template T
|
|
26
21
|
* @template R
|
|
@@ -38,12 +33,6 @@ const logicalNot = v => !v
|
|
|
38
33
|
/** @type {<T>(a: T) => (b: T) => boolean} */
|
|
39
34
|
const strictEqual = a => b => a === b
|
|
40
35
|
|
|
41
|
-
/** @type {Fold<number>} */
|
|
42
|
-
const min = a => b => a < b ? a : b
|
|
43
|
-
|
|
44
|
-
/** @type {Fold<number>} */
|
|
45
|
-
const max = a => b => a > b ? a : b
|
|
46
|
-
|
|
47
36
|
/**
|
|
48
37
|
* @template I,O
|
|
49
38
|
* @typedef {(input: I) => readonly[O, Scan<I,O>]} Scan
|
|
@@ -74,6 +63,17 @@ const reduceToScan = reduce => prior => i => {
|
|
|
74
63
|
/** @type {<T>(fold: Fold<T>) => Scan<T, T>} */
|
|
75
64
|
const foldToScan = op => init => [init, reduceToScan(op)(init)]
|
|
76
65
|
|
|
66
|
+
/** @type {Fold<number>} */
|
|
67
|
+
const addition = a => b => a + b
|
|
68
|
+
|
|
69
|
+
/** @type {Fold<number>} */
|
|
70
|
+
const min = a => b => a < b ? a : b
|
|
71
|
+
|
|
72
|
+
/** @type {Fold<number>} */
|
|
73
|
+
const max = a => b => a > b ? a : b
|
|
74
|
+
|
|
75
|
+
const increment = addition(1)
|
|
76
|
+
|
|
77
77
|
const counter = () => increment
|
|
78
78
|
|
|
79
79
|
module.exports = {
|
package/types/list/module.f.cjs
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
const { compose, identity } = require('../function/module.f.cjs')
|
|
2
2
|
const operator = require('../function/operator/module.f.cjs')
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
max: maxOp,
|
|
7
|
-
join: joinOp,
|
|
8
|
-
concat: concatOp,
|
|
3
|
+
const {
|
|
4
|
+
join: joinOp,
|
|
5
|
+
concat: concatOp,
|
|
9
6
|
counter,
|
|
10
|
-
logicalNot,
|
|
11
|
-
strictEqual,
|
|
12
|
-
stateScanToScan,
|
|
13
|
-
reduceToScan,
|
|
14
|
-
foldToScan
|
|
7
|
+
logicalNot,
|
|
8
|
+
strictEqual,
|
|
9
|
+
stateScanToScan,
|
|
10
|
+
reduceToScan,
|
|
11
|
+
foldToScan
|
|
15
12
|
} = operator
|
|
16
13
|
|
|
17
14
|
/**
|
|
@@ -264,12 +261,6 @@ const reduce = op => init => input => last(init)(reduceScan(op)(init)(input))
|
|
|
264
261
|
/** @type {<T>(op: operator.Fold<T>) => <D>(def: D) => (input: List<T>) => D|T} */
|
|
265
262
|
const fold = op => def => input => last(def)(scan(foldToScan(op))(input))
|
|
266
263
|
|
|
267
|
-
const sum = fold(addition)(0)
|
|
268
|
-
|
|
269
|
-
const min = fold(minOp)(undefined)
|
|
270
|
-
|
|
271
|
-
const max = fold(maxOp)(undefined)
|
|
272
|
-
|
|
273
264
|
/** @type {(separator: string) => (input: List<string>) => string} */
|
|
274
265
|
const join = separator => fold(joinOp(separator))('')
|
|
275
266
|
|
|
@@ -380,12 +371,6 @@ module.exports = {
|
|
|
380
371
|
/** @readonly */
|
|
381
372
|
fold,
|
|
382
373
|
/** @readonly */
|
|
383
|
-
sum,
|
|
384
|
-
/** @readonly */
|
|
385
|
-
min,
|
|
386
|
-
/** @readonly */
|
|
387
|
-
max,
|
|
388
|
-
/** @readonly */
|
|
389
374
|
join,
|
|
390
375
|
/** @readonly */
|
|
391
376
|
stringConcat,
|
package/types/list/test.f.cjs
CHANGED
|
@@ -99,11 +99,6 @@ const stringify = sequence => json.stringify(sort)(_.toArray(sequence))
|
|
|
99
99
|
if (result !== '[2,5,9,14]') { throw result }
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
{
|
|
103
|
-
const result = _.sum([2, 3, 4, 5])
|
|
104
|
-
if (result !== 14) { throw result }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
102
|
{
|
|
108
103
|
const result = _.fold(addition)(undefined)([2, 3, 4, 5])
|
|
109
104
|
if (result !== 14) { throw result }
|
|
@@ -211,21 +206,6 @@ const map5 = _.map(x => x > 5)
|
|
|
211
206
|
if (!result) { throw result }
|
|
212
207
|
}
|
|
213
208
|
|
|
214
|
-
{
|
|
215
|
-
const result = _.min([])
|
|
216
|
-
if (result !== undefined) { throw result }
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
{
|
|
220
|
-
const result = _.min([1, 2, 12, -4, 8])
|
|
221
|
-
if (result !== -4) { throw result }
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
const result = _.max([1, 2, 12, -4, 8])
|
|
226
|
-
if (result !== 12) { throw result }
|
|
227
|
-
}
|
|
228
|
-
|
|
229
209
|
{
|
|
230
210
|
const result = _.isEmpty(() => [])
|
|
231
211
|
if (result !== true) { throw result }
|
package/types/module.f.cjs
CHANGED
|
@@ -16,5 +16,9 @@ module.exports = {
|
|
|
16
16
|
/** @readonly */
|
|
17
17
|
result: require('./result/module.f.cjs'),
|
|
18
18
|
/** @readonly */
|
|
19
|
-
|
|
19
|
+
string_set: require('./string_set/module.f.cjs'),
|
|
20
|
+
/** @readonly */
|
|
21
|
+
bigint: require('./bigint/module.f.cjs'),
|
|
22
|
+
/** @readonly */
|
|
23
|
+
number: require('./number/module.f.cjs'),
|
|
20
24
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { fold } = require('../list/module.f.cjs')
|
|
2
|
+
const { addition, min: minOp, max: maxOp } = require('../function/operator/module.f.cjs')
|
|
3
|
+
|
|
4
|
+
const sum = fold(addition)(0)
|
|
5
|
+
|
|
6
|
+
const min = fold(minOp)(undefined)
|
|
7
|
+
|
|
8
|
+
const max = fold(maxOp)(undefined)
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
/** @readonly */
|
|
12
|
+
sum,
|
|
13
|
+
/** @readonly */
|
|
14
|
+
min,
|
|
15
|
+
/** @readonly */
|
|
16
|
+
max,
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { sum, min, max } = require('./module.f.cjs')
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
const result = sum([2, 3, 4, 5])
|
|
5
|
+
if (result !== 14) { throw result }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
{
|
|
9
|
+
const result = min([])
|
|
10
|
+
if (result !== undefined) { throw result }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
{
|
|
14
|
+
const result = min([1, 2, 12, -4, 8])
|
|
15
|
+
if (result !== -4) { throw result }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
const result = max([1, 2, 12, -4, 8])
|
|
20
|
+
if (result !== 12) { throw result }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = {}
|
|
File without changes
|
|
File without changes
|