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

es-get-iterator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-get-iterator

Get an iterator for any JS language value. Works robustly across all environments, all versions.

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13M
decreased by-0.13%
Maintainers
1
Weekly downloads
 
Created

What is es-get-iterator?

The es-get-iterator package is a utility for retrieving an iterator from a given object, array, string, or other iterable types in JavaScript. It abstracts away the differences between various iterable protocols and provides a unified way to iterate over values in different types of collections.

What are es-get-iterator's main functionalities?

Getting an iterator from an array

This feature demonstrates how to retrieve an iterator from an array and use it to access the first element.

const getIterator = require('es-get-iterator');
const array = [1, 2, 3];
const iterator = getIterator(array);
console.log(iterator.next().value); // 1

Getting an iterator from a string

This feature shows how to get an iterator from a string to iterate over its characters.

const getIterator = require('es-get-iterator');
const string = 'hello';
const iterator = getIterator(string);
console.log(iterator.next().value); // 'h'

Getting an iterator from a Map

This example demonstrates retrieving an iterator from a Map object to iterate over its key-value pairs.

const getIterator = require('es-get-iterator');
const map = new Map([[1, 'one'], [2, 'two']]);
const iterator = getIterator(map);
console.log(iterator.next().value); // [1, 'one']

Other packages similar to es-get-iterator

Keywords

FAQs

Package last updated on 13 Jan 2023

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