get-unique-random-array

1.0.10 • Public • Published

get-unique-random-array Build Status npm

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

Package Sidebar

Install

npm i get-unique-random-array

Weekly Downloads

1

Version

1.0.10

License

MIT

Unpacked Size

7.64 kB

Total Files

12

Last publish

Collaborators

  • marinda