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

deltamin

v1.0.3

Published

Minify your Delta format data before sending it down the wire or saving it to a datastore.

Downloads

14

Readme

deltamin

Minify your Delta format data before sending it down the wire or saving it to a datastore.

Build Status codecov.io Code Climate devDependencies Status devDependencies Status contributions welcome HitCount

Note: this project is still very much a "work-in-progress". We need your help to ensure that the keyword list is complete. If you are using the Delta format and want to help with deltamin, check /lib/index.js#L4 and confirm all the keywords are there. If you find a keyword in Delta that isn't in the map, please leave a comment on: deltamin/issues/1

Why

The Delta format https://quilljs.com/docs/delta is quite verbose:

const delta = new Delta([
  { insert: 'Gandalf', attributes: { bold: true } },
  { insert: ' the ' },
  { insert: 'Grey', attributes: { color: '#ccc' } }
]);

delta-full-fat

From the Developer perspective, having a verbose format makes perfect sense because it's easy to understand at a glance what is going on. Given that computers are more than fast enough to process this verbose format, it won't affect the performance of any app using the Delta format.

Where we feel there is scope for improvement is in: a) data transmission i.e. saving bandwidth for people who don't have a lot of it b) saving complete history of changes so that they can be replayed

We can minify this to:

const delta = new Delta([
  { i: 'Gandalf', a: { b: true } },
  { i: ' the ' },
  { i: 'Grey', a: { c: '#ccc' } }
]);

delta-minified

(157 - 117 / 157) = 25% bandwidth saving. It might not feel like much of a saving in this trivial example, but if you scale it up to entire documents and thousands (millions?) of concurrent people using a collaborative editor, a 25% saving on a $10k/month bandwidth bill is $30k/year! Saving bandwidth is the right thing to do for the World! Why should anyone needlessly waste any scarce resource? Obviously this is micro-bandwidth saving is meaningless in a world where Google Stadia is server-rendering and streaming 4K games in realtime ... 🤦
But we can only try to set a good example to follow.

How?

Install the node.js dependency in your project:

npm install deltamin --save

Use it before sending the data to the server:

const deltamin = require('deltamin');
const data = deltamin.minify(delta);
channel.push('update', data);

Note: this example is for sending data via a Phoenix Channel. See: https://github.com/dwyl/phoenix-chat-example

Todo

You can help us finish this module by going through the Delta spec and add all keywords to the map in the lib/index.js file. e.g: insert, retain, text, attributes, etc.

  • [ ] Define short versions for all the keywords e.g: i, r, t, a
    • [x] Make the minified keywords as short as possible (that's the whole point of this project!)
    • [x] wherever there is a keyword that starts with the same character, give priority to the keyword that appears most frequently in the format. e.g: insert is used more often than import so insert > i and import > im
  • [ ] Add more examples to README.md