functionalscript 0.0.487 → 0.0.489
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 +4 -2
- package/com/cpp/module.f.cjs +1 -2
- package/com/cpp/test.f.cjs +1 -1
- package/com/cpp/testlib.f.cjs +1 -1
- package/com/test/build.f.cjs +1 -1
- package/commonjs/build/module.f.cjs +1 -1
- package/commonjs/build/test.f.cjs +2 -1
- package/commonjs/module/module.f.cjs +1 -1
- package/commonjs/path/module.f.cjs +5 -5
- package/dev/test.mjs +1 -1
- package/doc/predefined.md +2 -2
- package/fsc/test.f.cjs +1 -1
- package/json/module.f.cjs +4 -4
- package/package.json +1 -1
- package/text/README.md +2 -2
- package/text/utf8/module.f.cjs +15 -15
- package/types/array/module.f.cjs +9 -9
- package/types/array/test.f.cjs +1 -2
- package/types/btree/find/module.f.cjs +3 -3
- package/types/btree/module.f.cjs +2 -2
- package/types/btree/remove/module.f.cjs +11 -11
- package/types/btree/remove/test.f.cjs +52 -52
- package/types/btree/set/module.f.cjs +6 -6
- package/types/btree/test.f.cjs +2 -2
- package/types/btree/types/module.f.cjs +1 -1
- package/types/byte_set/module.f.cjs +8 -9
- package/types/list/module.f.cjs +61 -66
- package/types/list/test.f.cjs +9 -9
- package/types/map/module.f.cjs +7 -6
- package/types/map/test.f.cjs +9 -9
- package/types/nullable/module.f.cjs +17 -0
- package/types/{option → nullable}/test.f.cjs +2 -2
- package/types/number/module.f.cjs +2 -2
- package/types/number/test.f.cjs +1 -1
- package/types/range_map/module.f.cjs +6 -6
- package/types/range_map/test.f.cjs +2 -2
- package/types/sorted_list/module.f.cjs +13 -15
- package/types/sorted_list/test.f.cjs +2 -2
- package/types/sorted_set/module.f.cjs +4 -4
- package/types/sorted_set/test.f.cjs +0 -1
- package/types/string_set/module.f.cjs +2 -2
- package/types/string_set/test.f.cjs +3 -3
- package/types/option/module.f.cjs +0 -17
|
@@ -37,11 +37,11 @@ module.exports = {
|
|
|
37
37
|
},
|
|
38
38
|
() => {
|
|
39
39
|
const result = _.find(unsafeCmp)(3)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90])
|
|
40
|
-
if (result !==
|
|
40
|
+
if (result !== null) { throw result }
|
|
41
41
|
},
|
|
42
42
|
() => {
|
|
43
43
|
const result = _.find(unsafeCmp)(77)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90])
|
|
44
|
-
if (result !==
|
|
44
|
+
if (result !== null) { throw result }
|
|
45
45
|
},
|
|
46
46
|
() => {
|
|
47
47
|
const result = _.find(unsafeCmp)(80)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90])
|
|
@@ -21,17 +21,17 @@ const union = cmp => a => b => toArray(merge(cmp)(a)(b))
|
|
|
21
21
|
/** @type {<T>(cmp: Cmp<T>) => (a: SortedSet<T>) => (b: SortedSet<T>) => SortedSet<T>} */
|
|
22
22
|
const intersect = cmp => a => b => toArray(intersectMerge(cmp)(a)(b))
|
|
23
23
|
|
|
24
|
+
const tailReduce = () => () => null
|
|
25
|
+
|
|
24
26
|
/** @type {<T>(cmp: Cmp<T>) => (a: sortedList.SortedList<T>) => (b: sortedList.SortedList<T>) => sortedList.SortedList<T>} */
|
|
25
|
-
const intersectMerge = cmp => genericMerge({ reduceOp: intersectReduce(cmp), tailReduce
|
|
27
|
+
const intersectMerge = cmp => genericMerge({ reduceOp: intersectReduce(cmp), tailReduce })(null)
|
|
26
28
|
|
|
27
29
|
/** @type {<T,S>(cmp: Cmp<T>) => sortedList.ReduceOp<T,S>} */
|
|
28
30
|
const intersectReduce = cmp => state => a => b => {
|
|
29
31
|
const sign = cmp(a)(b)
|
|
30
|
-
return [sign === 0 ? a :
|
|
32
|
+
return [sign === 0 ? a : null, sign, state]
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const intersectTail = () => () => undefined
|
|
34
|
-
|
|
35
35
|
/** @type {<T>(cmp: Cmp<T>) => (value: T) => (set: SortedSet<T>) => boolean} */
|
|
36
36
|
const has = cmp => value => set => find(cmp)(value)(set) === value
|
|
37
37
|
|
|
@@ -18,13 +18,13 @@ const { compose } = require('../function/module.f.cjs')
|
|
|
18
18
|
/** @type {(value: string) => (set: StringSet) => boolean} */
|
|
19
19
|
const contains = value => {
|
|
20
20
|
const f = find(cmp(value))
|
|
21
|
-
return s => s !==
|
|
21
|
+
return s => s !== null && isFound(f(s).first)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** @type {(value: string) => (s: StringSet) => StringSet} */
|
|
25
25
|
const set = value => btreeSet(cmp(value))(() => value)
|
|
26
26
|
|
|
27
|
-
const fromValues = fold(set)(
|
|
27
|
+
const fromValues = fold(set)(null)
|
|
28
28
|
|
|
29
29
|
/** @type {(value: string) => (s: StringSet) => StringSet} */
|
|
30
30
|
const remove = compose(cmp)(btreeRemove)
|
|
@@ -2,12 +2,12 @@ const _ = require('./module.f.cjs')
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
contains: () => {
|
|
5
|
-
const r = _.set('hello')(
|
|
5
|
+
const r = _.set('hello')(null)
|
|
6
6
|
if (!_.contains('hello')(r)) { throw r }
|
|
7
7
|
if (_.contains('hello1')(r)) { throw r }
|
|
8
8
|
},
|
|
9
9
|
remove: () => {
|
|
10
|
-
let r = _.set('hello')(
|
|
10
|
+
let r = _.set('hello')(null)
|
|
11
11
|
r = _.set('world')(r)
|
|
12
12
|
r = _.set('HELLO')(r)
|
|
13
13
|
r = _.set('WORLD!')(r)
|
|
@@ -29,6 +29,6 @@ module.exports = {
|
|
|
29
29
|
if (_.contains('HELLO')(r)) { throw r }
|
|
30
30
|
if (!_.contains('WORLD!')(r)) { throw r }
|
|
31
31
|
r = _.remove('WORLD!')(r)
|
|
32
|
-
if (r !==
|
|
32
|
+
if (r !== null) { throw r }
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @template T
|
|
3
|
-
* @typedef {T|undefined} Option
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** @type {<T, R>(f: (value: T) => R) => (value: T|undefined) => R|undefined} */
|
|
7
|
-
const map = f => value => value === undefined ? undefined : f(value)
|
|
8
|
-
|
|
9
|
-
/** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: T|undefined) => R|undefined} */
|
|
10
|
-
const match = f => none => value => value === undefined ? none() : f(value)
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
/** @readonly */
|
|
14
|
-
map,
|
|
15
|
-
/** @readonly */
|
|
16
|
-
match,
|
|
17
|
-
}
|