mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-22 12:33:38 +08:00
add types for seededshuffle
This commit is contained in:
13
types/seededshuffle/index.d.ts
vendored
Normal file
13
types/seededshuffle/index.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Type definitions for seededshuffle 0.2
|
||||
// Project: https://github.com/LouisT/SeededShuffle
|
||||
// Definitions by: Uri Shaked <https://github.com/urish>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const seed: number;
|
||||
export const strSeed: string;
|
||||
|
||||
export function shuffle<T>(arr: T[], seed: string|number): T[];
|
||||
export function shuffle<T>(arr: ReadonlyArray<T>, seed: string|number, copy: true): T[];
|
||||
|
||||
export function unshuffle<T>(arr: T[], seed: string|number): T[];
|
||||
export function unshuffle<T>(arr: ReadonlyArray<T>, seed: string|number, copy: true): T[];
|
||||
7
types/seededshuffle/seededshuffle-tests.ts
Normal file
7
types/seededshuffle/seededshuffle-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { shuffle, unshuffle } from 'seededshuffle';
|
||||
|
||||
const a: number[] = shuffle([1, 2, 3] as ReadonlyArray<number>, 'Example seed', true);
|
||||
const b: number[] = unshuffle(a as ReadonlyArray<number>, 'Example seed', true);
|
||||
|
||||
const c: string[] = shuffle(['a', 'b', 'c'], 'another seed');
|
||||
const d: string[] = unshuffle(c, 'another seed');
|
||||
23
types/seededshuffle/tsconfig.json
Normal file
23
types/seededshuffle/tsconfig.json
Normal 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",
|
||||
"seededshuffle-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/seededshuffle/tslint.json
Normal file
1
types/seededshuffle/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user