summaryrefslogtreecommitdiffstats
path: root/src/helpers.js
diff options
context:
space:
mode:
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
}