当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

union

优质
小牛编辑
138浏览
2023-12-01

Creates a new sequence with all the unique elements either in this sequence or among the specified arguments.

Signature

Sequence.union = function(var_args) { /*...*/ }
Sequence.union = function union(var_args) {
  return this.concat(var_args).uniq();
}
NameType(s)Description
var_args...*

The values, or array(s) of values, to be additionally included in the resulting sequence.

returnsSequence

The new sequence.

Examples

Lazy(["foo", "bar"]).union([])             // sequence: ["foo", "bar"]
Lazy(["foo", "bar"]).union(["bar", "baz"]) // sequence: ["foo", "bar", "baz"]