MCPcopy
hub / github.com/anomalyco/models.dev / compare

Function compare

packages/core/script/generate-wandb.ts:398–416  ·  view source on GitHub ↗
(field: string, oldValue: unknown, newValue: unknown)

Source from the content-addressed store, hash-verified

396 };
397
398 const compare = (field: string, oldValue: unknown, newValue: unknown) => {
399 const changed = field.startsWith("cost.")
400 ? (
401 oldValue === undefined && newValue === undefined
402 ? false
403 : oldValue === undefined || newValue === undefined
404 ? true
405 : Math.abs((oldValue as number) - (newValue as number)) > epsilon
406 )
407 : JSON.stringify(oldValue) !== JSON.stringify(newValue);
408
409 if (changed) {
410 changes.push({
411 field,
412 oldValue: formatValue(oldValue),
413 newValue: formatValue(newValue),
414 });
415 }
416 };
417
418 compare("name", existing.name, merged.name);
419 compare("family", existing.family, merged.family);

Callers 1

detectChangesFunction · 0.70

Calls 1

formatValueFunction · 0.70

Tested by

no test coverage detected