concat
优质
小牛编辑
131浏览
2023-12-01
An optimized version of Sequence#concat that returns another ArrayLikeSequence if the argument is an array.
Signature
ArrayLikeSequence.concat = function(var_args) { /*...*/ }
ArrayLikeSequence.concat = function concat(var_args) { if (arguments.length === 1 && isArray(arguments[0])) { return new IndexedConcatenatedSequence(this, (/** @type {Array} */ var_args)); } else { return Sequence.prototype.concat.apply(this, arguments); } }
Name | Type(s) | Description |
---|---|---|
var_args | ...* |
Examples
Lazy([1, 2]).concat([3, 4]) // instanceof Lazy.ArrayLikeSequence Lazy([1, 2]).concat([3, 4]) // sequence: [1, 2, 3, 4]