Sha256: 51e33531397eca27ac3075beb0e4fd311a451f365d452f78e247b5b9f0734b67

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
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;
    };
  }());
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
amcharts.rb-3.11.2.17 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.11.2.16 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.11.2.14 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.11.1.14 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.8.0 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.7.5 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.7.4 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.7.3 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.7.2 app/assets/javascripts/amcharts/ext/object_keys.js
amcharts.rb-3.4.7.1 app/assets/javascripts/amcharts/ext/object_keys.js