8000 Deploy 2178312f7012762617fe05cc82792294796a144d to NPM branch · amdw/immutable-js@48970bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 48970bf

Browse files
author
Travis CI
committed
Deploy 2178312 to NPM branch
1 parent 1e9a13a commit 48970bf

File tree

3 files changed

+49
-25
lines changed

3 files changed

+49
-25
lines changed

dist/immutable.es.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4282,7 +4282,19 @@ var Set = (function (SetCollection$$1) {
42824282
Set.prototype.map = function map (mapper, context) {
42834283
var this$1 = this;
42844284

4285-
return updateSet(this, this._map.map(function (v) { return mapper(v, v, this$1); }, context));
4285+
var removes = [];
4286+
var adds = [];
4287+
this.forEach(function (value) {
4288+
var mapped = mapper.call(context, value, value, this$1);
4289+
if (mapped !== value) {
4290+
removes.push(value);
4291+
adds.push(mapped);
4292+
}
4293+
});
4294+
return this.withMutations(function (set) {
4295+
removes.forEach(function (value) { return set.remove(value); });
4296+
adds.forEach(function (value) { return set.add(value); });
4297+
});
42864298
};
42874299

42884300
Set.prototype.union = function union () {

dist/immutable.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4288,7 +4288,19 @@
42884288
Set.prototype.map = function map (mapper, context) {
42894289
var this$1 = this;
42904290

4291-
return updateSet(this, this._map.map(function (v) { return mapper(v, v, this$1); }, context));
4291+
var removes 95F7 = [];
4292+
var adds = [];
4293+
this.forEach(function (value) {
4294+
var mapped = mapper.call(context, value, value, this$1);
4295+
if (mapped !== value) {
4296+
removes.push(value);
4297+
adds.push(mapped);
4298+
}
4299+
});
4300+
return this.withMutations(function (set) {
4301+
removes.forEach(function (value) { return set.remove(value); });
4302+
adds.forEach(function (value) { return set.add(value); });
4303+
});
42924304
};
42934305

42944306
Set.prototype.union = function union () {

0 commit comments

Comments
 (0)
0