From e881f5264a07f01d3b67d49902986e7a5280dcc8 Mon Sep 17 00:00:00 2001 From: AlttiRi <16310547+AlttiRi@users.noreply.github.com> Date: Wed, 21 Aug 2024 17:05:45 +0300 Subject: [PATCH] Add `*.d.ts` to README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d9ae420..4fd8d40 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,39 @@ The optimisation for `"ascii85"` by replacing `"\0\0\0\0"` by `"z"` instead of ` Anyway nobody forbids you to do something like `base85.replaceAll("!!!!!", "z")` as well as to add `"<~"`, `"~>"` manually if you need it. +--- + +# *.d.ts + +```ts +/** 85 unique characters string */ +type CharSet = string; +/** + * Returns Base85 string. + * @param {Uint8Array} ui8a - input data to encode + * @param {"ascii85" | "z85" | string} [charset="z85"] - 85 unique characters string + * @return {string} + * */ +export declare function encode(ui8a: Uint8Array, charset?: "ascii85" | "z85" | CharSet): string; +/** + * Decodes Base85 string. + * @param {string} base85 - base85 encoded string + * @param {"ascii85" | "z85" | string} [charset="z85"] - 85 unique characters string + * @return {Uint8Array} + * */ +export declare function decode(base85: string, charset?: "ascii85" | "z85" | CharSet): Uint8Array; +/** Alias to `encode`. */ +export declare const encodeBase85: typeof encode; +/** Alias to `decode`. */ +export declare const decodeBase85: typeof decode; +declare const base85: { + encode: typeof encode; + decode: typeof decode; + encodeBase85: typeof encode; + decodeBase85: typeof decode; +}; +export default base85; +``` --- diff --git a/package.json b/package.json index 6745fd6..866c709 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@alttiri/base85", - "version": "1.7.5", + "version": "1.7.6", "description": "Pretty fast base85 JavaScript library", "homepage": "https://github.com/alttiri/base85", "keywords": [