assign
优质
小牛编辑
129浏览
2023-12-01
Returns an ObjectLikeSequence whose elements are the combination of this sequence and another object. In the case of a key appearing in both this sequence and the given object, the other object's value will override the one in this sequence.
Signature
ObjectLikeSequence.assign = function(other) { /*...*/ }
ObjectLikeSequence.assign = function assign(other) { return new AssignSequence(this, other); }
Name | Type(s) | Description |
---|---|---|
other | Object | The other object to assign to this sequence. |
returns | ObjectLikeSequence | A new sequence comprising elements from this sequence plus the contents of |
Examples
Lazy({ "uno": 1, "dos": 2 }).assign({ "tres": 3 }) // sequence: { uno: 1, dos: 2, tres: 3 } Lazy({ foo: "bar" }).assign({ foo: "baz" }); // sequence: { foo: "baz" } Lazy({ foo: 'foo' }).assign({ foo: false }).get('foo') // false