Comparing version
@@ -0,1 +1,10 @@ | ||
## [3.1.1](https://github.com/multiformats/js-multibase/compare/v3.1.0...v3.1.1) (2021-01-13) | ||
### Bug Fixes | ||
* update aegir and fix types ([#79](https://github.com/multiformats/js-multibase/issues/79)) ([93ab644](https://github.com/multiformats/js-multibase/commit/93ab644c6b7b239b5c87e86ed1fd5c40c58a2a8b)) | ||
# [3.1.0](https://github.com/multiformats/js-multibase/compare/v3.0.1...v3.1.0) (2020-11-20) | ||
@@ -2,0 +11,0 @@ |
@@ -38,3 +38,3 @@ export = Base; | ||
type BaseCode = "\0" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U"; | ||
type CodecFactory = (input: string) => import("./types").Codec; | ||
type CodecFactory = import("./types").CodecFactory; | ||
//# sourceMappingURL=base.d.ts.map |
@@ -1,6 +0,3 @@ | ||
export type CodecFactory = (input: string) => import("./types.js").Codec; | ||
export type Codec = { | ||
encode: (buffer: Uint8Array) => string; | ||
decode: (hash: string) => Uint8Array; | ||
}; | ||
export type CodecFactory = import("./types.js").CodecFactory; | ||
export type Codec = import("./types.js").Codec; | ||
export type BaseName = "identity" | "base2" | "base8" | "base10" | "base16" | "base16upper" | "base32hex" | "base32hexupper" | "base32hexpad" | "base32hexpadupper" | "base32" | "base32upper" | "base32pad" | "base32padupper" | "base32z" | "base36" | "base36upper" | "base58btc" | "base58flickr" | "base64" | "base64pad" | "base64url" | "base64urlpad"; | ||
@@ -7,0 +4,0 @@ export type BaseCode = "\0" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U"; |
@@ -5,2 +5,3 @@ export = multibase; | ||
/** @typedef {import("./types").BaseCode} BaseCode */ | ||
/** @typedef {import("./types").BaseName} BaseName */ | ||
/** | ||
@@ -16,3 +17,3 @@ * Create a new Uint8Array with the multibase varint+code. | ||
declare namespace multibase { | ||
export { encode, decode, isEncoded, encoding, encodingFromData, names, codes, Base, BaseNameOrCode, BaseCode }; | ||
export { encode, decode, isEncoded, encoding, encodingFromData, names, codes, Base, BaseNameOrCode, BaseCode, BaseName }; | ||
} | ||
@@ -67,2 +68,3 @@ type BaseNameOrCode = "\0" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U" | "identity" | "base2" | "base8" | "base10" | "base16" | "base16upper" | "base32hex" | "base32hexupper" | "base32hexpad" | "base32hexpadupper" | "base32" | "base32upper" | "base32pad" | "base32padupper" | "base32z" | "base36" | "base36upper" | "base58btc" | "base58flickr" | "base64" | "base64pad" | "base64url" | "base64urlpad"; | ||
type BaseCode = "\0" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U"; | ||
type BaseName = "identity" | "base2" | "base8" | "base10" | "base16" | "base16upper" | "base32hex" | "base32hexupper" | "base32hexpad" | "base32hexpadupper" | "base32" | "base32upper" | "base32pad" | "base32padupper" | "base32z" | "base36" | "base36upper" | "base58btc" | "base58flickr" | "base64" | "base64pad" | "base64url" | "base64urlpad"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export type CodecFactory = (input: string) => import("./types").Codec; | ||
export type CodecFactory = import("./types").CodecFactory; | ||
/** | ||
@@ -3,0 +3,0 @@ * RFC4648 Factory |
@@ -10,7 +10,9 @@ /** | ||
export declare type BaseNameOrCode = BaseCode | BaseName; | ||
export declare type Codec = { | ||
export interface Codec { | ||
encode: (buffer: Uint8Array) => string; | ||
decode: (hash: string) => Uint8Array; | ||
}; | ||
export declare type CodecFactory = (input: string) => Codec; | ||
} | ||
export interface CodecFactory { | ||
(input: string): Codec; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "multibase", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "JavaScript implementation of the multibase specification", | ||
@@ -24,2 +24,3 @@ "keywords": [ | ||
"scripts": { | ||
"prepare": "aegir build --no-bundle", | ||
"lint": "aegir lint", | ||
@@ -29,3 +30,2 @@ "test": "aegir test", | ||
"test:browser": "aegir test -t browser", | ||
"build": "aegir build", | ||
"docs": "aegir docs", | ||
@@ -40,6 +40,6 @@ "release": "aegir release --docs", | ||
"@multiformats/base-x": "^4.0.1", | ||
"web-encoding": "^1.0.4" | ||
"web-encoding": "^1.0.6" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^29.0.1", | ||
"aegir": "^30.3.0", | ||
"benchmark": "^2.1.4" | ||
@@ -46,0 +46,0 @@ }, |
js-multibase <!-- omit in toc --> | ||
============ | ||
[](https://protocol.ai) | ||
[](https://github.com/multiformats/multiformats) | ||
[](https://webchat.freenode.net/?channels=%23ipfs) | ||
[](https://protocol.ai) | ||
[](https://github.com/multiformats/multiformats) | ||
[](https://webchat.freenode.net/?channels=%23ipfs) | ||
[](https://codecov.io/gh/multiformats/js-multibase) | ||
@@ -8,0 +8,0 @@ [](https://github.com/multiformats/js-multibase/actions?query=branch%3Amaster+workflow%3Aci+) |
@@ -13,2 +13,3 @@ /** | ||
/** @typedef {import("./types").BaseCode} BaseCode */ | ||
/** @typedef {import("./types").BaseName} BaseName */ | ||
@@ -117,6 +118,6 @@ /** | ||
function encoding (nameOrCode) { | ||
if (constants.names[nameOrCode]) { | ||
return constants.names[nameOrCode] | ||
} else if (constants.codes[nameOrCode]) { | ||
return constants.codes[nameOrCode] | ||
if (constants.names[/** @type {BaseName} */(nameOrCode)]) { | ||
return constants.names[/** @type {BaseName} */(nameOrCode)] | ||
} else if (constants.codes[/** @type {BaseCode} */(nameOrCode)]) { | ||
return constants.codes[/** @type {BaseCode} */(nameOrCode)] | ||
} else { | ||
@@ -123,0 +124,0 @@ throw new Error(`Unsupported encoding: ${nameOrCode}`) |
@@ -13,2 +13,3 @@ 'use strict' | ||
// Build the character lookup table: | ||
/** @type {Record<string, number>} */ | ||
const codes = {} | ||
@@ -15,0 +16,0 @@ for (let i = 0; i < alphabet.length; ++i) { |
@@ -27,3 +27,3 @@ /** | ||
| 'u' | ||
| 'U'; | ||
| 'U' | ||
@@ -56,9 +56,9 @@ /** | ||
| 'base64url' | ||
| 'base64urlpad'; | ||
| 'base64urlpad' | ||
export type BaseNameOrCode = BaseCode | BaseName; | ||
export type Codec = { | ||
encode: (buffer: Uint8Array) => string; | ||
decode: (hash: string) => Uint8Array; | ||
}; | ||
export type CodecFactory = (input: string) => Codec; | ||
export type BaseNameOrCode = BaseCode | BaseName | ||
export interface Codec { | ||
encode: (buffer: Uint8Array) => string | ||
decode: (hash: string) => Uint8Array | ||
} | ||
export interface CodecFactory { (input: string): Codec } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
595
0.68%33093
-15.28%22
-4.35%Updated