aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/SVGArray.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-06-13 01:43:37 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-06-13 01:43:37 +0200
commit03322672782a6318b019eff33fe44ec800d6f12c (patch)
tree9d807e1585cf28a1ea98e87b855932dba00f1880 /src/types/SVGArray.js
parent8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff)
downloadsvg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz
svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip
dependency updates, easier formatting
Diffstat (limited to 'src/types/SVGArray.js')
-rw-r--r--src/types/SVGArray.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/types/SVGArray.js b/src/types/SVGArray.js
index 6ce024a..5826406 100644
--- a/src/types/SVGArray.js
+++ b/src/types/SVGArray.js
@@ -1,16 +1,16 @@
import { delimiter } from '../modules/core/regex.js'
export default class SVGArray extends Array {
- constructor (...args) {
+ constructor(...args) {
super(...args)
this.init(...args)
}
- clone () {
+ clone() {
return new this.constructor(this)
}
- init (arr) {
+ 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
@@ -19,30 +19,29 @@ export default class SVGArray extends Array {
}
// Parse whitespace separated string
- parse (array = []) {
+ parse(array = []) {
// If already is an array, no need to parse it
if (array instanceof Array) return array
return array.trim().split(delimiter).map(parseFloat)
}
- toArray () {
+ toArray() {
return Array.prototype.concat.apply([], this)
}
- toSet () {
+ toSet() {
return new Set(this)
}
- toString () {
+ toString() {
return this.join(' ')
}
// Flattens the array if needed
- valueOf () {
+ valueOf() {
const ret = []
ret.push(...this)
return ret
}
-
}