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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cursorsdottsx/z

v2.0.0

Published

What? What's Zed? Ctrl Zed of course. Go Ctrl + Z your objects by employing a Version Control System for your JavaScript objects.

Downloads

3

Readme

| a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z |

Z is for Zed

@cursorsdottsx/z

What? What's Zed? Ctrl Zed of course. Go Ctrl + Z your objects by employing a Version Control System for your JavaScript objects.

Zed is the most advanced object VCS because there are no other fucking objects VCS's on NPM. That's how useless it is!

Nevertheless this package has all you need to dictate your object's state through time.

Easy to install

Zed can be installed with the typical NPM or Yarn:

npm install @cursorsdottsx/z
yarn add @cursorsdottsx/z

Easy to use

const Zed = require("@cursorsdottsx/z").default;
import Zed from "@cursorsdottsx/z";

Yay you actually installed this! Time to use it! Zed is available as a global class:

const object = { foo: "bar" }; // hm a regular object is boring af

const zed = new Zed(object); // ah thats better

console.log(zed.latest.foo); // => "bar"

zed.latest.foo = "baz";

zed.commit("Change to baz");

console.log(zed.latest.foo); // => "baz"

zed.revert();

console.log(zed.latest.foo); // => "bar"

Zed also supports branching and reverting to a snapshot by id!

If you don't want the extra overhead of those things, you can alwayse use Zed.Simple:

const object = { foo: "bar" }; // hm a regular object is boring af

const zed = new Zed.Simple(object); // ah thats better

console.log(zed.latest.foo); // => "bar"

zed.latest.foo = "baz";

zed.commit("Change to baz");

console.log(zed.latest.foo); // => "baz"

zed.revert();

console.log(zed.latest.foo); // => "bar"

It acts the same as Zed without multiple histories, but there are some changes to revert as you will see in the docs.

Don't want to use zed.latest all the time just to change the object? Well you can extend Zed or Zed.Simple!

That's right, Zed will behave differently when extended!

class VersionedObject extends Zed {
    constructor() {
        super(zedOptions);
    }
}

const object = new VersionedObject();

object.property = "foo";

object.commit("I like foos");

object.property = "bar";

object.commit("bars are better");

object.revert();

object.property; // => "foo"

This is also inherently more type safe and goes well with TypeScript!

Some boring ass documentation

new Zed(object, options)

  • object – The object to track.
  • options – Options for Zed.
    • master – Name of the master branch.
    • message – Repo initialization message.

Creates a new Zed instance.

Zed.prototype.latest

The current snapshot (badly named I know).

Zed.prototype.commit(message)

  • message – Optional commit message.

Commits the current Zed object to the timeline.

Zed.prototype.revert(id)

  • id – Optional snapshot id to revert to.

Oh shit you messed up! Reverts the timeline to the last snapshot (or the snapshot with the id provided).

Zed.prototype.branch(name, options)

  • name – Name of the new branch.
  • options – Options for the new branch.
    • m – Overwrite the branch that already exists.
    • b – Checkout the new branch.

Creates a new branch in the timeline.

Zed.prototype.checkout(name)

  • name – Name of the branch.

Switches to another branch.


new Zed.Simple(object, options)

  • object – The object to track.
  • options – Options for Zed.
    • master – Name of the master branch.
    • message – Repo initialization message.

Creates a new Zed instance.

Zed.Simple.prototype.latest

The current snapshot (badly named I know).

Zed.Simple.prototype.commit(message)

  • message – Optional commit message.

Commits the current Zed object to the timeline.

Zed.Simple.prototype.revert(times, force)

  • times – How many times do we wanna roll' back?
  • force – Force rollback to earliest change if needed.

Oh shit you messed up! Reverts the timeline to the last snapshot.

npm abc's homepage