_.ary
语法:
_.ary(func, [n=func.length])源代码链接:source
npm包链接:npm package
描述:
创建一个调用func的函数。调用func时最多接受n个参数,忽略多出的参数。
开始版本:3.0.0
参数:
func (Function): 需要被限制参数个数的函数。[n=func.length] (number): 限制的参数数量。
返回值:
(Function): 返回新的覆盖函数。
例子:
_.map(['6', '8', '10'], _.ary(parseInt, 1));
// => [6, 8, 10]Last updated
Was this helpful?