Merge pull request #31062 from TeamworkGuy2/master

[shasum] Add shasum@1.0 definition
This commit is contained in:
Andrew Casey
2018-12-07 17:42:53 -08:00
committed by GitHub
4 changed files with 45 additions and 0 deletions

14
types/shasum/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
// Type definitions for shasum 1.0
// Project: https://github.com/dominictarr/shasum
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Single function that return the sha1sum. Installing this is just a little bit quicker than reading the crypto documentation.
* var shasum = require('shasum')
* shasum(string || buffer || object)
* It also works in the browser with browserify.
*/
declare function shasum(str: any, alg?: string | null, format?: "hex" | "latin1" | "base64"): string;
export = shasum;

View File

@@ -0,0 +1,7 @@
import shasum = require("shasum");
function test(): string {
const res1 = shasum("source");
const res2 = shasum({ prop: "source" }, null, "hex");
return res1 || res2;
}

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"shasum-tests.ts"
]
}

1
types/shasum/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }