main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
467 bytes
|
Line | |
---|
1 | import ary from './ary.js';
|
---|
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 | export default unary;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.