|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
679 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const isSymbol = require('../predicate/isSymbol.js');
|
|---|
| 6 |
|
|---|
| 7 | const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|---|
| 8 | const regexIsPlainProp = /^\w*$/;
|
|---|
| 9 | function isKey(value, object) {
|
|---|
| 10 | if (Array.isArray(value)) {
|
|---|
| 11 | return false;
|
|---|
| 12 | }
|
|---|
| 13 | if (typeof value === 'number' || typeof value === 'boolean' || value == null || isSymbol.isSymbol(value)) {
|
|---|
| 14 | return true;
|
|---|
| 15 | }
|
|---|
| 16 | return ((typeof value === 'string' && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value))) ||
|
|---|
| 17 | (object != null && Object.hasOwn(object, value)));
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | exports.isKey = isKey;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.