123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- 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++;
- }
-
- };
- }
- if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function(searchElement, fromIndex) {
- var k;
-
-
- if (this == null) {
- throw new TypeError('"this" is null or not defined');
- }
- var O = Object(this);
-
-
-
- var len = O.length >>> 0;
-
- if (len === 0) {
- return -1;
- }
-
-
- var n = +fromIndex || 0;
- if (Math.abs(n) === Infinity) {
- n = 0;
- }
-
- if (n >= len) {
- return -1;
- }
-
-
-
- k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
-
- while (k < len) {
-
-
-
-
-
-
-
-
-
-
-
-
- if (k in O && O[k] === searchElement) {
- return k;
- }
- k++;
- }
- return -1;
- };
- }
|