npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lp-labs/json-merge-patch

v0.1.0

Published

Detached finite-JSON RFC 7396 merge patches with explicit traversal budgets.

Readme

@lp-labs/json-merge-patch

Detached finite-JSON RFC 7396 merge patches with explicit traversal budgets.

Install

npm install @lp-labs/json-merge-patch

Node.js 18+; standalone browser-compatible ES2022 core with DOM codec types. Zero runtime or peer dependencies. ESM and CommonJS with separate declarations. No filesystem, network or environment side effects.

Quickstart

import { mergePatch } from '@lp-labs/json-merge-patch';
console.log(
  mergePatch(
    { title: 'old', tags: ['a'], details: { obsolete: true } },
    { title: 'new', tags: ['b'], details: { obsolete: null } },
  ),
);

CommonJS consumers use const api = require('@lp-labs/json-merge-patch'). The same named API is available in both module formats. No default export.

API, behavior, errors and limits

mergePatch implements RFC7396: non-object patches including arrays/null replace the entire target; object patches merge recursively, null members delete, arrays never merge elementwise. Null cannot be assigned as an object member using merge-patch (root null is supported). Inputs are validated and deep-detached before applying; output shares no references with target/patch. Object outputs have null prototypes; all keys including proto are data. JsonValue permits finite numbers, plain/null-prototype objects, dense arrays; no undefined, cycles, symbols, getters, custom classes, or decorated arrays. JsonLimits maxDepth defaults 64 (root 0, maximum 256), maxNodes 100,000; each input and final result must independently fit. RangeError bounds; TypeError invalid JSON. O(target+patch+result) work/space with bounded recursion; no patch-generation/diff API.

All exports: JsonValue, JsonLimits, mergePatch.

Full TypeScript declarations

export type JsonValue =
  | null
  | boolean
  | number
  | string
  | JsonValue[]
  | {
      [key: string]: JsonValue;
    };
export interface JsonLimits {
  maxDepth?: number;
  maxNodes?: number;
}
export declare function mergePatch(target: JsonValue, patch: JsonValue, o?: JsonLimits): JsonValue;

Development

npm ci --offline
npm run typecheck
npm test
npm run format:check

TypeScript ^5.9.3 and Prettier ^3.6.2 are development-only. Build emits dist/esm and dist/cjs. Tests use Node's test runner; consumer.mts and consumer.cts exercise bare package imports including negative type assertions.

Support

If this library is useful to you, consider supporting its maintenance with a donation via PayPal.

Author

Created by Libin Prasanth. Connect on LinkedIn for updates and discussion.