0.0.1 ā€¢ Published 3 years ago

deconcat v0.0.1

Weekly downloads
-
License
CC0-1.0
Repository
github
Last release
3 years ago

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"];