Aerostack
bar_chart

data-deep-diff Edge Function — Data

Data

Computes a structural deep diff between two JSON-serializable values, classifying each change as added, removed, or modified.

navin @navin verified
Updated Mar 12, 2026
GitHub

Edge function data-deep-diff Computes a structural deep diff between two JSON-serializable values, classifying each change as added, removed, or modified.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.

terminal — aerostack cli
$ npx aerostack add navin/data-deep-diff
smart_toy

Use with AI Assistants

MCP

Connect Claude, Cursor, or any MCP-compatible client — then call this function by slug

① Add MCP Server

Add this once — access all Aerostack functions from your AI tool.

claude_desktop_config.json
{
  "mcpServers": {
    "aerostack": {
      "url": "https://mcp.aerostack.dev",
      "type": "http"
    }
  }
}

② Call this function

Ask your AI to use the call_function tool with this slug:

call_function
call_function({
  slug: "data-deep-diff",
  args: {
    "before": null,
    "after": null,
    "options": null
  }
})

data-deep-diff

Computes a structural deep diff between two JSON-serializable values, classifying each change as added, removed, or modified. Handles nested objects, arrays, primitives, and nulls. Zero external dependencies.

Install

aerostack function add data-deep-diff

Usage

import { deepDiff } from './functions/data-deep-diff';

const diff = deepDiff(
  { name: 'Alice', age: 30 },
  { name: 'Alice', age: 31, role: 'admin' }
);
// {
//   added:     { role: 'admin' },
//   removed:   {},
//   changed:   { age: { from: 30, to: 31 } },
//   unchanged: {}
// }

// Include unchanged keys
deepDiff({ a: 1, b: 2 }, { a: 1, b: 3 }, { includeUnchanged: true });
// unchanged: { a: 1 }, changed: { b: { from: 2, to: 3 } }

// Nested objects use dot-path keys
deepDiff(
  { user: { name: 'Alice', city: 'NYC' } },
  { user: { name: 'Bob', city: 'NYC' } }
);
// changed: { 'user.name': { from: 'Alice', to: 'Bob' } }

API

POST /api/data-deep-diff
{
  "before": { "name": "Alice", "age": 30 },
  "after": { "name": "Alice", "age": 31, "role": "admin" },
  "options": { "includeUnchanged": false }
}
{
  "success": true,
  "data": {
    "added": { "role": "admin" },
    "removed": {},
    "changed": { "age": { "from": 30, "to": 31 } },
    "unchanged": {}
  }
}
Field Type Required Default
before any yes --
after any yes --
options.includeUnchanged boolean no false
options.maxDepth number no 50

Metadata

upgrade Version 1.0.0
gavel License MIT
language Language typescript
cloud Provider aerostack

Tags

data
deployed_code

Build and publish your own functions

Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.

More Data Functions

Browse Data Functions →

Frequently asked questions

What does the data-deep-diff function do? +

data-deep-diff is a serverless edge function for data automation written in aerostack. Deploy it to Cloudflare Workers via your Aerostack workspace.

How do I deploy the data-deep-diff function? +

Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/data-deep-diff ``` It will be live on Cloudflare Workers in seconds.

What runtime does data-deep-diff use? +

data-deep-diff runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.

Can I customise the data-deep-diff function? +

Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.