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

@nodeart/event_emitter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodeart/event_emitter - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

index.js

5

package.json
{
"name": "@nodeart/event_emitter",
"version": "1.1.0",
"version": "1.2.0",
"description": "Simple EventEmitter pattern",
"main": "./src/index.js",
"main": "./index.js",
"repository": {

@@ -11,3 +11,2 @@ "type": "git",

"scripts": {
"start": "node ./src/index.js",
"test": "node ./tests.js"

@@ -14,0 +13,0 @@ },

0

README.md

@@ -0,0 +0,0 @@ [![bitHound Overall Score](https://www.bithound.io/github/NodeArt/EventEmitter/badges/score.svg)](https://www.bithound.io/github/NodeArt/EventEmitter)

@@ -7,8 +7,22 @@ /**

const assert = require('assert');
const EventEmitter = require('./src/');
const EventEmitter = require('./');
const events = new EventEmitter();
const [extend, inherit] = [{}, {}];
// extend test
assert.equal(
Object.getPrototypeOf(EventEmitter.extend(extend)),
Object.prototype,
'Prototype should stay the same (Array.prototype)'
);
// inherit test
assert.equal(
Object.getPrototypeOf(EventEmitter.inherit(inherit)),
EventEmitter.prototype,
'Prototype should be EventEmitter prototype'
);
const ctx = { ctx : true };
events

@@ -28,3 +42,3 @@ .once(

assert.equal(Object.keys(events._events['event1']).length, 2, 'Once test error');
assert.equal(events._events.get('event1').length, 2, 'Once test error');

@@ -38,3 +52,3 @@ const fn = (...args) => assert.deepEqual(args, [1, 2, 3], 'Args test error');

assert.equal(events._events['event2'], undefined, 'Off test error');
assert.equal(events._events.get('event2'), undefined, 'Off test error');

@@ -45,2 +59,10 @@ events

assert.deepEqual(events._events, {}, 'OffAll test error');
assert.deepEqual(events._events, new Map(), 'OffAll test error');
let counter = 0;
events
.times('event', 3, () => counter += 1)
.emit('event')
.emit('event')
.emit('event');
assert.equal(counter, 3, 'Times test error');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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