0.0.1 ā¢ Published 3 years ago
deconcat v0.0.1
deconcat
Tokenize a Concatenation Expression
features
š„ Blazing Fast O(1) Time.
š³ Quotes (including backticks) are preserved.
š¾ Spaces are properly ignored.
š³ Handles quotes and plus signs inside of strings
install
npm install deconcat
usage
Tokenizing String Concatentation
import deconcat from 'deconcat';
const expr = `"My name is " + name + "."`;
const tokens = deconcat(expr);
// tokens are [`"My name is"`, "name", `"."`];
// note: quotes are preserved, but spaces are not
Tokenizing Numerical Concatentation
import deconcat from 'deconcat';
const expr = `1 + 2 + 3`;
const tokens = deconcat(expr);
// tokens are ["1", "2", "3"];
0.0.1
3 years ago