Add typings for uuid-parse

This commit is contained in:
Christian Rackerseder
2018-05-17 08:57:07 +02:00
parent 131650c616
commit 834abc73d8
4 changed files with 58 additions and 0 deletions

25
types/uuid-parse/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
// Type definitions for uuid-parse 1.0
// Project: https://github.com/zefferus/uuid-parse
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import 'node';
/**
* Parse a UUID into it's component bytes
* @param id UUID (-like) string
* @param buffer Array or buffer where UUID bytes are to be written. Default: A new Buffer is used
* @param offset Starting index in buffer at which to begin writing. Default: 0
*/
export function parse(
id: string,
buffer?: Buffer | any[],
offset?: number,
): Buffer;
/**
* Convert UUID byte array (ala parse()) into a string
* @param buffer Array or buffer where UUID bytes are read.
* @param offset Starting index in buffer at which to begin reading. Default: 0
*/
export function unparse(buffer: Buffer, offset?: number): string;

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",
"uuid-parse-tests.ts"
]
}

View File

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

View File

@@ -0,0 +1,9 @@
import * as uuidParse from 'uuid-parse';
uuidParse.parse('797ff043-11eb-11e1-80d6-510998755d10');
uuidParse.parse('797ff043-11eb-11e1-80d6-510998755d10', []);
uuidParse.parse('797ff043-11eb-11e1-80d6-510998755d10', new Buffer(''));
uuidParse.parse('797ff043-11eb-11e1-80d6-510998755d10', new Buffer(''), 123);
uuidParse.unparse(new Buffer(''));
uuidParse.unparse(new Buffer(''), 123);