prototype.plant
_.prototype.plant(value)
创建链序列的克隆,将 value
植入为封装值。
¥Creates a clone of the chain sequence planting value
as the wrapped value.
新增于
¥Since
3.2.0
参数
¥Arguments
-
value
(*):要植入的值。¥
value
()*: The value to plant.
返回
¥Returns
(对象):返回新的 lodash
封装器实例。
¥(Object): Returns the new lodash
wrapper instance.
示例
¥Example
function square(n) {
return n * n;
}
var wrapped = _([1, 2]).map(square);
var other = wrapped.plant([3, 4]);
other.value();
// => [9, 16]
wrapped.value();
// => [1, 4]