Webpack build for branch master: 25bb602d5a

This commit is contained in:
Travis CI 2017-03-01 09:43:17 +00:00
parent 9b42283906
commit 01dd65bc04
2 changed files with 11 additions and 3 deletions

View file

@ -883,6 +883,15 @@ class Collection extends Map {
return accumulator; return accumulator;
} }
/**
* Creates an identical shallow copy of this collection.
* @returns {Collection}
* @example const newColl = someColl.clone();
*/
clone() {
return new this.constructor(this);
}
/** /**
* Combines this collection with others into a new collection. None of the source collections are modified. * Combines this collection with others into a new collection. None of the source collections are modified.
* @param {...Collection} collections Collections to merge * @param {...Collection} collections Collections to merge
@ -890,8 +899,7 @@ class Collection extends Map {
* @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); * @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
*/ */
concat(...collections) { concat(...collections) {
const newColl = new this.constructor(); const newColl = this.clone();
for (const [key, val] of this) newColl.set(key, val);
for (const coll of collections) { for (const coll of collections) {
for (const [key, val] of coll) newColl.set(key, val); for (const [key, val] of coll) newColl.set(key, val);
} }

File diff suppressed because one or more lines are too long