2 * expand-range <https://github.com/jonschlinkert/expand-range>
4 * Copyright (c) 2014-2015, Jon Schlinkert.
5 * Licensed under the MIT license.
10 var fill = require('fill-range');
12 module.exports = function expandRange(str, options, fn) {
13 if (typeof str !== 'string') {
14 throw new TypeError('expand-range expects a string.');
17 if (typeof options === 'function') {
22 if (typeof options === 'boolean') {
24 options.makeRe = true;
27 // create arguments to pass to fill-range
28 var opts = options || {};
29 var args = str.split('..');
30 var len = args.length;
31 if (len > 3) { return str; }
33 // if only one argument, it can't expand so return it
34 if (len === 1) { return args; }
36 // if `true`, tell fill-range to regexify the string
37 if (typeof fn === 'boolean' && fn === true) {
42 return fill.apply(null, args.concat(fn));