1.0.8 • Published 5 years ago

character-sets v1.0.8

Weekly downloads
24
License
MIT
Repository
github
Last release
5 years ago

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.