UNPKG

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