source: trip-planner-front/node_modules/is-data-descriptor/index.js@ 8d391a1

Last change on this file since 8d391a1 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 988 bytes
Line 
1/*!
2 * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
3 *
4 * Copyright (c) 2015, Jon Schlinkert.
5 * Licensed under the MIT License.
6 */
7
8'use strict';
9
10var typeOf = require('kind-of');
11
12// data descriptor properties
13var data = {
14 configurable: 'boolean',
15 enumerable: 'boolean',
16 writable: 'boolean'
17};
18
19function isDataDescriptor(obj, prop) {
20 if (typeOf(obj) !== 'object') {
21 return false;
22 }
23
24 if (typeof prop === 'string') {
25 var val = Object.getOwnPropertyDescriptor(obj, prop);
26 return typeof val !== 'undefined';
27 }
28
29 if (!('value' in obj) && !('writable' in obj)) {
30 return false;
31 }
32
33 for (var key in obj) {
34 if (key === 'value') continue;
35
36 if (!data.hasOwnProperty(key)) {
37 continue;
38 }
39
40 if (typeOf(obj[key]) === data[key]) {
41 continue;
42 }
43
44 if (typeof obj[key] !== 'undefined') {
45 return false;
46 }
47 }
48 return true;
49}
50
51/**
52 * Expose `isDataDescriptor`
53 */
54
55module.exports = isDataDescriptor;
Note: See TracBrowser for help on using the repository browser.