Big update!Introducing GitHub Bot Commands. Learn more
Socket
BlogLoveLog in
Book a demo

js-tokens

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Issues
File Explorer

Advanced tools

js-tokens

Tiny JavaScript tokenizer.

    8.0.0latest

Version published
Maintainers
1
Weekly downloads
36,875,212
increased by3.45%

Weekly downloads

Changelog

Source

Version 8.0.0 (2022-05-15)

Support for ES2022!

  • Added: Support for the d regex flag.

  • Added: A new token type – PrivateIdentifier – for things like #name.

    this.#name now tokenizes differently:

    • Before: IdentifierName: this, Punctuator: ., Invalid: #, IdentifierName: name
    • After: IdentifierName: this, Punctuator: ., PrivateIdentifier: #name

Readme

Source

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

Keywords

FAQs

What is js-tokens?

Tiny JavaScript tokenizer.

Is js-tokens popular?

The npm package js-tokens receives a total of 35,200,404 weekly downloads. As such, js-tokens popularity was classified as popular.

Is js-tokens well maintained?

We found that js-tokens demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 15 May 2022
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc