JSPM

chc

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q28759F

Character Classes

Package Exports

  • chc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (chc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

chc

Character Class

Table of contents

Get Started

const chc = require('chc');

// Create an instance of CharSet.
const cs = new chc.CharSet('a', 'z');

// Get number of characters in the CharSet.
cs.length == 26;

// Get the next character in the CharSet.
cs.next();
// RETURN 'a'

// If all characters iterated.
cs.isEnd();
// RETURN false

// Reset the iteration state.
cs.reset();
cs.next();
// RETURN 'a'

API

Create CharSet Instances

  • class | CharSet chc.CharSet( CHAR start, CHAR end ) throws Error


    Create a charset containing characters from start to end. Here CHAR maybe a code point number or a string containing one but only one character. When invalid arguments passed in, an error will be thrown.
    To create an CharSet instance, this function supports both contrutor mode and factory mode.
    Hereafter use <charset> to represent an instance of CharSet.

  • class | CharSet chc.CharSet(String chars)


    Create a charset containing every character in char.

  • CharSet CharSet.concat( CHAR | string | CharSet | Array chars, ... )


    Create a new charset.

  • CharSet <charset>.concat( CHAR | string | CharSet | Array chars, ... )


    Concatenate current charset with the character(s) or charsets, and return a new charset.

  • boolean <charset>.isEnd()


    If all characters in the charset have been iterated.

  • number <charset>.length()


    Number of characters in the charset.

  • boolean <charset>.next()


    Get the next character in the charset.

  • boolean <charset>.reset()


    Reset the iteration state of the charset.

  • Array <charset>.toArray("string" | "number" type = "string")


    Return characters in the charset. If type equals "number", an array of code points will be returned.

About

Following packages depend on chc and offer predefined charsets: * chc-posix