import { extractProps, extractPropsSpec } from 'rexml'
const s = `id="d2"
class="example"
value="123"
parsable="true"
ignore="false"
2-non-spec
required`
const res = extractProps(s)
console.log(JSON.stringify(res, null, 2))
const res2 = extractProps(s, false)
console.log(JSON.stringify(res2, null, 2))
const res3 = extractPropsSpec(s)
console.log(JSON.stringify(res3, null, 2))
|
{
"id": "d2",
"class": "example",
"value": 123,
"parsable": true,
"ignore": false,
"2-non-spec": true,
"required": true
}
{
"id": "d2",
"class": "example",
"value": "123",
"parsable": "true",
"ignore": "false",
"2-non-spec": true,
"required": true
}
{
"id": "d2",
"class": "example",
"value": 123,
"parsable": true,
"ignore": false,
"required": true
}
|