source: frontend/node_modules/es-abstract/2019/GetOwnPropertyKeys.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 831 bytes
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var hasSymbols = require('has-symbols')();
6
7var $TypeError = require('es-errors/type');
8var isObject = require('es-object-atoms/isObject');
9
10var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
11var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%', true);
12var keys = require('object-keys');
13
14// https://262.ecma-international.org/6.0/#sec-getownpropertykeys
15
16module.exports = function GetOwnPropertyKeys(O, Type) {
17 if (!isObject(O)) {
18 throw new $TypeError('Assertion failed: Type(O) is not Object');
19 }
20 if (Type === 'Symbol') {
21 return $gOPS ? $gOPS(O) : [];
22 }
23 if (Type === 'String') {
24 if (!$gOPN) {
25 return keys(O);
26 }
27 return $gOPN(O);
28 }
29 throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`');
30};
Note: See TracBrowser for help on using the repository browser.