seon
v6.1.1
Published
reader for S-Expression-Object-Notation
Downloads
66
Readme
seon
A reader for S-Expression-Object-Notation
See https://github.com/ayamada/seon2js
Usage (Library)
Add "seon": "^X.Y.Z" to "dependencies" in package.json.
And write import * as Seon from "seon/seon" in js file.
See https://github.com/ayamada/seon2js/tree/main/seon2js for example.
Usage (CLI)
npx seon2json [path/to/src.seon] [path/to/dst.json]To read from seon file, and write to json file.
See package.seon.
The prime use case of this tool is to use to comment out in package.json.
But it may cause a chicken-and-egg problem.
Because npx seon2json package.seon write out to package.json,
but it depend on package.json itself.
Therefore I recommend npm i -g seon to install globally for initial execution.
Syntax
Almost the same as edn, but different below.
,isunquote, NOT spacer.()is js-array for list expr. It have%L=1extra property.[]is js-array for vector expr. It have%V=1extra property.seon2jsonconvert from this to json's[].{}is js-array for block expr. It have%B=1extra property.seon2jsonconvert from this to json's{}.- Symbol and keyword are represented by encoded string in internal.
Type of symbols and keywords are js-string.
A keyword
:foois not equal":foo", and a symbolbaris not equal"bar"too, because these are encoded. Butseon2jsonoutputs these to"foo"and"bar", because JSON is not support neither symbol nor keyword. Poorly. In addition, symbol and keyword has to suport namespace like clojure. #_is provided as skip-next-one-element like clojure.
TODO
- Writer function will be provide in future, but not now.
- Scheme's SRFI-38 like syntax will provide in future, but not now.
ChangeLog
6.1.1: 20250225
- Bump up version of dependencies
6.1.0: 20240610
- Provide
export default
- Provide
6.0.0: 20240530
- BREAKING CHANGES:
- Deprecate to transform from
niltonullby seon2json
- Deprecate to transform from
- Bump up version of dependencies
- BREAKING CHANGES:
5.0.0: 20240315
- BREAKING CHANGES:
- Migrate almost dispatch fns to seon2js (without
#_)
- Migrate almost dispatch fns to seon2js (without
- BREAKING CHANGES:
4.2.1: 20240314
- Fix mangle/string2mangledString to treat slash character
4.2.0: 20240207
SYMandKWcan also use as normal function
4.1.0: 20240206
- Add
SYMandKWfor js backtick shortcut notation
- Add
4.0.0: 20240205
- Deprecate
renameNamespacesForStructand providerewriteAllSymbols
- Deprecate
3.0.3: 20240131
- Refine error message by unmatched parenthesis
3.0.2: 20240131
- Add
makeDenotationandisDenotationtoseon/seon
- Add
3.0.1: 20240130
- Add
throwErrorIfInvalidSymbolNametoseon/seon
- Add
3.0.0: 20240130
- BREAKING CHANGES:
- Remove
renameInternalSeonNamespacesand addrenameNamespacesForStructinseon/util
- Remove
- Add
seonCode2exprstoseon/util
- BREAKING CHANGES:
2.0.0: 20240128
- BREAKING CHANGES: Renew almost codes
- Remove src/seon/sym.mjs
- Remove
sastringsupports - Treat
{}to array marked asblockfor recreate js-block - Modify
mangleprocess- Remove to conversion from
?toisprefix - Through
?and.to js-varname for shortcut
- Remove to conversion from
- Support
#()#[]#{}syntax - Add
#emptyfor js skipped value like[1,,3]
- BREAKING CHANGES: Renew almost codes
1.0.1: 20240106
- Correct to mangle from
->to2
- Correct to mangle from
1.0.0: 20240103
- Breaking changes:
npx seon2jsonmangles symbols and keywords now (for example:{:foo-bar? 1}->{"isFooBar": 1}) If you don't want this, you should use string literal (for example:{"foo-bar?" 1}->{"foo-bar?": 1}) - Migrate
seon/manglemodule from seon2js - Hide error stacktrace of
npx seon2json, and display error stacktrace by--show-error-stacktraceoption - Display line number in message of object literal errors
- Breaking changes:
0.4.3: 20231231
- Change order of arguments of
sym.sk2stringUnchecked
- Change order of arguments of
0.4.2: 20231231
sym.sk2stringUncheckedreturns undefined by received non-sa
0.4.1: 20231231
- Export
sk2stringUncheckedby seon/sym
- Export
0.4.0: 20231231
- Move out
kebab2camelsymbol2mangledNamekeyword2mangledNamefrom seon/sym to seon2js
- Move out
0.3.1: 20231230
sym.kebab2camelchanges from->to2sym.kebab2camelchanges from start letter as number, to prependx
0.3.0: 20231229
sym.kebab2camelchanges fromfoo!tofoo, notdoFoonow
0.2.0: 20231226
- Keep line number information by passing util.renameInternalSeonNamespaces
0.1.0: 20231223
- Initial Release
