0.0.4 • Published 7 years ago
random-array-element-ts v0.0.4
random-array-element-ts
Select a random element from an array (in a typesafe way using TypeScript).
Install
$ npm install --save random-array-element-ts
Usage
import {randomArrayElement} from 'random-array-element-ts';
const arr1 = [1, 2, 3];
const result: number = randomArrayElement(arr1);
const arr2 = ['one', 'two', 'three'];
const result: string = randomArrayElement(arr2);
License
MIT © Parambir Singh