Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pick-some

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pick-some

A utility to pick random elements from an array

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status License: MIT

pick-some

Simple utility to pick, select, choose random items from an array. Items can be chosen uniquely and/or sequentially.

api

pickSome(amount: number, [options: object], arr: array);

options = { unique: boolean, sequential: boolean }

example

const { pickSome } = require('pick-some');

// basic use
pickSome(3, [1,2,3,4,5]) // => [2,5,5]

// unqiue items only
pickSome(3, { unique: true }, [1,2,3,4,5]) // => [3,5,1]

// sequential pick
pickSome(3, { sequential: true }, [1,2,3,4,5]) // => [3,3,4]

// sequential & unique pick
pickSome(3, { unique: true, sequential: true }, [1,2,3,4,5]) // => [2,3,5]

// additional helpers
const { pickSomeUnique, pickSomeSequential } = require('pick-some');
pickSomeUnique(3, [1,2,3,4,5]) // => [3,5,1]
pickSomeSequential(3, [1,2,3,4,5]) // => [3,3,4]

license

MIT

Keywords

FAQs

Package last updated on 01 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc