MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / mergeStrict

Function mergeStrict

src/util/object.ts:6–22  ·  view source on GitHub ↗
(
  ...objects: Record<string, Value>[]
)

Source from the content-addressed store, hash-verified

4 * @returns The merged object
5 */
6export function mergeStrict<Value>(
7 ...objects: Record<string, Value>[]
8): Record<string, Value> {
9 const returnValue: Record<string, Value> = {};
10
11 objects.forEach((object: object) => {
12 for (const [key, value] of Object.entries(object)) {
13 if (returnValue.hasOwnProperty(key)) {
14 throw new Error(`Found duplicate property ${key}`);
15 }
16
17 returnValue[key] = value;
18 }
19 });
20
21 return returnValue;
22}

Callers 2

initMethod · 0.90
updateUserSnippetsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected