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