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

it-take

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-take - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

34

dist/src/index.d.ts
/**
* @packageDocumentation
*
* For when you only want a few values out of an (async)iterable.
*
* @example
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values = [0, 1, 2, 3, 4]
*
* const arr = all(take(values, 2))
*
* console.info(arr) // 0, 1
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* const values = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
*
* const arr = await all(take(values(), 2))
*
* console.info(arr) // 0, 1
* ```
*/
/**
* Stop iteration after n items have been received

@@ -3,0 +37,0 @@ */

@@ -0,1 +1,35 @@

/**
* @packageDocumentation
*
* For when you only want a few values out of an (async)iterable.
*
* @example
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values = [0, 1, 2, 3, 4]
*
* const arr = all(take(values, 2))
*
* console.info(arr) // 0, 1
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* const values = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
*
* const arr = await all(take(values(), 2))
*
* console.info(arr) // 0, 1
* ```
*/
function isAsyncIterable(thing) {

@@ -2,0 +36,0 @@ return thing[Symbol.asyncIterator] != null;

5

package.json
{
"name": "it-take",
"version": "3.0.3",
"version": "3.0.4",
"description": "Stop iteration after n items have been received",

@@ -32,2 +32,3 @@ "author": "Alex Potsides <alex@achingbrain.net>",

"parserOptions": {
"project": true,
"sourceType": "module"

@@ -135,5 +136,5 @@ }

"devDependencies": {
"aegir": "^40.0.11",
"aegir": "^41.1.9",
"it-all": "^3.0.0"
}
}

46

README.md

@@ -1,3 +0,1 @@

# it-take <!-- omit in toc -->
[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it)

@@ -8,28 +6,8 @@ [![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/it/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/achingbrain/it/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

## Table of contents <!-- omit in toc -->
# About
- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Usage](#usage)
- [License](#license)
- [Contribution](#contribution)
For when you only want a few values out of an (async)iterable.
## Install
## Example
```console
$ npm i it-take
```
### Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `ItTake` in the global namespace.
```html
<script src="https://unpkg.com/it-take/dist/index.min.js"></script>
```
For when you only want a few values out of an iterable.
## Usage
```javascript

@@ -62,4 +40,18 @@ import take from 'it-take'

## License
# Install
```console
$ npm i it-take
```
## Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `ItTake` in the global namespace.
```html
<script src="https://unpkg.com/it-take/dist/index.min.js"></script>
```
# License
Licensed under either of

@@ -70,4 +62,4 @@

## Contribution
# Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

@@ -0,1 +1,36 @@

/**
* @packageDocumentation
*
* For when you only want a few values out of an (async)iterable.
*
* @example
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values = [0, 1, 2, 3, 4]
*
* const arr = all(take(values, 2))
*
* console.info(arr) // 0, 1
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import take from 'it-take'
* import all from 'it-all'
*
* const values = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
*
* const arr = await all(take(values(), 2))
*
* console.info(arr) // 0, 1
* ```
*/
function isAsyncIterable <T> (thing: any): thing is AsyncIterable<T> {

@@ -2,0 +37,0 @@ return thing[Symbol.asyncIterator] != null

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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