MCPcopy Create free account
hub / github.com/aosabook/500lines / validatePropertyKey

Function validatePropertyKey

spreadsheet/code/as-react-livescript/main.js:8721–8731  ·  view source on GitHub ↗

* Warn if the key is being defined as an object property but has an incorrect * value. * * @internal * @param {string} name Property name of the key. * @param {ReactComponent} component Component that requires a key. * @param {*} parentType component's parent's type.

(name, component, parentType)

Source from the content-addressed store, hash-verified

8719 * @param {*} parentType component's parent's type.
8720 */
8721 function validatePropertyKey(name, component, parentType) {
8722 if (!NUMERIC_PROPERTY_REGEX.test(name)) {
8723 return;
8724 }
8725 warnAndMonitorForKeyUse(
8726 'react_numeric_key_warning',
8727 'Child objects should have non-numeric keys so ordering is preserved.',
8728 component,
8729 parentType
8730 );
8731 }
8732
8733 /**
8734 * Shared warning and monitoring code for the key warnings.

Callers 1

validateChildKeysFunction · 0.85

Calls 2

warnAndMonitorForKeyUseFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected