main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
561 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $TypeError = require('es-errors/type');
|
---|
| 4 |
|
---|
| 5 | var hasOwn = require('hasown');
|
---|
| 6 |
|
---|
| 7 | var isPropertyDescriptor = require('../helpers/records/property-descriptor');
|
---|
| 8 |
|
---|
| 9 | // https://262.ecma-international.org/5.1/#sec-8.10.2
|
---|
| 10 |
|
---|
| 11 | module.exports = function IsDataDescriptor(Desc) {
|
---|
| 12 | if (typeof Desc === 'undefined') {
|
---|
| 13 | return false;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | if (!isPropertyDescriptor(Desc)) {
|
---|
| 17 | throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | if (!hasOwn(Desc, '[[Value]]') && !hasOwn(Desc, '[[Writable]]')) {
|
---|
| 21 | return false;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | return true;
|
---|
| 25 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.