charcode-is-valid-xml-name-character
v3.0.10
Published
Does a given character belong to XML spec's "Production 4 OR 4a" type (is acceptable for XML element's name)
Downloads
162
Maintainers
Readme
Install
This package is pure ESM. If you're not ready yet, install an older version of this program, 1.13.0 (npm i [email protected]
).
npm i charcode-is-valid-xml-name-character
Quick Take
import { strict as assert } from "assert";
import {
isProduction4,
isProduction4a,
validFirstChar,
validSecondCharOnwards,
} from "charcode-is-valid-xml-name-character";
// Spec: https://www.w3.org/TR/REC-xml/#NT-NameStartChar
assert.equal(isProduction4("Z"), true);
assert.equal(isProduction4("?"), false);
assert.equal(isProduction4a("?"), false);
assert.equal(isProduction4a("-"), true);
assert.equal(validFirstChar("a"), true);
assert.equal(validFirstChar("1"), false);
assert.equal(validSecondCharOnwards("a"), true);
assert.equal(validSecondCharOnwards("?"), false);
Documentation
Please visit codsen.com for a full description of the API.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License.
Copyright © 2010-2024 Roy Revelt and other contributors.