Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename checkType() to checkEventNameType()
  • Loading branch information
Flarna committed Jan 28, 2020
commit 555e6c57e6df5da4f0d0e9ec7da2633f907b66ca
12 changes: 6 additions & 6 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function checkListener(listener) {
}
}

function checkType(type) {
function checkEventNameType(type) {
// Besides string/symbol also numeric types are seen in the wild
switch (typeof type) {
case 'string':
Expand Down Expand Up @@ -363,7 +363,7 @@ function _addListener(target, type, listener, prepend) {
let events;
let existing;

checkType(type);
checkEventNameType(type);
checkListener(listener);

events = target._events;
Expand Down Expand Up @@ -470,7 +470,7 @@ EventEmitter.prototype.removeListener =
function removeListener(type, listener) {
let originalListener;

checkType(type);
checkEventNameType(type);
checkListener(listener);

const events = this._events;
Expand Down Expand Up @@ -526,7 +526,7 @@ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.removeAllListeners =
function removeAllListeners(type) {
if (arguments.length !== 0) {
checkType(type);
checkEventNameType(type);
}

const events = this._events;
Expand Down Expand Up @@ -574,7 +574,7 @@ EventEmitter.prototype.removeAllListeners =
};

function _listeners(target, type, unwrap) {
checkType(type);
checkEventNameType(type);

const events = target._events;

Expand Down Expand Up @@ -610,7 +610,7 @@ EventEmitter.listenerCount = function(emitter, type) {

EventEmitter.prototype.listenerCount = listenerCount;
function listenerCount(type) {
checkType(type);
checkEventNameType(type);

const events = this._events;

Expand Down