aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/SVGArray.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-05-04 21:35:21 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-05-04 21:35:21 +1000
commitc8cb22863bf8c3ac157f6098be9154908aea9ec2 (patch)
treeb27b1bf6ec4c90bbd0cb335e26bb9ece504285d2 /src/types/SVGArray.js
parent59f09a1a2317e57d13bbe8f60e1949cc82199ead (diff)
downloadsvg.js-c8cb22863bf8c3ac157f6098be9154908aea9ec2.tar.gz
svg.js-c8cb22863bf8c3ac157f6098be9154908aea9ec2.zip
Fixed IE Polyfills, got rid of ArrayPolyfill in favour of babels own transforms, updated dependencies, finished tests, removed old es5 tests
Diffstat (limited to 'src/types/SVGArray.js')
-rw-r--r--src/types/SVGArray.js27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/types/SVGArray.js b/src/types/SVGArray.js
index 7f27ec4..dafa2d4 100644
--- a/src/types/SVGArray.js
+++ b/src/types/SVGArray.js
@@ -1,36 +1,33 @@
import { delimiter } from '../modules/core/regex.js'
-import { extend } from '../utils/adopter.js'
-import { subClassArray } from './ArrayPolyfill.js'
-const SVGArray = subClassArray('SVGArray', Array, function (arr) {
- this.init(arr)
-})
-
-export default SVGArray
+export default class SVGArray extends Array {
+ constructor (...args) {
+ super(...args)
+ this.init(...args)
+ }
-extend(SVGArray, {
init (arr) {
// This catches the case, that native map tries to create an array with new Array(1)
if (typeof arr === 'number') return this
this.length = 0
this.push(...this.parse(arr))
return this
- },
+ }
toArray () {
return Array.prototype.concat.apply([], this)
- },
+ }
toString () {
return this.join(' ')
- },
+ }
// Flattens the array if needed
valueOf () {
const ret = []
ret.push(...this)
return ret
- },
+ }
// Parse whitespace separated string
parse (array = []) {
@@ -38,13 +35,13 @@ extend(SVGArray, {
if (array instanceof Array) return array
return array.trim().split(delimiter).map(parseFloat)
- },
+ }
clone () {
return new this.constructor(this)
- },
+ }
toSet () {
return new Set(this)
}
-})
+}