1.0.0 • Published 4 years ago

split-on-last v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Split on last Travis CI Build Status

Like split-on-first but splits on the last occurence.

NPM Badge

Install

npm install split-on-last

Usage

const splitOnlast = require('split-on-last');

splitOnlast('a-b-c', '-');
//=> ['a-b', 'c']

splitOnlast('key:value:value2', ':');
//=> ['key:value', 'value2']

splitOnlast('a---b---c', '---');
//=> ['a---b', 'c']

splitOnlast('a-b-c', '+');
//=> []

splitOnlast('abc', '');
//=> []

API

splitOnLast(string, seperator)

string

Type: string

The string to split.

seperator

Type: string

The separator to split on.