functionalscript 0.0.485 → 0.0.487

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.
@@ -51,22 +51,26 @@ const this_ = ['this: &Object']
51
51
  const rustType = n => `pub type ${n} = nanocom::${n}<Interface>;`
52
52
 
53
53
  /**
54
- * @typedef {{
55
- * readonly where?: readonly string[]
56
- * readonly content: text.Block
57
- * }} WhereContent
54
+ * @template T
55
+ * @typedef {T|{}} OptionalProperty
56
+ */
57
+
58
+ /** @typedef {{readonly where: readonly string[]}} Where */
59
+
60
+ /**
61
+ * @typedef {OptionalProperty<Where> & {readonly content: text.Block}} WhereContent
58
62
  */
59
63
 
60
64
  /** @type {(h: string) => (wh: WhereContent) => text.Block} */
61
- const whereContent = h => ({ where, content }) => {
62
- const w = isEmpty(where) ? [`${h} {`] : [
65
+ const whereContent = h => wh => {
66
+ const w = 'where' in wh ? [
63
67
  h,
64
68
  `where`,
65
- mapComma(where),
69
+ mapComma(wh.where),
66
70
  '{'
67
- ]
71
+ ]: [`${h} {`]
68
72
  const x = [
69
- content,
73
+ wh.content,
70
74
  '}',
71
75
  ]
72
76
  return flat([w, x])
@@ -62,10 +62,7 @@ const filterParam = filter(isParam)
62
62
  const paramList = compose(entries)(filterParam)
63
63
 
64
64
  /** @type {<T>(v: T) => (f: (type: Type) => T) => (fa: FieldArray) => T} */
65
- const result = v => f => fa => {
66
- const type = fa._
67
- return type === undefined ? v : f(type)
68
- }
65
+ const result = v => f => fa => '_' in fa ? f(fa._) : v
69
66
 
70
67
  module.exports = {
71
68
  /** @readonly */
@@ -1,10 +1,10 @@
1
- /** @typedef {(packageName: string) => PackageMap|Package|undefined} PackageMap */
1
+ /** @typedef {(packageName: string) => PackageMap|Package|null} PackageMap */
2
2
 
3
3
  /**
4
4
  * @typedef {readonly[
5
5
  * string,
6
6
  * PackageMap,
7
- * (fileName: string) => string|undefined
7
+ * (fileName: string) => string|null
8
8
  * ]} Package
9
9
  */
10
10
 
package/fsc/test.f.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  const _ = require('./module.f.cjs')
2
2
  const { one } = require('../text/ascii/module.f.cjs')
3
- const { get } = require('../types/range_map/module.f.cjs')
4
3
  const { stringify } = require('../json/module.f.cjs')
5
4
  const s = stringify(i => i)
6
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.485",
3
+ "version": "0.0.487",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "module.f.cjs",
6
6
  "scripts": {
@@ -85,7 +85,7 @@ const uncheckTail = a => a.slice(1)
85
85
  const uncheckHead = a => a.slice(0, -1)
86
86
 
87
87
  /** @type {<T>(a: T|undefined) => T|null} */
88
- const undefinedToNull = a => a === undefined ? null : a
88
+ const undefinedToNull = a => a === void 0 ? null : a
89
89
 
90
90
  /** @type {<T>(_: readonly T[]) => T|null} */
91
91
  const first = a => undefinedToNull(a[0])
@@ -23,9 +23,11 @@ const {
23
23
  * } NotLazy
24
24
  */
25
25
 
26
+ /** @typedef {undefined} Empty */
27
+
26
28
  /**
27
29
  * @template T
28
- * @typedef {undefined | NonEmpty<T>} Result
30
+ * @typedef {Empty | NonEmpty<T>} Result
29
31
  */
30
32
 
31
33
  /**
@@ -36,7 +38,6 @@ const {
36
38
  /**
37
39
  * @template T
38
40
  * @typedef {{
39
- * readonly isConcat?: undefined
40
41
  * readonly first: T
41
42
  * readonly tail: List<T>
42
43
  * }} NonEmpty
@@ -45,7 +46,6 @@ const {
45
46
  /**
46
47
  * @template T
47
48
  * @typedef {{
48
- * readonly isConcat: true
49
49
  * readonly a: List<T>
50
50
  * readonly b: List<T>
51
51
  * }} Concat
@@ -78,7 +78,7 @@ const next = list => {
78
78
 
79
79
  if (a instanceof Array) {
80
80
  a = fromArray(a)
81
- } else if (a?.isConcat) {
81
+ } else if (a !== undefined && 'a' in a) {
82
82
  [a, b] = [a.a, concat(a.b)(b)]
83
83
  continue
84
84
  }