modify-event
Advanced tools
Comparing version 1.0.0 to 1.0.1
10
index.js
@@ -7,6 +7,8 @@ /*! | ||
var util = require('util'); | ||
module.exports = function modifyEvent(eventEmitter, targetEventName, fn) { | ||
if (!eventEmitter || typeof eventEmitter.emit !== 'function') { | ||
throw new TypeError( | ||
eventEmitter + | ||
util.inspect(eventEmitter) + | ||
' doesn\'t have "emit" method.' + | ||
@@ -20,3 +22,3 @@ ' The first argument to modify-event must be an instance of EventEmitter' + | ||
throw new TypeError( | ||
targetEventName + | ||
util.inspect(targetEventName) + | ||
' is not a string. The second argument to modify-event must be an event name.' | ||
@@ -28,3 +30,3 @@ ); | ||
throw new TypeError( | ||
fn + | ||
util.inspect(fn) + | ||
' is not a function. The third argument to modify-event must be a function.' | ||
@@ -36,3 +38,3 @@ ); | ||
eventEmitter.emit = function(eventName, val) { | ||
eventEmitter.emit = function modifiedEmit(eventName, val) { | ||
if (eventName === targetEventName) { | ||
@@ -39,0 +41,0 @@ val = fn(val); |
{ | ||
"name": "modify-event", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Modify the value of the specific object's event", | ||
"repository": "shinnn/modify-event", | ||
"author": "Shinnosuke Watanabe <snnskwtnb@gmail.com> (https://github.com/shinnn)", | ||
"scripts": { | ||
"pretest": "eslint --config node_modules/@shinnn/eslintrc-node/rc.json index.js test.js", | ||
"test": "node test.js | tap-spec", | ||
"coverage": "istanbul cover test.js", | ||
"coveralls": "${npm_package_scripts_coverage} && istanbul-coveralls" | ||
"pretest": "eslint --fix --config @shinnn/node-legacy index.js test.js", | ||
"test": "node --strong_mode --throw-deprecation --track-heap-objects test.js | tap-spec", | ||
"coverage": "node --strong_mode --throw-deprecation --track-heap-objects node_modules/.bin/istanbul cover test.js" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/shinnn/modify-event/blob/master/LICENSE" | ||
} | ||
], | ||
"license": "MIT", | ||
"files": [ | ||
@@ -28,12 +23,13 @@ "index.js" | ||
"change", | ||
"filter", | ||
"filtering", | ||
"update" | ||
], | ||
"devDependencies": { | ||
"@shinnn/eslintrc-node": "^1.0.1", | ||
"eslint": "^0.20.0", | ||
"istanbul": "^0.3.13", | ||
"istanbul-coveralls": "^1.0.2", | ||
"tap-spec": "^3.0.0", | ||
"tape": "^4.0.0" | ||
"@shinnn/eslint-config-node-legacy": "^2.0.0", | ||
"eslint": "^2.9.0", | ||
"istanbul": "^0.4.3", | ||
"tap-spec": "^4.1.1", | ||
"tape": "^4.5.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
5
36
1
3173
3
2
0