# @dashkite/bake

> Universal JavaScript Encoding Transformations Toolkit

Latest version **0.0.6** (published 2021-11-11) · 0 weekly downloads

## Install

```sh
npm install @dashkite/bake
pnpm add @dashkite/bake
yarn add @dashkite/bake
bun add @dashkite/bake
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2021-11-11 |
| First published | 2021-10-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 40.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | dyoder, freeformflow |
| Keywords | encoding, base36, base16, base64, base64url, json, uri, utf8 |

## Links

- npm: https://www.npmjs.com/package/@dashkite/bake
- Repository: https://github.com/dashkite/bake
- Homepage: https://github.com/dashkite/bake#readme
- Issues: https://github.com/dashkite/bake/issues
- npm.io page: https://npm.io/package/@dashkite/bake

## Dependencies (3)

- [@dashkite/joy](https://npm.io/package/@dashkite/joy.md) ^0.3.15
- [@dashkite/utf8](https://npm.io/package/@dashkite/utf8.md) ^1.0.1
- [@dashkite/base64](https://npm.io/package/@dashkite/base64.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.6 (latest) — 2021-11-11
- 0.0.5 — 2021-11-08
- 0.0.4 — 2021-11-08
- 0.0.3 — 2021-10-31
- 0.0.2 — 2021-10-31

## 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.

[mojibake]: https://en.wikipedia.org/wiki/Mojibake


## Installation

```bash
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.

```coffeescript
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"](https://tools.ietf.org/html/rfc4648#section-5) 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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI) as appied to UTF8 strings.

---
_Source: https://npm.io/package/@dashkite/bake · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
