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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
902
46560