data-deep-diff Edge Function — Data
DataComputes a structural deep diff between two JSON-serializable values, classifying each change as added, removed, or modified.
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.
npx aerostack add navin/data-deep-diff Use with AI Assistants
MCPConnect 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.
{
"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({
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
Tags
Publisher
@navin verified
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 →data-aggregate-stats
by @navin
Computes descriptive statistics (count, sum, min, max, mean, median, stdDev, variance, percentiles) for an array of numbers.
data-array-group-by
by @navin
Groups an array of objects into a map keyed by the value of a specified property. Zero dependencies.
data-csv-parse
by @navin
Parses a CSV string into an array of row objects with headers, handling quoted fields, custom delimiters, and escaped characters.
data-csv-to-json
by @navin
Converts a CSV string to a typed JSON array, automatically inferring numbers, booleans, and null values from string fields.
data-sort-objects
by @navin
Sorts an array of objects by one or more fields with configurable direction, null handling, and nested field dot-notation support.
data-dedupe-array
by @navin
Removes duplicate items from an array using strict equality for primitives, deep equality for objects, or a key field for object arrays.
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.