qm-txt-splitByHyphen
Tiny module for splitting string by its hyphen (and hyphen-like chars). It is recognizing following characters:
\u002D
- HYPHEN-MINUS (-)\u2010
- HYPHEN (‐)\u2011
- NON-BREAKING HYPHEN (‑)\u2012
- FIGURE DASH (‒)\u2013
- EN DASH (–)\u2014
- EM DASH (—)\u2015
- HORIZONTAL BAR (―)\u2E3A
- TWO-EM DASH (⸺)\u2E3B
- THREE-EM DASH (⸻)\uFE58
- SMALL EM DASH (﹘)\uFE63
- SMALL HYPHEN-MINUS (﹣)\uFF0D
- FULLWIDTH HYPHEN-MINUS (-)
Installation
$ npm i -S qm-txt-splitbyhyphen
Usage
const splitByHyphen = ;
; //-> undefined; //-> ["tere", "fere"]; //-> ["a", "b", "c", "d", "e", "f", "g"]
TitleSplit mode in witch splits string by only one hyphen e.g:
; // -> ["a", "b-c-d-e-f-g"]; // -> ["a-b", "c-d-e-f-g"]; // -> ["a-b-c", "d-e-f-g"]; // default it is off -> ["a", "b", "c", "d", "e", "f", "g"]; // -> ["a", "b", "c", "d", "e", "f", "g"]
API
splitByHyphen(string, titleSplitAt = 0)
License
MIT © qaraluch