UI for Zipcoin Blue

unary.js 469B

1234567891011121314151617181920212223
  1. var ary = require('./ary');
  2. /**
  3. * Creates a function that accepts up to one argument, ignoring any
  4. * additional arguments.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.0.0
  9. * @category Function
  10. * @param {Function} func The function to cap arguments for.
  11. * @returns {Function} Returns the new capped function.
  12. * @example
  13. *
  14. * _.map(['6', '8', '10'], _.unary(parseInt));
  15. * // => [6, 8, 10]
  16. */
  17. function unary(func) {
  18. return ary(func, 1);
  19. }
  20. module.exports = unary;