js-tokens
TypeScript icon, indicating that this package has built-in type declarations

9.0.0 • Public • Published

js-tokens

The tiny, regex powered, lenient, almost spec-compliant JavaScript tokenizer that never fails.

const jsTokens = require("js-tokens");

const jsString = 'JSON.stringify({k:3.14**2}, null /*replacer*/, "\\t")';

Array.from(jsTokens(jsString), (token) => token.value).join("|");
// JSON|.|stringify|(|{|k|:|3.14|**|2|}|,| |null| |/*replacer*/|,| |"\t"|)

➡️ Full readme

/js-tokens/

    Package Sidebar

    Install

    npm i js-tokens

    Weekly Downloads

    43,648,314

    Version

    9.0.0

    License

    MIT

    Unpacked Size

    16.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • lydell