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

bumpover

v0.6.0

Published

🚧 Controllable toolkit bumping data structure.

Readme

Bumpover helps you writing data validation & migration script in a controllable and reliable way, which can be tedious and leaky with your bare arms.

By utilizing type annotation powered by superstruct, it's super straightforward to define your own complex data types, leaving bumpover deal with your data at runtime. Besides XML and JSON support out of the box, you can even customize bumpover with your own parser, bumping any data format interchangeable with JSON.

Features

  • Declarative XML/JSON data validating and upgrading.
  • Friendly type annotation with recursive data shape support.
  • Promise-based async node upgrading, handy for external or linked data shape. e.g., grab image by link defined in XML node, upload it to your cloud storage, then update new node's src on response ends.
  • Configurable traversing mechanism, e.g., whether returning beforehand or filtering out unknown nodes.
  • Pluggable serializer and deserializer, supporting new data format in merely tens of lines.

Why

Stable data structure is essential for a robust app, while during continual iteration, data structure always changes frequently. One common approach for compatibility is introducing more COMPAT code in business logic, which works but quickly stales codebase, sometimes with incompatible versions of data this is even not possible (Think about .doc and .docx). So here comes the necessity of data migration.

With modern web, it's trivial to ensure latest version of app code deployed on client. While for user data stored in DB, the difficulty upgrading them with script is pretty underestimated. Especially for data serialized and stored as string, parsing and migrating them can be formidable. Writing script transforming '<p>123</p>' to { paragraph: 123 } is one thing, ensuring validity for gigabytes of data is another - And this is what bumpover is designed to handle.

Another scenario utilizing bumpover is sanitizing. Say you're working with a rich content editor whose data model supports nesting, it's essential to ensure valid data structure after each user input event, e.g., pasting and dragging. Generally you'll want to write declarative rules normalizing data, and this is also what bumpover offers.

For cases mentioned above, there are existing runtime data validation tools that helps, while they're not really popularized when compared with compile time type analysis tools, e.g., TypeScript and Flow. Runtime data validation tools generally offers heavier API without much customizability, making them less friendly to work with. As an alternative, superstruct provides precise runtime data validation with a grammar closer to pure type annotations, making it powerful to express complex data types. Since bumpover relies deeply on it, it takes the advantage of superstruct to express your custom types and rules.

Usage

Before getting started, remember to install dependencies:

npm install --save bumpover superstruct

Then you can import them into your code base:

import { Bumpover } from 'bumpover'
import { struct } from 'superstruct'

With superstruct you can define your own data schema. Say you'd like to verify a node in virtual DOM tree with such shape:

const maybeNode = {
  name: 'div',
  props: { background: 'red' },
  children: []
}

We can define a struct validating this structure:

import { struct } from 'superstruct'

const Node = struct({
  name: 'string',
  props: 'object?',
  children: 'array'
})

Now we can use Node struct to validate data. You can simply call it as a function:

Node(maybeNode)

Detailed error will be thrown if data doesn't conform to the Node shape, or return the validated data when validation succeeds.

Now suppose we'd like to transform the virtual DOM data above by replacing all div tags with span tags, keeping all other nodes intact. How do we handle this with reliability? You can manually traverse data, or, simply define rules:

import { Bumpover } from 'bumpover'

const rules = [
  {
    match: node => node.name === 'div',
    update: node => Promise.resolve({
      node: { ...node, name: 'span' }
    })
  }
]

const bumper = new Bumpover(rules)
bumper.bump(data).then(console.log)

// Receive new node data.

Simply providing rules converting nodes, then bumpover will walk and transform data for you. Several points:

  • Rules are the single source of truth implementing your transform logic.
  • Use rule.match to match the node you'd like to transform.
  • Use rule.update to update node inside promise, which allows async updating.
  • Wrap new node inside node field to be resoveld.

Examples

Try out the live demo on JSFiddle to get an idea for how the API works, or to quickly verify your use case. More examples can be found in the walkthrough guide.

See examples for more working examples (WIP).

Documentation

Check out API reference for more details.

Contribution

Issues and pull requests are welcomed! This project is still in its very early age, all kinds of help are precious and appreciated.

License

This package is MIT-licensed.