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

rangey

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rangey

A micro NPM module for a shorthand range function (like Python).

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

rangey

Python 3.x range for ES6

NPM version Build Status js-standard-style

Installation | Usage | Example | License

Installation

With npm:

npm install rangey --save

Note: You need an engine that supports ES6 (e.g. Babel or Node 4.0+).

Usage

rangey.range([start, ]stop[, step])

Starts a loop on start, incrementing by step until reaching stop.

This is a generator function that yields values one by one (and does not take up memory for an array)

Defaults:

  • start = 0
  • step = 1

rangey.listOf(generator)

Appends all values from generator into an array.

Example

'use strict'

import { range, listOf } from 'rangey'

for (let i of range(4)) {
  // 0, 1, 2, 3
}

listOf(range(1, 5, 0.5)) // 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5

License

MIT

Keywords

FAQs

Package last updated on 16 Dec 2016

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