How to use arity-n - 1 common examples

To help you get started, we’ve selected a few arity-n 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 stoeffel / compose-function / module / index.js View on Github external
const funcs = functions.filter(fn => typeof fn === 'function');

  let lastIdx = funcs.length - 1;
  let arity = 0;

  if (funcs.length <= 0) {
    throw new Error('No funcs passed');
  }


  if (lastIdx >= 0 && funcs[lastIdx]) {
    arity = funcs[lastIdx].length;
  }

  return arityN(funcs.reduce(compose2), arity);
}

arity-n

Wraps a function with a function of a sertain arity.

MIT
Latest version published 10 years ago

Package Health Score

65 / 100
Full package analysis

Popular arity-n functions