character-sets
v1.0.8
Published
IANA Character Sets as JSON or Array of strings from https://www.iana.org/assignments/character-sets/character-sets.xhtml
Downloads
122
Maintainers
Readme
Install
NodeJS
npm i -S character-sets
HTTP
curl https://raw.githubusercontent.com/JustinBeaudry/character-sets/master/charsets.json -o charsets.json
Usage
const characterSets = require('character-sets');
// array of character sets
characterSets.toArray(); // ['UTF-8', ...]
// lower cased character set array
characterSets.normalize(); // ['utf-8', ...]
// is my character set a standardized character set?
characterSets.includes('utf-8'); // true
characterSets.includes('UTF-8'); // true
characterSets.includes('US-ASCII'); // true
characterSets.includes('us-ascii'); // true
characterSets.includes('pikachu'); // false
API
toArray(): string[]
Returns an array of IANA character set strings.
normalize(): string[]
Returns an array of lowercase IANA character set strings.
includes(charSet: string): boolean
Returns true
if the character set string is included in the standardized set of IANA character set strings,
otherwise returns false
.