Skip to content

unary

js
_.unary(func)

创建一个接受最多一个参数的函数,忽略任何其他参数。

¥Creates a function that accepts up to one argument, ignoring any additional arguments.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. func (函数):限制参数的函数。

    ¥func (Function): The function to cap arguments for.

返回

¥Returns

(函数):返回新的上限函数。

¥(Function): Returns the new capped function.

示例

¥Example

js
_.map(['6', '8', '10'], _.unary(parseInt));
// => [6, 8, 10]

Lodash v4.17 中文网 - 粤ICP备13048890号