Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

arrayemitter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrayemitter

EventEmitter emittin array-iteration events.

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

ArrayEmitter.js 0.0.2

[Node.js] EventEmitter emitting array-iteration events

Change Log

  • [0.0.2]: add resume() and options.norun

Overview

Installation

git clone git://github.com/shinout/ArrayEmitter.git

OR

npm install arrayemitter

Usage

with Array

var ArrayEmitter = require('arrayemitter');
var arr = new ArrayEmitter(['hoge', 'fuga', 'piyo']);

arr.on('elem', function(key, value) {
  console.log(key);   // 0,    1,    2
  console.log(value); // hoge, fuga, piyo
});

arr.on('end', function() { // emitted at the end of iteration
  console.log('end');
});

arr.on('error', function(e) { // emitted when an error occurred
  console.log(e);
});

with Object

var ArrayEmitter = require('arrayemitter');
var obj = new ArrayEmitter({a:'hoge', b:'fuga', c:'piyo']);

obj.on('elem', function(key, value) {
  console.log(key);   // a,    b,    c
  console.log(value); // hoge, fuga, piyo
});

obj.on('end', function() { // emitted at the end of Object
  console.log('end');
});

obj.on('error', function(e) { // emitted when an error occurred
  console.log(e);
});

FAQs

Package last updated on 30 Sep 2011

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