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

@dashkite/diff

v0.11.14

Published

Generalized dictionary-based diff

Readme

@dashkite/diff

Generalized dictionary-based diff

Diff synchronizes a source with a target using a patch function. The source and target should be dictionaries. Diff provides presets for the filesystem, S3, and DashKite DB (Graphene).

For example, to synchronize the local filesystem with S3, you would write:

import { diff, FS, S3 } from "@dashkite/diff"

diff
  source: FS.glob glob: "**", root: "build"
  target: S3.glob domain: "foobar.com", glob: "**"
  patch: S3.patch domain: "foobar.com"

You can also provide the dictionaries and just iterate through the patches:

for patch in diff source, target
  console.log patch

Status

Under heavy active development. Not ready for production use.

Roadmap

  • Migrate Presets into their own modules.
  • Allow the Preset functions for Graphene to take a byname.
  • Add tests (currently tested via other modules that rely on it).
  • Determine relationship to JS diff patch format(s).
  • Support HTTP as preset via patch requests.
  • Allow preset shorthand (ex: fs) via preset registry.
  • Infer patch function based on target preset?

API

Common Types

Dictionary

An object representing a key-value store that can be represented as a dictionary, such as a filesystem directory or S3 bucket.

Source And Target

The store from which (source) and to which (target) we want to synchronize. The source and target are projected into dictionaries to perform the diff. The projection may allow for a glob to be applied to filter the values to be included in the diff. When passed as a parameter to the diff function, the source or target may be a promise or function returning a dictionary.

Glob

A Bash-style glob pattern or array of glob patterns. Typically defaults to **.

Root

The path relative to which globs are resolved.

Patch

An object whose properties specify an action, a key, and, if necessary, a value. The action may be add, update, or delete. The value property is required for add and update actions, but not for delete. Typically, the value is encoded as a byte array to ensure compatibility between presets such as FS (filesystem) and S3.

Patch Function or Handler

A function that applies a patch to a source, like the filesystem or S3.

diff

diff source, target

Given source and target dictionaries, returns an iterator that produces patches.

diff source, target, patch

diff { source, target, patch }

Given source and target dictionaries and a patch function, iterates through the patches and invokes the patch function.

FS

glob { glob, root }

Returns a dictionary corresponding to the given glob in the directory given by root applied to the filesystem.

patch

Returns a function that applies a patch to the filesystem.

S3

glob { domain, glob }

Returns a dictionary corresponding to the given glob applied to the S3 bucket for the given domain.

  • domain: a domain name corresponding to an S3 bucket.

patch { domain }

Returns a function that applies a patch to an S3 bucket for the given domain..

Graphene

glob { collection, glob }

Returns a dictionary corresponding to the given glob applied to the given collection.

patch { collection }

Returns a function that applies a patch to the given collection.