MCPcopy
hub / github.com/facebook/react / getStringID

Function getStringID

packages/react-devtools-shared/src/backend/legacy/renderer.js:613–628  ·  view source on GitHub ↗
(str: string | null)

Source from the content-addressed store, hash-verified

611 }
612
613 function getStringID(str: string | null): number {
614 if (str === null) {
615 return 0;
616 }
617 const existingID = pendingStringTable.get(str);
618 if (existingID !== undefined) {
619 return existingID;
620 }
621 const stringID = pendingStringTable.size + 1;
622 pendingStringTable.set(str, stringID);
623 // The string table total length needs to account
624 // both for the string length, and for the array item
625 // that contains the length itself. Hence + 1.
626 pendingStringTableLength += str.length + 1;
627 return stringID;
628 }
629
630 let currentlyInspectedElementID: number | null = null;
631 let currentlyInspectedPaths: Object = {};

Callers 1

recordMountFunction · 0.70

Calls 2

setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected