oberknecht-emitters
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -59,5 +59,12 @@ "use strict"; | ||
this.getListeners(a).forEach((callback) => { | ||
if (this._options.withAllNames) | ||
let withNames = this._options.withNames; | ||
let withAllNames = this._options.withAllNames; | ||
if (withAllNames && | ||
(withAllNames === true || | ||
((0, oberknecht_utils_1.extendedTypeof)(withAllNames) === "array" && | ||
withAllNames.includes(a)))) | ||
callback([a, ...eventNames.filter((b) => a !== b)], args ?? undefined); | ||
else if (this._options.withNames) | ||
else if (withNames && | ||
(withNames === true || | ||
((0, oberknecht_utils_1.extendedTypeof)(withNames) === "array" && withNames.includes(a)))) | ||
callback(a, args ?? undefined); | ||
@@ -64,0 +71,0 @@ else |
export type oberknechtEmitterOptions = { | ||
withNames?: boolean; | ||
withAllNames?: boolean; | ||
withNames?: boolean | string[]; | ||
withAllNames?: boolean | string[]; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { convertToArray, returnErr } from "oberknecht-utils"; | ||
import { convertToArray, extendedTypeof, returnErr } from "oberknecht-utils"; | ||
import { i } from ".."; | ||
@@ -75,3 +75,11 @@ import { oberknechtEmitterOptions } from "../types/oberknecht.emitter.options"; | ||
this.getListeners(a).forEach((callback: Function) => { | ||
if (this._options.withAllNames) | ||
let withNames = this._options.withNames; | ||
let withAllNames = this._options.withAllNames; | ||
if ( | ||
withAllNames && | ||
(withAllNames === true || | ||
(extendedTypeof(withAllNames) === "array" && | ||
withAllNames.includes(a))) | ||
) | ||
callback( | ||
@@ -81,3 +89,8 @@ [a, ...eventNames.filter((b) => a !== b)], | ||
); | ||
else if (this._options.withNames) callback(a, args ?? undefined); | ||
else if ( | ||
withNames && | ||
(withNames === true || | ||
(extendedTypeof(withNames) === "array" && withNames.includes(a))) | ||
) | ||
callback(a, args ?? undefined); | ||
else callback(args ?? undefined); | ||
@@ -84,0 +97,0 @@ }); |
export type oberknechtEmitterOptions = { | ||
withNames?: boolean; | ||
withAllNames?: boolean; | ||
withNames?: boolean | string[]; | ||
withAllNames?: boolean | string[]; | ||
}; |
{ | ||
"name": "oberknecht-emitters", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "export", |
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
39508
581