mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
Add url-safe-base64 npm module declarations (#25418)
* feat(types): add url-safe-base64 npm module declarations * chore: fix name and URL
This commit is contained in:
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for url-safe-base64 1.1
|
||||
// Project: https://github.com/commenthol/url-safe-base64#readme
|
||||
// Definitions by: John Wright <https://github.com/johngeorgewright>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function decode(safe: string): string;
|
||||
|
||||
export function encode(base64: string): string;
|
||||
|
||||
export function isBase64(string: string): string;
|
||||
|
||||
export function isUrlSafeBase64(string: string): string;
|
||||
|
||||
export function trim(string: string): string;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"url-safe-base64-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,16 @@
|
||||
import { decode, encode, isBase64, isUrlSafeBase64, trim } from 'url-safe-base64';
|
||||
|
||||
const safe = encode('A/B+C==');
|
||||
// > 'A-B_C..'
|
||||
trim(safe);
|
||||
// > 'A-B_C'
|
||||
const base64 = decode(safe);
|
||||
// > 'A/B+C=='
|
||||
isBase64(base64);
|
||||
// > true
|
||||
isBase64(safe);
|
||||
// > false
|
||||
isUrlSafeBase64(base64);
|
||||
// > false
|
||||
isUrlSafeBase64(safe);
|
||||
// > true
|
||||
Reference in New Issue
Block a user