functionalscript 0.0.492 → 0.0.493

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.
@@ -46,14 +46,14 @@ const isTest = s => s.endsWith('test.f.cjs')
46
46
 
47
47
  /**
48
48
  * @template T
49
- * @typedef {readonly[number, T]} State
49
+ * @typedef {readonly[number, T]} FullState
50
50
  */
51
51
 
52
52
  /** @type {<T>(input: Input<T>) => T} */
53
53
  const main = input => {
54
54
  let { moduleMap, log, performanceNow, state } = input
55
55
  /** @typedef {input extends Input<infer T> ? T : never} T */
56
- /** @type {(i: string) => (v: unknown) => (state: State<T>) => State<T>} */
56
+ /** @type {(i: string) => (v: unknown) => (fs: FullState<T>) => FullState<T>} */
57
57
  const test = i => v => ([time, state]) => {
58
58
  const next = test(`${i}| `)
59
59
  switch (typeof v) {
@@ -73,7 +73,7 @@ const main = input => {
73
73
  }
74
74
  case 'object': {
75
75
  if (v !== null) {
76
- /** @type {(k: readonly[string|number, unknown]) => (state: State<T>) => State<T>} */
76
+ /** @type {(k: readonly[string|number, unknown]) => (fs: FullState<T>) => FullState<T>} */
77
77
  const f = ([k, v]) => ([time, state]) => {
78
78
  state = log(`${i}${k}:`)(state);
79
79
  [time, state] = next(v)([time, state])
@@ -90,7 +90,7 @@ const main = input => {
90
90
  return [time, state]
91
91
  }
92
92
  const next = test('| ')
93
- /** @type {(k: readonly[string, Module]) => (fs: State<T>) => State<T>} */
93
+ /** @type {(k: readonly[string, Module]) => (fs: FullState<T>) => FullState<T>} */
94
94
  const f = ([k, v]) => ([time, state]) => {
95
95
  if (isTest(k)) {
96
96
  state = log(`testing ${k}`)(state);
@@ -98,10 +98,8 @@ const main = input => {
98
98
  }
99
99
  return [time, state]
100
100
  }
101
- /** @type {State<T>} */
102
- const init = [0, state]
103
101
  let time = 0;
104
- [time, state] = fold(f)(init)(Object.entries(moduleMap))
102
+ [time, state] = fold(f)([time, state])(Object.entries(moduleMap))
105
103
  state = log(`total ${time} ms`)(state);
106
104
  return state
107
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.492",
3
+ "version": "0.0.493",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "module.f.cjs",
6
6
  "scripts": {