object-property-is-enumerable.js 590 B

12345678910111213
  1. 'use strict';
  2. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  3. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  4. // Nashorn ~ JDK8 bug
  5. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  6. // `Object.prototype.propertyIsEnumerable` method implementation
  7. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  8. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  9. var descriptor = getOwnPropertyDescriptor(this, V);
  10. return !!descriptor && descriptor.enumerable;
  11. } : nativePropertyIsEnumerable;