_.partialRight
语法:
_.partialRight(func, [partials])源代码链接:source
npm包链接:npm package
描述:
这个函数类似_.partial,除了预设参数被附加到接受参数的后面。
这个_.partialRight.placeholder的值,默认是以_作为附加部分参数的占位符。
注意:这个方法不会设置 "length" 到函数上。
开始版本:1.0.0
参数:
func (Function): 需要预设的函数。[partials] (...*): 预设的参数。
返回值:
(Function):返回预设参数的函数。
例子:
var greet = function(greeting, name) {
return greeting + ' ' + name;
};
var greetFred = _.partialRight(greet, 'fred');
greetFred('hi');
// => 'hi fred'
// 使用了占位符。
var sayHelloTo = _.partialRight(greet, 'hello', _);
sayHelloTo('fred');
// => 'hello fred'Last updated
Was this helpful?