Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
469 bytes
|
Line | |
---|
1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.