You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
355 B

2 months ago
'use strict';
var isAccessor = require('is-accessor-descriptor');
var isData = require('is-data-descriptor');
module.exports = function isDescriptor(obj, key) {
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
return false;
}
if ('get' in obj || 'set' in obj) {
return isAccessor(obj, key);
}
return isData(obj, key);
};