rfc4648: Provides its own types (#39536)

This commit is contained in:
Alexander T
2019-11-04 12:38:54 -08:00
committed by Nathan Shively-Sanders
parent f6c75152bd
commit 3af37581b0
5 changed files with 6 additions and 102 deletions
+6
View File
@@ -3864,6 +3864,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/rev-hash",
"asOfVersion": "3.0.0"
},
{
"libraryName": "rfc4648",
"typingsPackageName": "rfc4648",
"sourceRepoURL": "https://github.com/swansontec/rfc4648",
"asOfVersion": "1.3.0"
},
{
"libraryName": "rgb-hex",
"typingsPackageName": "rgb-hex",
-63
View File
@@ -1,63 +0,0 @@
// Type definitions for rfc4648 1.2
// Project: https://github.com/swansontec/rfc4648
// Definitions by: Thibault Meunier <https://github.com/thibmeu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
type parseBase = <T = Uint8Array>(
data: string,
options?: {
out?: { new(): T };
loose?: boolean;
},
) => T;
type stringifyBase = (data: object, options?: { pad?: boolean }) => string;
export namespace base64 {
const parse: parseBase;
const stringify: stringifyBase;
}
export namespace base64url {
const parse: parseBase;
const stringify: stringifyBase;
}
export namespace base32 {
const parse: parseBase;
const stringify: stringifyBase;
}
export namespace base32hex {
const parse: parseBase;
const stringify: stringifyBase;
}
export namespace base16 {
const parse: parseBase;
const stringify: stringifyBase;
}
interface Encoding {
bits: number;
chars: string;
}
export namespace codec {
function parse<T = Uint8Array>(
data: string,
encoding: Encoding,
options?: {
out?: { new(): T };
loose?: boolean;
},
): T;
function stringify(
data: object,
encoding: Encoding,
options?: { pad?: boolean }
): string;
}
export {};
-15
View File
@@ -1,15 +0,0 @@
import { base32, base64, codec } from "rfc4648";
base32.stringify([42, 121, 160]);
base32.parse("FJ42A===");
base32.parse("He1l0==", { loose: true });
base64.parse("AOk=", { out: Array });
base64.parse("AOk", { loose: true });
const myEncoding = {
chars: "01234567",
bits: 3
};
codec.stringify([220, 10], myEncoding);
codec.parse("670050", myEncoding, { loose: true });
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"rfc4648-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }