https://github.com/afeiship/next-sample
Get an/some element from array like target.
https://github.com/afeiship/next-sample
next rand random sample
Last synced: 7 months ago
JSON representation
Get an/some element from array like target.
- Host: GitHub
- URL: https://github.com/afeiship/next-sample
- Owner: afeiship
- License: mit
- Created: 2020-02-29T10:55:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T03:14:09.000Z (9 months ago)
- Last Synced: 2024-11-19T19:49:52.468Z (8 months ago)
- Topics: next, rand, random, sample
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-sample
> Get an/some element from array like target.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```bash
npm install -S @jswork/next-sample
```## usage
```js
import '@jswork/next-sample';const arr = [1,2,3,4,5,6,7];
nx.sample(arr); // 2
nx.sample(arr); // 5nx.sample(arr, 1); // [5]
nx.sample(arr, 2); // [1, 2]
nx.sample(arr, 2); // [3, 6]
nx.sample(arr, 2); // [5, 6]
```## license
Code released under [the MIT license](https://github.com/afeiship/next-sample/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/next-sample
[version-url]: https://npmjs.org/package/@jswork/next-sample[license-image]: https://img.shields.io/npm/l/@jswork/next-sample
[license-url]: https://github.com/afeiship/next-sample/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-sample
[size-url]: https://github.com/afeiship/next-sample/blob/master/dist/next-sample.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/next-sample
[download-url]: https://www.npmjs.com/package/@jswork/next-sample