Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by micromatch.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.
Install with npm:
$ npm install --save expand-range
var expand = ;;// examplesconsole //=> ['1', '2', '3']console //=> [ '1', '4', '7', '10' ]
start: the number or letter to start with
end: the number or letter to end with
step: (optional) the step/increment to use. works with letters and numbers.
options: Options object to pass to fill-range, or a transform function (see fill-range readme for details and documentation)
//=> ['a', 'b', 'c', 'd', 'e']//=> ['a', 'c', 'e']//=> ['A', 'C', 'E']//=> ['1', '2', '3']//=> [ '0', '-1', '-2', '-3', '-4', '-5' ]//=> [ '-9', '-6', '-3', '0', '3', '6', '9' ])//=> [ '-1', '-3', '-5', '-7', '-9' ]//=> [ '1', '3', '5', '7', '9' ]
Optionally pass a custom function as the second argument:
;//=> ['a0', 'b1', 'c2', 'd3', 'e4']
stepcharacters are no longer supported, as the same thing can be accomplished with a custom transform function.
- The signature in the transform function has changed. See fill-range for more details.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
You might also be interested in these projects:
- fill-range: Fill in a range of numbers or letters, optionally passing an increment or
stepto… more | homepage
This file was generated by verb-generate-readme, v0.8.0, on November 26, 2018.