strip-brackets
v1.0.1
Published
Strips unecessary brackets
Downloads
3
Readme
strip-brackets
Strips unecessary brackets
Usage
Pass it some configuration parameters and it will give you a new function that strips all unnecessary brackets.
Function Signature
stripBrackets(openChar = '[', closeChar = ']', joinChars = [',']) => input => output
import stripBrackets from 'strip-brackets';
const stripSquareBrackets = stripBrackets('[', ']', [',']);
stripSquareBrackets('[[a,b],[c],[[d]]]'); // => "[a,b],c,d"
const stripParens = stripBrackets('(', ')', [',']);
stripParens('((a,b),(c),((d)))'); // => "(a,b),c,d"