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.
Files changed (43) hide show
  1. package/README.md +4 -2
  2. package/com/cpp/module.f.cjs +1 -2
  3. package/com/cpp/test.f.cjs +1 -1
  4. package/com/cpp/testlib.f.cjs +1 -1
  5. package/com/test/build.f.cjs +1 -1
  6. package/commonjs/build/module.f.cjs +1 -1
  7. package/commonjs/build/test.f.cjs +2 -1
  8. package/commonjs/module/module.f.cjs +1 -1
  9. package/commonjs/path/module.f.cjs +5 -5
  10. package/dev/test.mjs +1 -1
  11. package/doc/predefined.md +2 -2
  12. package/fsc/test.f.cjs +1 -1
  13. package/json/module.f.cjs +4 -4
  14. package/package.json +1 -1
  15. package/text/README.md +2 -2
  16. package/text/utf8/module.f.cjs +15 -15
  17. package/types/array/module.f.cjs +9 -9
  18. package/types/array/test.f.cjs +1 -2
  19. package/types/btree/find/module.f.cjs +3 -3
  20. package/types/btree/module.f.cjs +2 -2
  21. package/types/btree/remove/module.f.cjs +11 -11
  22. package/types/btree/remove/test.f.cjs +52 -52
  23. package/types/btree/set/module.f.cjs +6 -6
  24. package/types/btree/test.f.cjs +2 -2
  25. package/types/btree/types/module.f.cjs +1 -1
  26. package/types/byte_set/module.f.cjs +8 -9
  27. package/types/list/module.f.cjs +61 -66
  28. package/types/list/test.f.cjs +9 -9
  29. package/types/map/module.f.cjs +7 -6
  30. package/types/map/test.f.cjs +9 -9
  31. package/types/nullable/module.f.cjs +17 -0
  32. package/types/{option → nullable}/test.f.cjs +2 -2
  33. package/types/number/module.f.cjs +2 -2
  34. package/types/number/test.f.cjs +1 -1
  35. package/types/range_map/module.f.cjs +6 -6
  36. package/types/range_map/test.f.cjs +2 -2
  37. package/types/sorted_list/module.f.cjs +13 -15
  38. package/types/sorted_list/test.f.cjs +2 -2
  39. package/types/sorted_set/module.f.cjs +4 -4
  40. package/types/sorted_set/test.f.cjs +0 -1
  41. package/types/string_set/module.f.cjs +2 -2
  42. package/types/string_set/test.f.cjs +3 -3
  43. 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 !== undefined) { throw 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 !== undefined) { throw 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: intersectTail })(undefined)
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 : undefined, sign, state]
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
 
@@ -33,7 +33,6 @@ module.exports = {
33
33
  intersect: [
34
34
  () => {
35
35
  const result = stringify(toArray(_.intersect(unsafeCmp)([2, 3, 4])([1, 3, 5])))
36
- // console.log(result)
37
36
  if (result !== '[3]') { throw result }
38
37
  },
39
38
  () => {
@@ -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 !== undefined && isFound(f(s).first)
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)(undefined)
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')(undefined)
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')(undefined)
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 !== undefined) { throw 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
- }