MCPcopy Index your code
hub / github.com/react/react / getOrInsertDefault

Function getOrInsertDefault

compiler/packages/make-read-only-util/src/makeReadOnly.ts:39–51  ·  view source on GitHub ↗
(
  m: SavedROObjects,
  k: object,
)

Source from the content-addressed store, hash-verified

37}
38
39function getOrInsertDefault(
40 m: SavedROObjects,
41 k: object,
42): {existed: boolean; entry: SavedROObject} {
43 const entry = m.get(k);
44 if (entry) {
45 return {existed: true, entry};
46 } else {
47 const newEntry: SavedROObject = new Map();
48 m.set(k, newEntry);
49 return {existed: false, entry: newEntry};
50 }
51}
52
53function buildMakeReadOnly(
54 logger: ROViolationLogger,

Callers 1

makeReadOnlyFunction · 0.70

Calls 2

setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected