2 * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
4 * Copyright (c) 2015-2017, Jon Schlinkert.
5 * Released under the MIT License.
10 var typeOf = require('kind-of');
12 module.exports = function isDataDescriptor(obj, prop) {
13 // data descriptor properties
15 configurable: 'boolean',
16 enumerable: 'boolean',
20 if (typeOf(obj) !== 'object') {
24 if (typeof prop === 'string') {
25 var val = Object.getOwnPropertyDescriptor(obj, prop);
26 return typeof val !== 'undefined';
29 if (!('value' in obj) && !('writable' in obj)) {
33 for (var key in obj) {
34 if (key === 'value') continue;
36 if (!data.hasOwnProperty(key)) {
40 if (typeOf(obj[key]) === data[key]) {
44 if (typeof obj[key] !== 'undefined') {