Merge pull request #30842 from BendingBender/create-hash

Add types for create-hash
This commit is contained in:
Andrew Casey
2018-12-04 18:44:11 -08:00
committed by GitHub
4 changed files with 59 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import createHash = require('create-hash');
const hash = createHash('sha224');
hash.update('synchronous write');
hash.digest();
hash.write('write to it as a stream');
hash.end();
hash.read();
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for create-hash 1.2
// Project: https://github.com/crypto-browserify/createHash
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import { Hash } from 'crypto';
export = createHash;
declare function createHash(algo: createHash.Algorithm): Hash;
declare namespace createHash {
type Algorithm =
| 'md5'
| 'rmd160'
| 'ripemd160'
| 'sha'
| 'sha1'
| 'sha224'
| 'sha256'
| 'sha384'
| 'sha512';
}
+23
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",
"create-hash-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }