Add Collection.map();

This commit is contained in:
Amish Shah
2016-09-03 23:00:08 +01:00
parent fced6983d9
commit 7f9ea762ed
2 changed files with 11 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -141,6 +141,16 @@ class Collection extends Map {
}
return collection;
}
/**
* Functionally identical shortcut to `collection.array().map(...)`.
* @param {function} callback Function that produces an element of the new Array, taking three arguments.
* @param {*} [thisArg] Optional. Value to use as this when executing callback.
* @returns {array}
*/
map(...args) {
return this.array().map(...args);
}
}
module.exports = Collection;