|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
779 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var $ = require('../internals/export');
|
|---|
| 3 | var bind = require('../internals/function-bind-context');
|
|---|
| 4 | var aSet = require('../internals/a-set');
|
|---|
| 5 | var SetHelpers = require('../internals/set-helpers');
|
|---|
| 6 | var iterate = require('../internals/set-iterate');
|
|---|
| 7 |
|
|---|
| 8 | var Set = SetHelpers.Set;
|
|---|
| 9 | var add = SetHelpers.add;
|
|---|
| 10 |
|
|---|
| 11 | // `Set.prototype.map` method
|
|---|
| 12 | // https://github.com/tc39/proposal-collection-methods
|
|---|
| 13 | $({ target: 'Set', proto: true, real: true, forced: true }, {
|
|---|
| 14 | map: function map(callbackfn /* , thisArg */) {
|
|---|
| 15 | var set = aSet(this);
|
|---|
| 16 | var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|---|
| 17 | var newSet = new Set();
|
|---|
| 18 | iterate(set, function (value) {
|
|---|
| 19 | add(newSet, boundFunction(value, value, set));
|
|---|
| 20 | });
|
|---|
| 21 | return newSet;
|
|---|
| 22 | }
|
|---|
| 23 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.