aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/ArrayPolyfill.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-12 12:00:03 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-12 13:01:01 +0100
commit6ea72cae2c761848b7db2c9457fd41c62d0336d6 (patch)
tree4d62e3f49a8e4922ed520739e4ab9b42b67e9e97 /src/types/ArrayPolyfill.js
parentc108c060152add00cac72a4911f6e998ffb4eb83 (diff)
downloadsvg.js-6ea72cae2c761848b7db2c9457fd41c62d0336d6.tar.gz
svg.js-6ea72cae2c761848b7db2c9457fd41c62d0336d6.zip
make List return new lists on method calls, add map to array polyfill so that this works, fix runner
Diffstat (limited to 'src/types/ArrayPolyfill.js')
-rw-r--r--src/types/ArrayPolyfill.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/types/ArrayPolyfill.js b/src/types/ArrayPolyfill.js
index 839a970..4d2309f 100644
--- a/src/types/ArrayPolyfill.js
+++ b/src/types/ArrayPolyfill.js
@@ -24,6 +24,12 @@ export const subClassArray = (function () {
Arr.prototype = Object.create(baseClass.prototype)
Arr.prototype.constructor = Arr
+ Arr.prototype.map = function (fn) {
+ const arr = new Arr()
+ arr.push.apply(arr, Array.prototype.map.call(this, fn))
+ return arr
+ }
+
return Arr
}
}