diff --git a/types/shasum/index.d.ts b/types/shasum/index.d.ts new file mode 100644 index 0000000000..500c811d07 --- /dev/null +++ b/types/shasum/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for shasum 1.0 +// Project: https://github.com/dominictarr/shasum +// Definitions by: 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; diff --git a/types/shasum/shasum-tests.ts b/types/shasum/shasum-tests.ts new file mode 100644 index 0000000000..01c0ba32fc --- /dev/null +++ b/types/shasum/shasum-tests.ts @@ -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; +} diff --git a/types/shasum/tsconfig.json b/types/shasum/tsconfig.json new file mode 100644 index 0000000000..a0be2a9c4b --- /dev/null +++ b/types/shasum/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/shasum/tslint.json b/types/shasum/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shasum/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }