aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/core/shim/array.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/core/shim/array.js')
-rw-r--r--[-rwxr-xr-x]node_modules/montage/core/shim/array.js51
1 files changed, 1 insertions, 50 deletions
diff --git a/node_modules/montage/core/shim/array.js b/node_modules/montage/core/shim/array.js
index ff5d5d37..d5076440 100755..100644
--- a/node_modules/montage/core/shim/array.js
+++ b/node_modules/montage/core/shim/array.js
@@ -8,53 +8,11 @@
8 @see [Array class]{@link external:Array} 8 @see [Array class]{@link external:Array}
9 @module montage/core/shim/array 9 @module montage/core/shim/array
10*/ 10*/
11/**
12 @external Array
13*/
14 11
15/** 12/**
16 @function external:Array#equals 13 @external Array
17 @param {object} right The object to compare.
18 @returns {Boolean} true or false
19*/ 14*/
20if (!Array.prototype.equals) {
21 Object.defineProperty(Array.prototype, "equals", {
22 value: function (right) {
23 var i = 0,
24 length = this.length,
25 lhs,
26 rhs;
27
28 if (this === right) {
29 return true;
30 }
31
32 if (!right || !Array.isArray(right)) {
33 return false;
34 }
35
36 if (length !== right.length) {
37 return false;
38 } else {
39 for (; i < length; ++i) {
40 if (i in this) {
41 lhs = this[i],
42 rhs = right[i];
43 15
44 if (lhs !== rhs && (lhs && rhs && !lhs.equals(rhs))) {
45 return false;
46 }
47 } else {
48 if (i in right) {
49 return false;
50 }
51 }
52 }
53 }
54 return true;
55 }
56 });
57}
58/** 16/**
59 Shim implementation of Array.isArray() for browsers that don't yet support it. 17 Shim implementation of Array.isArray() for browsers that don't yet support it.
60 @function external:Array.isArray 18 @function external:Array.isArray
@@ -69,10 +27,3 @@ if (!Array.isArray) {
69 }); 27 });
70} 28}
71 29
72if (!Array.isCanvasPixelArray) {
73 Object.defineProperty(Array, "isCanvasPixelArray", {
74 value: function(obj) {
75 return Object.prototype.toString.call(obj) === "[object CanvasPixelArray]";
76 }
77 });
78}