aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-02-20 15:29:14 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-02-20 15:29:14 +0100
commit1144404e4bea677c293e9bad273ce273aa1cd885 (patch)
treeec66756c26c653194619a055dffa0234811b55fe /src/helpers.js
parentdfc07aa5be10a2b3749c3aae548d3652f0b780d5 (diff)
downloadsvg.js-1144404e4bea677c293e9bad273ce273aa1cd885.tar.gz
svg.js-1144404e4bea677c293e9bad273ce273aa1cd885.zip
Added clone method to SVG.Array/PointArray/PathArray (#590)
Diffstat (limited to 'src/helpers.js')
-rw-r--r--src/helpers.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/helpers.js b/src/helpers.js
index aa23bbe..2a52a1b 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -1,3 +1,15 @@
+// creates deep clone of array
+function array_clone(arr){
+ var clone = arr.slice(0)
+ for(var i = clone.length; i--;){
+ if(Array.isArray(clone[i])){
+ clone[i] = array_clone(clone[i])
+ }
+ }
+ return clone
+}
+
+// tests if a given element is instance of an object
function is(el, obj){
return el instanceof obj
}