<commit_before>import { single, multiple } from './caller';
import key from './key';
import SignalError from './SignalError';

const isValidKey = value => value != null && isString(value) || Number.isFinite(value) || isSymbol(value);

const isFunction = value => typeof value === 'function';

const isString = value => typeof value === 'string';

const isSymbol = value => typeof value === 'symbol';

const isValidKey = value => isString(value) || Number.isFinite(value) || isSymbol(value);


const proto = {
	// disable | enable *************************************
	disable() {
		this.disabled = true;
		return this;
	},

	enable() {
		this.disabled = false;
		return this;
	},

	// on | off ************************************************
	on(name, fn) {
		if (!isValidKey(name)) throw SignalError('on', 'requires event name');
		if (!isFunction(fn)) throw SignalError('on', 'requires callback');

		const location = this[key];
		const fns = location.has(name) ? location.get(name) : location.set(name, new Set()).get(name);
		fns.add(fn);<commit_msg>use null prototype<commit_after>import { single, multiple } from './caller';
import key from './key';
import SignalError from './SignalError';

const isValidKey = value => value != null && isString(value) || Number.isFinite(value) || isSymbol(value);

const proto = Object.assign(Object.create(null), {
	// disable | enable *************************************
	disable() {
		this.disabled = true;
		return this;
	},

	enable() {
		this.disabled = false;
		return this;
	},

	// on | off ************************************************
	on(name, fn) {
		if (!isValidKey(name)) throw SignalError('on', 'requires event name');
		if (!isFunction(fn)) throw SignalError('on', 'requires callback');

		const location = this[key];
		const fns = location.has(name) ? location.get(name) : location.set(name, new Set()).get(name);
		fns.add(fn);
{'fraction_non_alphanumeric': 0.24498416050686378, 'fraction_numerical': 0.0, 'mean_word_length': 4.86687306501548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1247672', 'n_tokens_mistral': 591, 'n_tokens_neox': 551, 'n_words': 152}