MCPcopy Create free account
hub / github.com/openai/plugins / diff

Function diff

plugins/shopify/skills/shopify-admin/scripts/validate.mjs:15557–15581  ·  view source on GitHub ↗
(oldArray, newArray)

Source from the content-addressed store, hash-verified

15555 return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast));
15556 }
15557 function diff(oldArray, newArray) {
15558 const added = [];
15559 const removed = [];
15560 const persisted = [];
15561 const oldMap = (0, _keyMap.keyMap)(oldArray, ({ name }) => name);
15562 const newMap = (0, _keyMap.keyMap)(newArray, ({ name }) => name);
15563 for (const oldItem of oldArray) {
15564 const newItem = newMap[oldItem.name];
15565 if (newItem === void 0) {
15566 removed.push(oldItem);
15567 } else {
15568 persisted.push([oldItem, newItem]);
15569 }
15570 }
15571 for (const newItem of newArray) {
15572 if (oldMap[newItem.name] === void 0) {
15573 added.push(newItem);
15574 }
15575 }
15576 return {
15577 added,
15578 persisted,
15579 removed
15580 };
15581 }
15582 }
15583});
15584

Callers 8

findDirectiveChangesFunction · 0.70
findTypeChangesFunction · 0.70
findUnionTypeChangesFunction · 0.70
findEnumTypeChangesFunction · 0.70
findFieldChangesFunction · 0.70
findArgChangesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected