Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

separate

bendrucker461MIT1.0.1

Separate a string at the specified indicies

separate, string, indicies

readme

separate Build Status

Separate a string at the specified indicies

Install

$ npm install --save separate

Usage

var separate = require('separate')

separate('000551234', '-', [3, 5])
//=> 000-55-1234

API

separate(string, separator, separators) -> string

string

Required
Type: string

A string to separate.

separator

Required
Type: string

The string to use as a separator.

separators

Required
Type: array[number]

The numeric indicies at which separators should be inserted in the original string.

License

MIT © Ben Drucker