1
|
/*!
|
2
|
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
|
3
|
*
|
4
|
* Copyright (c) 2015-2017, Jon Schlinkert.
|
5
|
* Released under the MIT License.
|
6
|
*/
|
7
|
|
8
|
'use strict';
|
9
|
|
10
|
var typeOf = require('kind-of');
|
11
|
var isAccessor = require('is-accessor-descriptor');
|
12
|
var isData = require('is-data-descriptor');
|
13
|
|
14
|
module.exports = function isDescriptor(obj, key) {
|
15
|
if (typeOf(obj) !== 'object') {
|
16
|
return false;
|
17
|
}
|
18
|
if ('get' in obj) {
|
19
|
return isAccessor(obj, key);
|
20
|
}
|
21
|
return isData(obj, key);
|
22
|
};
|