123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import Blockly from "blockly";
- // import googObject from "../goog/googObject";
- const goog = Blockly || {}
- goog.array = {};
- // goog.
- goog.typeOf = function(a) {
- var b = typeof a;
- if ("object" == b)
- if (a) {
- if (a instanceof Array)
- return "array";
- if (a instanceof Object)
- return b;
- var c = Object.prototype.toString.call(a);
- if ("[object Window]" == c)
- return "object";
- if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice"))
- return "array";
- if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call"))
- return "function"
- } else
- return "null";
- else if ("function" == b && "undefined" == typeof a.call)
- return "object";
- return b
- };
- goog.isArrayLike = function(a) {
- var b = goog.typeOf(a);
- return "array" == b || "object" == b && "number" == typeof a.length
- };
- goog.array.equals = function(a, b, c) {
- if (!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length)
- return !1;
- var d = a.length;
- c = c || goog.array.defaultCompareEquality;
- for (var e = 0; e < d; e++)
- if (!c(a[e], b[e]))
- return !1;
- return !0
- };
- goog.array.defaultCompareEquality = function(a, b) {
- return a === b
- };
- export default goog;
|