Runnable Node scripts that exercise the json-difference library — one hand-crafted tiny case and one stress test against real fixtures.
Useful as:
- A smoke test when iterating on the library
- Reference for how to import and call
getDiffin a Node program
| File | Purpose |
|---|---|
src/simple.ts |
Diffs two small inline objects, prints delta + execution time |
src/stress.ts |
Diffs two large JSON fixtures from src/assets/, prints delta + execution time |
From the repository root:
# Run both scripts (simple + stress) in parallel via tsx
yarn nx run example:test
# Compile to dist/ (TypeScript + copy JSON fixtures)
yarn nx build exampleOr run a single script directly with tsx:
yarn tsx apps/example/src/simple.ts
yarn tsx apps/example/src/stress.tsdiff {"added":[["special2",false]],"removed":[["special",true]],"edited":[["color/color1","black","red"],["color/color2","brown","blue"]]}
Execution time: 1ms
- Drop a new
.tsfile undersrc/ - Import from
json-difference(already wired via the monorepo tsconfig paths) - Optionally register it in
project.jsonso it runs underyarn nx run example:test