3.1.0 • Published 5 years ago

smart-splitter v3.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Smart Splitter

GitHub release npm Travis (.com)

Split strings the smarter way.

Why?

A developer might parse arguments using String#split, but this falls apart as soon as multi-word arguments need to be parsed:

"--force -m hey!".split(" "); // It works...
"--force -m 'hello world'".split(" "); // Nope: [..., "'hello", "world'"]

Smart Splitter aims to solve this problem. Quoted text remains as one string and does not contain quotes:

smartSplit("--force -m 'hello world'"); // Nice: ["--force", "-m", "hello world"]