functionalscript 0.0.336 → 0.0.337

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.
@@ -390,10 +390,12 @@ const tokenizeEofOp = state => {
390
390
  /** @type {operator.StateScan<CharCodeOrEof, TokenizerState, list.List<JsonToken>>} */
391
391
  const tokenizeOp = state => input => input === undefined ? tokenizeEofOp(state) : tokenizeCharCodeOp(state)(input)
392
392
 
393
- /** @type {(input: list.List<CharCodeOrEof>) => list.List<JsonToken>} */
394
- const tokenize = input => list.flat(list.stateScan(tokenizeOp)({kind: 'initial'})(input))
393
+ const initial = list.stateScan(tokenizeOp)({ kind: 'initial' })
394
+
395
+ /** @type {(input: list.List<number>) => list.List<JsonToken>} */
396
+ const tokenize = input => list.flat(initial(list.concat(/** @type {list.List<CharCodeOrEof>} */(input))([undefined])))
395
397
 
396
398
  module.exports = {
397
399
  /** @readonly */
398
- tokenize,
400
+ tokenize
399
401
  }
@@ -3,23 +3,10 @@ const list = require('../../types/list/index.js')
3
3
  const json = require('../index.js')
4
4
  const { sort } = require('../../types/object/index.js')
5
5
 
6
- /** @type {(s: string) => list.List<tokenizer.CharCodeOrEof>} */
7
- const toCharacters = s =>
8
- {
9
- /** @type {list.List<tokenizer.CharCodeOrEof>} */
10
- const charCodes = list.toCharCodes(s)
11
- return list.concat(charCodes)([undefined])
12
- }
13
-
14
6
  /** @type {(s: string) => readonly tokenizer.JsonToken[]} */
15
- const tokenizeString = s =>
16
- {
17
- const characters = toCharacters(s)
18
- return list.toArray(tokenizer.tokenize(characters))
19
- }
7
+ const tokenizeString = s => list.toArray(tokenizer.tokenize(list.toCharCodes(s)))
20
8
 
21
- /** @type {(a: readonly tokenizer.JsonToken[]) => string} */
22
- const stringify = a => json.stringify(sort)(a)
9
+ const stringify = json.stringify(sort)
23
10
 
24
11
  {
25
12
  const result = tokenizeString('')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.336",
3
+ "version": "0.0.337",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {