UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

24 lines (22 loc) 535 B
import "../../chunks/chunk-U5RRZUYZ.js"; // src/backend/util/JsonPatch.ts function applyJsonPatch(source, patch) { if (!patch || typeof patch !== "object") return source; for (const [key, value] of Object.entries(patch)) { if (value && typeof value === "object") { if (!source[key]) source[key] = {}; applyJsonPatch(source[key], value); } else { if (value === null) delete source[key]; else source[key] = value; } } return source; } export { applyJsonPatch };