Merge pull request #24470 from urish/seededshuffle

add types for seededshuffle
This commit is contained in:
Mine Starks
2018-03-23 11:02:25 -07:00
committed by GitHub
4 changed files with 44 additions and 0 deletions
+13
View 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[];
@@ -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
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",
"seededshuffle-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }