Socket
Socket
Sign inDemoInstall

iterable-tool

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    iterable-tool

## Functions


Version published
Maintainers
1
Created

Readme

Source

Iterable-tool

Functions

range

iter

Range

That function like range from python. You can create a slice by function-generation and use all features like for..of construction and ...spread operator.

Example
const {range} = require('iterable-tool');

console.log(...range(5));      // 0  1  2  3  4
console.log(...range(1, 5));   // 1  2  3  4
console.log(...range(1, 10, 2) // 1  3  5  7  9
console.log(...range(10, 1, 3) // 10 7  4

Iter

That function just create iterator by arguments. You can just use method .next() by standart interface Iterable for REST api.

Example
const {iter} = require('iterable-tool');
const app = require('./app');

const phrazes = iter('Hello', 'World');
app.use('/intro', (req, res) => {
	const phrase = phrazes.next();
	if (!phrase) res.sendStatus(500);
	else res.send(phrase);
}

FAQs

Last updated on 24 Jan 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc