123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- if (!Object.keys) {
- Object.keys = (function () {
- 'use strict';
- var hasOwnProperty = Object.prototype.hasOwnProperty,
- hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
- dontEnums = [
- 'toString',
- 'toLocaleString',
- 'valueOf',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'constructor'
- ],
- dontEnumsLength = dontEnums.length;
- return function (obj) {
- if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
- throw new TypeError('Object.keys called on non-object');
- }
- var result = [], prop, i;
- for (prop in obj) {
- if (hasOwnProperty.call(obj, prop)) {
- result.push(prop);
- }
- }
- if (hasDontEnumBug) {
- for (i = 0; i < dontEnumsLength; i++) {
- if (hasOwnProperty.call(obj, dontEnums[i])) {
- result.push(dontEnums[i]);
- }
- }
- }
- return result;
- };
- }());
- }
- if (!Array.prototype.forEach) {
- Array.prototype.forEach = function (callback, thisArg) {
- var T, k;
- if (this == null) {
- throw new TypeError(' this is null or not defined');
- }
-
- var O = Object(this);
-
-
- var len = O.length >>> 0;
-
-
- if (typeof callback !== "function") {
- throw new TypeError(callback + " is not a function");
- }
-
- if (arguments.length > 1) {
- T = thisArg;
- }
-
- k = 0;
-
- while (k < len) {
- var kValue;
-
-
-
-
-
- if (k in O) {
-
- kValue = O[k];
-
-
- callback.call(T, kValue, k, O);
- }
-
- k++;
- }
-
- };
- }
|