How to use the fill-range.apply function in fill-range

To help you get started, we’ve selected a few fill-range examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iamdjones / sublime-text-browser-sync / node_modules / browser-sync / node_modules / expand-range / index.js View on Github external
// 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));
};
github jonschlinkert / expand-range / index.js View on Github external
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);
};

fill-range

Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`

MIT
Latest version published 6 months ago

Package Health Score

79 / 100
Full package analysis

Popular fill-range functions