JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q35641F
  • License MIT

UTF-16 code-point based lexical string scanner.

Package Exports

  • codepoint-scanner

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 (codepoint-scanner) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

codepoint-scanner

UTF-16 code-point based lexical string scanner.

Build Status Code Climate js-standard-style

npm install codepoint-scanner --save

You can also download the files manually.

npm stats

npm NPM downloads David

Usage

var scan = require('codepoint-scanner')

API

scanner.string()
var scanner = scan('Hello world!')

scanner.string()
// => 'Hello world!'
scanner.codepoints()
var scanner = scan('Hello world!')

scanner.codepoints()
// => [ 72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33 ]
scanner.index()
var scanner = scan('Hello world!')

scanner.index()
// => 0
scanner.next()
var scanner = scan('Hello world!')

scanner.next()
// => 101

scanner.next()
// => 108

scanner.index()
// => 2
scanner.bos()
var scanner = scan('Hello world!')

scanner.bos()
// => true

scanner.next()
// => 101

scanner.bos()
// => false
scanner.reset()
var scanner = scan('Hello world!')

scanner.next()
// => 101

scanner.reset().bos()
// => true
scanner.eos()
var scanner = scan('Hello world!')

scanner.eos()
// => false

scanner.index(scanner.length() - 1).eos()
// => true
scanner.$()
var scanner = scan('Hello world!')

scanner.eos()
// => false

scanner.$().eos()
// => true
scanner.peek()
var scanner = scan('Hello world!')

scanner.index()
// => 0

scanner.peek()
// => [ 72 ]

scanner.peek(5)
// => [ 32 ]

scanner.peek(5, 7)
// => [ 32, 119 ]

scanner.index()
// => 0
scanner.at()
var scanner = scan('Hello world!')

scanner.index()
// => 0

scanner.at(5)
// => 32

Contributing

SEE: contributing.md

Licenses

GitHub license