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

mithril-sync

v1.0.2

Published

A powerful utility to flatten, diff, rebuild, and sync deeply nested JavaScript data structures — inspired by magic, forged in code.

Readme

Mithril Sync 🧙🧰

A powerful utility for flattening, rebuilding, syncing, diffing, and searching deeply nested JavaScript objects. Inspired by the worlds of LOTR, Marvel, and Harry Potter.


📦 Installation

npm install mithril-sync

✨ Features

  • Flatten nested objects (objects, arrays, sets, maps)
  • Rebuild original object from flattened structure
  • Find key/value deeply with flexible filters
  • Track changes (diffs)
  • Live object mutation tracking
  • Apply, revert or sync changes
  • Use dotPath notation for fast access
  • Lightweight, dependency-free

📘 Usage

const MithrilSync = require("mithril-sync");

const obj = { user: { name: "John", age: 30 }, tags: ["hero", "wizard"] };

const tool = new MithrilSync(obj);

🔍 Methods

constructor(object)

Initializes the sync tool.

const tool = new MithrilSync({ a: { b: 1 } });

flatten(obj)

Static method to flatten any object.

const flat = MithrilSync.flatten({ a: { b: 1 } });

rebuild(entries)

Rebuilds original object from flat structure.

const rebuilt = MithrilSync.rebuild(flat);

getOriginal()

Returns original input object.

tool.getOriginal();

getFlat()

Returns current flat structure (after mutations).

tool.getFlat();

rebuild()

Rebuilds object from internal entries.

tool.rebuild();

updateEntry(dotPath, newValue)

Updates a specific entry.

tool.updateEntry("user.name", "Jane");

removeEntry(dotPath)

Removes a specific path.

tool.removeEntry("user.age");

getChanges(options?)

Detects differences from original.

tool.getChanges();

mergeWith(object)

Merges new object into existing one.

tool.mergeWith({ user: { email: "[email protected]" } });

revertChanges(diff)

Reverts changes based on a diff array.

const diff = tool.getChanges();

tool.revertChanges(diff);

watchLive(callback, interval, options?)

Watches object live and returns diffs.

tool.watchLive((changes) => console.log(changes));

stopWatch()

Stops live watch.

tool.stopWatch();

toTree(filterFn)

Filters entries and rebuilds into tree.

tool.toTree(entry => entry.dotPath.includes("user"));

find(options)

Finds key/value with filters and options.

tool.find({ target: "name", matchKeys: true });

Supports fallbackTargets:

tool.find({
  target: "nickname",
  fallbackTargets: ["alias", "name"]
});

Static Utilities

MithrilSync.get(obj, "a.b.c");
MithrilSync.set(obj, "a.b.c", 42);
MithrilSync.watch(oldEntries, newEntries, options);
MithrilSync.applyChanges(obj, diff);
MithrilSync.fromDiff(original, diff);

📜 License

MIT


🧙 Inspired by

  • 🧝‍♂️ Lord of the Rings
  • 🧙‍♂️ Harry Potter
  • 🦸 Marvel Universe