basex-encoder
Advanced tools
Comparing version 0.0.3 to 0.0.4
/// <reference types="node" /> | ||
export interface IBaseXEncoder { | ||
encode: (str: string, encoding?: string) => string; | ||
encode: (str: string, encoding?: BufferEncoding) => string; | ||
encodeFromBuffer: (source: Buffer) => string; | ||
decode: (encoded: string, encoding?: string) => string | null; | ||
decode: (encoded: string, encoding?: BufferEncoding) => string | null; | ||
decodeToBuffer: (str: string) => Buffer | null; | ||
} | ||
export declare const encoder: (ALPHABET: string, defaultEncoding?: string) => IBaseXEncoder; | ||
export declare const encoder: (ALPHABET: string, defaultEncoding?: BufferEncoding) => IBaseXEncoder; |
{ | ||
"name": "basex-encoder", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Encode / decode any base X to and from string or buffer", | ||
@@ -44,15 +44,15 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^23.3.1", | ||
"@types/node": "^10.11.4", | ||
"coveralls": "^3.0.2", | ||
"jest": "^23.5.0", | ||
"prettier": "^1.14.2", | ||
"ts-jest": "^23.1.4", | ||
"tscpaths": "^0.0.5", | ||
"tslint": "^5.11.0", | ||
"tslint-config-airbnb": "^5.10.0", | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "^3.0.1" | ||
"@types/jest": "^24.0.15", | ||
"@types/node": "^12.0.12", | ||
"coveralls": "^3.0.4", | ||
"jest": "^24.8.0", | ||
"prettier": "^1.18.2", | ||
"ts-jest": "^24.0.2", | ||
"tscpaths": "^0.0.9", | ||
"tslint": "^5.18.0", | ||
"tslint-config-airbnb": "^5.11.1", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.5.2" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -11,5 +11,5 @@ // tslint:disable no-bitwise | ||
export interface IBaseXEncoder { | ||
encode: (str: string, encoding?: string) => string; | ||
encode: (str: string, encoding?: BufferEncoding) => string; | ||
encodeFromBuffer: (source: Buffer) => string; | ||
decode: (encoded: string, encoding?: string) => string | null; | ||
decode: (encoded: string, encoding?: BufferEncoding) => string | null; | ||
decodeToBuffer: (str: string) => Buffer | null; | ||
@@ -20,3 +20,3 @@ } | ||
ALPHABET: string, | ||
defaultEncoding = 'utf8' | ||
defaultEncoding: BufferEncoding = 'utf8' | ||
): IBaseXEncoder => { | ||
@@ -110,8 +110,10 @@ const ALPHABET_MAP: { [key: string]: number } = {}; | ||
const encode = (str: string, encoding = defaultEncoding): string => | ||
encodeFromBuffer(Buffer.from(str, encoding)); | ||
const encode = ( | ||
str: string, | ||
encoding: BufferEncoding = defaultEncoding | ||
): string => encodeFromBuffer(Buffer.from(str, encoding)); | ||
const decode = ( | ||
encoded: string, | ||
encoding = defaultEncoding | ||
encoding: BufferEncoding = defaultEncoding | ||
): string | null => { | ||
@@ -118,0 +120,0 @@ const buffer = decodeToBuffer(encoded); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27157
789