🔪 split string by delimiter array - delimiters retained
$ yarn add super-split
const superSplit = require('super-split')
const str = 'A+B-C'
const delimiters = ['+', '-']
const result = superSplit(str, delimiters)
Result:
['A', '+', 'B', '-', 'C']
const str = 'I like to \u001b[34mmove it\u001b[39m, move it.'
const delimiters = ['\u001b[34m', '\u001b[39m']
const result = superSplit(str, delimiters)
Result:
['I like to ', '\u001b[34m', 'move it', '\u001b[39m', ', move it.']
const ary = [':-)', 'o_O']
const delimiters = ['-', '_']
const result = superSplit(ary, delimiters)
Result:
[':', '-', ')', 'o', '_', 'O']