Comparing version
// @ts-check | ||
/** | ||
* Base58 characters include numbers 123456789, uppercase ABCDEFGHJKLMNPQRSTUVWXYZ and lowercase abcdefghijkmnopqrstuvwxyz. | ||
* @typedef {String} base58_chars Base58 characters include numbers 123456789, uppercase ABCDEFGHJKLMNPQRSTUVWXYZ and lowercase abcdefghijkmnopqrstuvwxyz. | ||
* A string containing all valid Base58 characters: | ||
* - Digits: 1–9 (excluding 0) | ||
* - Uppercase: A–Z (excluding I and O) | ||
* - Lowercase: a–z (excluding l) | ||
* | ||
* @typedef {string} base58_chars | ||
* @see https://en.wikipedia.org/wiki/Base58 | ||
*/ | ||
/** @type {base58_chars} */ | ||
const base58_chars = | ||
@@ -8,0 +15,0 @@ "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; |
@@ -1,1 +0,2 @@ | ||
export default function base58_to_binary(input: string): Uint8Array; | ||
declare function base58_to_binary(base58String: string): Uint8Array; | ||
export default base58_to_binary; |
@@ -0,1 +1,2 @@ | ||
// @ts-check | ||
import base58_chars from "./base58_chars.js"; | ||
@@ -5,3 +6,3 @@ | ||
* Converts a base58 string to the corresponding binary representation. | ||
* @param { import("./base58_chars.js").base58_chars } base58String base58 encoded string. | ||
* @param {string} base58String base58 encoded string. | ||
* @returns {Uint8Array} Binary representation for the base58 string. | ||
@@ -8,0 +9,0 @@ * @example |
@@ -1,1 +0,2 @@ | ||
export default function binary_to_base58(input: Uint8Array): string; | ||
declare function binary_to_base58(input: Uint8Array): string; | ||
export default binary_to_base58; |
@@ -1,2 +0,2 @@ | ||
export { default as base58_to_binary } from "./base58_to_binary.d.ts"; | ||
export { default as binary_to_base58 } from "./binary_to_base58.d.ts"; | ||
export { default as base58_to_binary } from "./base58_to_binary.js"; | ||
export { default as binary_to_base58 } from "./binary_to_base58.js"; |
{ | ||
"name": "base58-js", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "A light weight universal JavaScript base58 encoder / decoder.", | ||
@@ -26,8 +26,29 @@ "main": "index.js", | ||
"exports": { | ||
".": "./index.js", | ||
".": { | ||
"import": "./index.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"./package.json": "./package.json", | ||
"./binary_to_base58": "./binary_to_base58.js", | ||
"./base58_to_binary": "./base58_to_binary.js", | ||
"./binary_to_base58.js": "./binary_to_base58.js", | ||
"./base58_to_binary.js": "./base58_to_binary.js" | ||
"./binary_to_base58.js": { | ||
"import": "./binary_to_base58.js", | ||
"types": "./binary_to_base58.d.ts" | ||
}, | ||
"./binary_to_base58": { | ||
"import": "./binary_to_base58.js", | ||
"types": "./binary_to_base58.d.ts" | ||
}, | ||
"./base58_to_binary": { | ||
"import": "./base58_to_binary.js", | ||
"types": "./base58_to_binary.d.ts" | ||
}, | ||
"./base58_to_binary.js": { | ||
"import": "./base58_to_binary.js", | ||
"types": "./base58_to_binary.d.ts" | ||
}, | ||
"./base58_chars": { | ||
"import": "./base58_chars.js" | ||
}, | ||
"./create_base58_map": { | ||
"import": "./create_base58_map.js" | ||
} | ||
}, | ||
@@ -34,0 +55,0 @@ "sideEffects": false, |
@@ -7,9 +7,11 @@  | ||
A light weight (\~560 byte) [universal JavaScript](https://en.wikipedia.org/wiki/Isomorphic_JavaScript) base58 encoder and decoder. | ||
A lightweight (~560 bytes) [universal JavaScript](https://en.wikipedia.org/wiki/Isomorphic_JavaScript) Base58 encoder and decoder. | ||
--- | ||
## Installation | ||
For [Node.js](https://nodejs.org), to install [`base58-js`](https://npm.im/base58-js) run: | ||
Install [`base58-js`](https://npm.im/base58-js) via npm: | ||
```sh | ||
```bash | ||
npm install base58-js | ||
@@ -20,3 +22,3 @@ ``` | ||
Supported runtime environments: | ||
Supported environments: | ||
@@ -26,5 +28,5 @@ - [Node.js](https://nodejs.org) versions `^16` || `>=17.0.0` . | ||
## Examples | ||
## Usage Examples | ||
**Convert base58 to binary** | ||
**Convert Base58 to binary** | ||
@@ -61,2 +63,4 @@ ```js | ||
IntelliSense via [TypeScript JSDoc](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html). | ||
## TypeScript Support | ||
This package includes type definitions via [TypeScript JSDoc](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html) for excellent IntelliSense and type checking. |
9312
6.33%122
7.96%63
6.78%