split-it is a tiny javascript package designed to provide convenience methods for splitting strings in a variety of ways.
this package can be installed using either npm
or yarn
npm install @pixi-pack/split-it
yarn add @pixi-pack/split-it
after adding the package to your project, you can import the main class Split
to use the available methods:
const Split = require('split-it');
.it
is the base method of this library.
this method splits the given string on all classic delimiters:
commas, colons, tabs, newlines, and returns
Example Usage
Split.it('hello,from,split-it');
Split.it('hello:from:split-it');
Split.it('hello\tfrom\tsplit-it');
Split.it('hello\nfrom\rsplit-it');
// all of the above return ["hello", "from", "split-it"]
.onDelimiter
splits the given string by the given delimiter.
this method defaults to splitting on whitespace if no delimiter is passed.
Example Usage
Split.onDelimiter('hello.from.split-it', '.');
Split.onDelimiter('hello*from*split-it', '*');
Split.onDelimiter('hello|from|split-it', '|');
// all of the above return ["hello", "from", "split-it"]
want to contribute to split-it
? sweet!
if you'd like to contribute, please open an issue relating to the feature you'd like to work on,
and then open a pr linked to your issue. when you open your pr, please add your changes to the CHANGELOG under the ### added
or ### fixed
heading, as appropriate, with a link to your pr.
don't want to contribute code, but see something missing or broken? open an issue to report any bugs or errors you encounter.
before opening an issue or pr, please read (and adhere) to the following:
- be respectful
- be polite
- use empathy
- do not post anything containing hate speech or slurs
- failure to adhere to the above may result in removal of access to this project