JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2494578
  • Score
    100M100P100Q200281F

Expand a range of numbers or letters, uppercase or lowercase. Super fast, see the benchmarks.

Package Exports

  • expand-range

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (expand-range) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

expand-range NPM version

Expand a range of numbers or letters, uppercase or lowercase. Super fast, see the benchmarks.

Benchmarks

node benchmark

Example usage

var expand = require('expand-range');

expand('1..3')
//=> ['1', '2', '3']

expand('5..8')
//=> ['5', '6', '7', '8']

expand('00..05')
//=> ['00', '01', '02', '03', '04', '05']

expand('01..03')
//=> ['01', '02', '03']

expand('000..005')
//=> ['000', '001', '002', '003', '004', '005']

expand('a..e')
//=> ['a', 'b', 'c', 'd', 'e']

expand('A..E')
//=> ['A', 'B', 'C', 'D', 'E']

Pass a function as the last argument to customize the expansions:

var range = expand('a..e', function (str, i) {
  return String.fromCharCode(str) + i;
});

console.log(range);
//=> ['a0', 'b1', 'c2', 'd3', 'e4']

Install

Install with npm:

npm i expand-range --save-dev

Run tests

npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on October 20, 2014.