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

@dashkite/bake

v0.0.6

Published

Universal JavaScript Encoding Transformations Toolkit

Downloads

29

Readme

bake

Universal JavaScript Encoding Transformations Toolkit

"bake" (pronounced "bah-keh") is the romaji representation of a Japanese word meaning "change" or "tranform". This name is also a playful reference to mojibake, describing character encoding failures that result in unintended transformations.

Installation

npm i @dashkite/bake

Usage

bake is designed around standard JavaScript interfaces, so you can use it freely in the browser or Node.js environments. And while DashKite writes with CoffeeScript, and that's what you'll see in examples, bake is published as transpiled JavaScript.

import { convert } from "@dashkite/bake"

string = "I choose to see the beauty."

message = convert from: "utf8", to: "base64", string

# mesage is as follows
# SSBjaG9vc2UgdG8gc2VlIHRoZSBiZWF1dHku

API

convert

convert (specification, data) -> transformedData

convert accepts a specification and some data to work with. It will read the from and to properties of the specification and output transformedData for you, if it knows how.

The specification is an obect with the properties:

  • from: The starting format of data
  • to: The desired format of transformedData

Available Formats

  • base16 / hex
  • base36
  • base64
  • base64url / safe-base64
  • bytes
  • json
  • utf8
  • uri

Format Notes

  • base64url / safe-base64 is based on RFC 4648's "base64url" mapping.
  • base36 is less common than base64 and base16, but it's a useful format. Like base64, this format has the advantage of compact expression, but base36 is always URL-safe and uses only lower-case, making it attractive for identifiers.
  • bytes refers to an instance of Uint8Array
  • json refers to JSON string encoding as applied to UTF8 strings. Do not use this to generally stringify data structures.
  • uri refers to encodeURI as appied to UTF8 strings.