Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// create arguments to pass to fill-range
var opts = options || {};
var args = str.split('..');
var len = args.length;
if (len > 3) { return str; }
// if only one argument, it can't expand so return it
if (len === 1) { return args; }
// if `true`, tell fill-range to regexify the string
if (typeof fn === 'boolean' && fn === true) {
opts.makeRe = true;
}
args.push(opts);
return fill.apply(fill, args.concat(fn));
};
if (len > 3) { return str; }
// if only one segment, it can't expand so return it
if (len === 1) { return segs; }
// if fn is "true", tell fill-range to regexify the string
if (fn === true) {
opts.toRegex = true;
fn = undefined;
}
// wrap the result in parentheses, when regexified and necessary
opts.capture = true;
segs.push(opts);
return fill.apply(null, segs);
};