splitargs
Splits strings into tokens by given separator except treating quoted part as a single token.
Installation
npm install splitargs
Usage
var splitargs = ; var i1 = "I said 'I am sorry.', and he said \"it doesn't matter.\"";var o1 = ;console;/*[ 'I', 'said', 'I am sorry.,', 'and', 'he', 'said', 'it doesn\'t matter.' ]*/ var i2 = "I said \"I am sorry.\", and he said \"it doesn't matter.\"";var o2 = ;console;/*[ 'I', 'said', 'I am sorry.,', 'and', 'he', 'said', 'it doesn\'t matter.' ]*/ var i3 = 'I said "I am sorry.", and he said "it doesn\'t matter."';var o3 = ;console;/*[ 'I', 'said', 'I am sorry.,', 'and', 'he', 'said', 'it doesn\'t matter.' ]*/ var i4 = 'I said \'I am sorry.\', and he said "it doesn\'t matter."';var o4 = ;console;/*[ 'I', 'said', 'I am sorry.,', 'and', 'he', 'said', 'it doesn\'t matter.' ]*/