This is a library for javascript to handle Enclst data.
yarn add enclst-core-js
import { EncLst} from 'enclst-core-js'
import * as fs from "node:fs/promises";
const path = "path/of/enclst.enclst"
let str = await fs.readFile('test/data/test02.enclst', { encoding: "utf8" })
let enclst = new EncLst(str)
import { EncLst} from 'enclst-core-js'
const url = "https://github.com/UedaTakeyuki/EncLst/blob/main/examples/EncycloList/lang/en/en.enclst"
let enclst = {}
const res = await fetch(this.url)
if (res.status == 200) {
const data = await res.text();
enclst = new EncLst(data)
}
console.log(enclst.title)
console.log(enclst.items[0].title)
const value = enclst.items[0].value
if (value.hasParams()){
console.log(value.first()) // first positional parameter
}
if (value.hasPositinalParams()){
console.log(value.positional[0]) // first positional parameter
}
if (value.hasNamedParams()){
if ('aho' in value.named){
console.log(value.named['aho']) // named by 'aho'
}
}
yarn makedoc
API documents will be created to docs
folder.
latest document is available here.
yarn test
The test environment was set up according to this blog.