Last change
on this file since 571e0df was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago |
primeNG components
|
-
Property mode
set to
100644
|
File size:
988 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /*!
|
---|
| 2 | * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
|
---|
| 3 | *
|
---|
[e29cc2e] | 4 | * Copyright (c) 2015, Jon Schlinkert.
|
---|
| 5 | * Licensed under the MIT License.
|
---|
[6a3a178] | 6 | */
|
---|
| 7 |
|
---|
| 8 | 'use strict';
|
---|
| 9 |
|
---|
| 10 | var typeOf = require('kind-of');
|
---|
| 11 |
|
---|
[e29cc2e] | 12 | // data descriptor properties
|
---|
| 13 | var data = {
|
---|
| 14 | configurable: 'boolean',
|
---|
| 15 | enumerable: 'boolean',
|
---|
| 16 | writable: 'boolean'
|
---|
| 17 | };
|
---|
[6a3a178] | 18 |
|
---|
[e29cc2e] | 19 | function isDataDescriptor(obj, prop) {
|
---|
[6a3a178] | 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;
|
---|
[e29cc2e] | 49 | }
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * Expose `isDataDescriptor`
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | module.exports = isDataDescriptor;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.