Skip to content

alkihis/python-enumerate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-enumerate

Enumerate through an Iterable and get the index

Python's build-in function in JS.

Install

npm i python-enumerate

Usage

Takes one iterable, and return a tuple of [index, current_element]. You can specify a base index (it will NOT change the order / beginning of where the iteration starts in iterable).

Default

import enumerate from 'python-enumerate';

const a = [1, 3, 5];

for (const [i, v] of enumerate(a)) {
    console.log(i, v); // => 0 1 then 1 3 then 2 5
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published