Skip to content

hutsoninc/rangify-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rangify-string

Build Status Current npm package version

Create an array from a string of integer ranges.

Installation

npm install --save rangify-string

Usage

const rangify = require('rangify-string');

rangify('1-3,5,9-10');
//=> [1, 2, 3, 5, 9, 10]

rangify('11,15-20');
//=> [11, 15, 16, 17, 18, 19, 20]

rangify('5-7,3-6', {
    sort: false,
    filter: false
})
//=> [5, 6, 7, 3, 4, 5, 6]

Options

Property Description Default
sort Sort the output array true
filter Filter duplicates from output array true

Authors

  • Austin Gordon - Development - GitHub

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Create an array from a string of integer ranges.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published