Skip to content

Commit

Permalink
build readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Jan 30, 2015
1 parent debeafa commit 965fc42
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ npm i fill-range --save
```js
var range = require('fill-range');

range('a', 'e')
range('a', 'e');
//=> ['a', 'b', 'c', 'd', 'e']
```

**Params**

```js
range(start, stop, increment);
range(start, stop, step, options, fn);
```

- `start`: the number or letter to start with
- `end`: the number or letter to end with
- `step`: optionally pass the increment to use. works for letters or numbers
- `start`: **{String|Number}** the number or letter to start with
- `end`: **{String|Number}** the number or letter to end with
- `step`: **{String|Number}** optionally pass the step to use. works for letters or numbers.
- `options`: **{Object}**:
+ `makeRe`: return a regex-compatible string (still returned as an array for consistency)
+ `step`: pass the step on the options as an alternative to passing it as an argument
+ `silent`: `true` by default, set to false to throw errors for invalid ranges.
- `fn`: **{Function}** optionally [pass a function](#custom-function) to modify each character


**Examples**
Expand Down Expand Up @@ -59,6 +64,24 @@ range('A', 'E', 2)
//=> ['A', 'C', 'E']
```

### Invalid ranges

When an invalid range is passed, `null` is returned.

```js
range('1.1', '2');
//=> null

range('a', '2');
//=> null

range(1, 10, 'foo');
//=> null
```

If you want errors to be throw, pass `silent: false` on the options:


### Custom function

Optionally pass a custom function as the third or fourth argument:
Expand Down Expand Up @@ -235,10 +258,10 @@ Released under the MIT license

***

_This file was generated by [verb](https://github.com/assemble/verb) on January 26, 2015._
_This file was generated by [verb](https://github.com/assemble/verb) on January 30, 2015._

[randomatic]: https://github.com/jonschlinkert/randomatic

[expand-range]: https://github.com/jonschlinkert/expand-range
[micromatch]: https://github.com/jonschlinkert/micromatch
[braces]: https://github.com/jonschlinkert/braces
[braces]: https://github.com/jonschlinkert/braces

0 comments on commit 965fc42

Please sign in to comment.