get-unique-random-array
Get a unique random array from an array
Install
$ npm install get-unique-random-array
Usage / API
import getUniqueRandomArray from "get-unique-random-array";
// const getUniqueRandomArray = require("get-unique-random-array").default; // node,commonJS
const targetArray = [
{ id: 1, status: false },
{ id: 2, status: true },
{ id: 3, status: false },
{ id: 4, status: true },
{ id: 5, status: false }
];
const size = 2;
console.log(getUniqueRandomArray(targetArray, { size })); // => [ { id: 4, status: true }, { id: 3, status: false } ]
License
MIT