Added react-native-uuid (#34117)

* Added definitions for react-native-uuid

Added definitions for react-native-uuid class.

* Added Changes

* Added Suggested Changes
This commit is contained in:
Haseeb Majid
2019-03-26 17:21:15 +01:00
committed by timolinn
parent 66d20973f3
commit d6692403c7
4 changed files with 72 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for react-native-uuid 1.4
// Project: https://github.com/eugenehp/react-native-uuid
// Definitions by: hmajid2301 <https://github.com/hmajid2301>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
interface v1 {
node: number[];
clockseq: number;
msecs: number | Date;
nsecs: number;
}
interface v4 {
random?: number[];
rng?: (...args: any) => void;
}
interface uuid {
v1: (options?: v1, buffer?: ArrayBuffer, offset?: number) => string;
v4: (options?: v4, buffer?: ArrayBuffer, offset?: number) => string;
parse: (id: string, buffer?: ArrayBuffer, offset?: number) => ArrayBuffer;
unparse: (buffer?: ArrayBuffer, offset?: number) => string;
noConflict: () => string;
}
declare const uuid: uuid;
export = uuid;
@@ -0,0 +1,19 @@
import uuid from 'react-native-uuid';
uuid.v1({
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
nsecs: 5678
});
uuid.v4({
random: [
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
]
});
const bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10');
const string = uuid.unparse(bytes);
const myUuid = uuid.noConflict();
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-native-uuid-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }