Skip to content

Commit

Permalink
fix(update): add eslintrc and format the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Jul 16, 2017
1 parent f3f75a8 commit c7162ce
Show file tree
Hide file tree
Showing 9 changed files with 5,369 additions and 23 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": "standard",
"rules": {
"computed-property-spacing": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"arrow-parens": ["error", "always"],
"max-params": "error",
"max-nested-callbacks": [
"error",
{
"max": 5
}
],
"max-depth": [
"error",
{
"max": 5
}
],
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
]
}
}
13 changes: 9 additions & 4 deletions dist/dush.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ function dush () {
off: function off (name, handler) {
if (handler && app._allEvents[name]) {
var fnStr = handler.toString();
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.__sourceString !== fnStr; });
app._allEvents[name] = app._allEvents[name].filter(
function (func) { return func.__sourceString !== fnStr; }
);
} else if (name) {
app._allEvents[name] = [];
} else {
Expand Down Expand Up @@ -269,9 +271,12 @@ function dush () {

emit: function emit (name) {
if (name !== '*') {
var args = [].slice.call(arguments);
(app._allEvents[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(app._allEvents['*'] || []).map(function (handler) { handler.apply(handler, args); });
var args = [].slice.call(arguments);(app._allEvents[name] || []).map(function (handler) {
handler.apply(handler, args.slice(1));
})
;(app._allEvents['*'] || []).map(function (handler) {
handler.apply(handler, args);
});
}

return app
Expand Down
13 changes: 9 additions & 4 deletions dist/dush.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ function dush () {
off: function off (name, handler) {
if (handler && app._allEvents[name]) {
var fnStr = handler.toString();
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.__sourceString !== fnStr; });
app._allEvents[name] = app._allEvents[name].filter(
function (func) { return func.__sourceString !== fnStr; }
);
} else if (name) {
app._allEvents[name] = [];
} else {
Expand Down Expand Up @@ -267,9 +269,12 @@ function dush () {

emit: function emit (name) {
if (name !== '*') {
var args = [].slice.call(arguments);
(app._allEvents[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(app._allEvents['*'] || []).map(function (handler) { handler.apply(handler, args); });
var args = [].slice.call(arguments);(app._allEvents[name] || []).map(function (handler) {
handler.apply(handler, args.slice(1));
})
;(app._allEvents['*'] || []).map(function (handler) {
handler.apply(handler, args);
});
}

return app
Expand Down
2 changes: 1 addition & 1 deletion dist/dush.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/dush.umd.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/dush.umd.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit c7162ce

Please sign in to comment.