Socket
Socket
Sign inDemoInstall

emittery

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emittery - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

12

index.js

@@ -13,4 +13,6 @@ import {anyMap, producersMap, eventsMap} from './maps.js';

const isEventKeyType = key => typeof key === 'string' || typeof key === 'symbol' || typeof key === 'number';
function assertEventName(eventName) {
if (typeof eventName !== 'string' && typeof eventName !== 'symbol' && typeof eventName !== 'number') {
if (!isEventKeyType(eventName)) {
throw new TypeError('`eventName` must be a string, symbol, or number');

@@ -36,3 +38,3 @@ }

function getEventProducers(instance, eventName) {
const key = typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number' ? eventName : anyProducer;
const key = isEventKeyType(eventName) ? eventName : anyProducer;
const producers = producersMap.get(instance);

@@ -437,3 +439,3 @@ if (!producers.has(key)) {

if (typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number') {
if (isEventKeyType(eventName)) {
const set = getListeners(this, eventName);

@@ -477,3 +479,3 @@ if (set) {

for (const eventName of eventNames) {
if (typeof eventName === 'string') {
if (isEventKeyType(eventName)) {
count += anyMap.get(this).size

@@ -487,3 +489,3 @@ + (getListeners(this, eventName)?.size ?? 0)

if (typeof eventName !== 'undefined') {
if (eventName !== undefined) {
assertEventName(eventName);

@@ -490,0 +492,0 @@ }

{
"name": "emittery",
"version": "1.0.1",
"version": "1.0.2",
"description": "Simple and modern async event emitter",

@@ -16,2 +16,3 @@ "license": "MIT",

"types": "./index.d.ts",
"sideEffects": false,
"engines": {

@@ -62,3 +63,3 @@ "node": ">=14.16"

"tsd": "^0.23.0",
"xo": "^0.52.3"
"xo": "^0.55.0"
},

@@ -65,0 +66,0 @@ "nyc": {

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