MCPcopy Create free account
hub / github.com/Lemoncode/fonk / isKey

Function isKey

src/helpers/get.js:566–585  ·  view source on GitHub ↗

* Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.

(value, object)

Source from the content-addressed store, hash-verified

564 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
565 */
566function isKey(value, object) {
567 if (isArray(value)) {
568 return false;
569 }
570 const type = typeof value;
571 if (
572 type == 'number' ||
573 type == 'symbol' ||
574 type == 'boolean' ||
575 value == null ||
576 isSymbol(value)
577 ) {
578 return true;
579 }
580 return (
581 reIsPlainProp.test(value) ||
582 !reIsDeepProp.test(value) ||
583 (object != null && value in Object(object))
584 );
585}
586
587/**
588 * Checks if `value` is suitable for use as unique object key.

Callers 1

baseGetFunction · 0.70

Calls 1

isSymbolFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…