Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Maizify/vConsole into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Maizify committed Apr 29, 2016
2 parents a22bf58 + e5524a2 commit aed2a87
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [
"es2015",
"stage-3"
],
"plugins": ["add-module-exports"]
}
2 changes: 1 addition & 1 deletion dist/vconsole.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
},
"dependencies": {},
"devDependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.1.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-3": "^6.5.0",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"html-loader": "^0.4.3",
Expand Down
13 changes: 11 additions & 2 deletions src/vconsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ vConsole.prototype._printLog = function(tabName, logType, logs) {
} else if (typeof logs[i] == 'object') {
line += ' ' + JSON.stringify(logs[i]);
} else {
line += ' ' + logs[i];
line += ' ' + htmlEncode(logs[i]);
}
} catch (e) {
line += ' [' + (typeof logs[i]) + ']';
Expand Down Expand Up @@ -404,7 +404,16 @@ function getDate(time) {
};
}

/**
* HTML encode a string
* @param string text
* @return string
*/
function htmlEncode(text) {
return document.createElement('a').appendChild( document.createTextNode(text) ).parentNode.innerHTML;
};

/**
* export
*/
export default (new vConsole());
export default new vConsole();
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
warnings: false
}
})
,new webpack.BannerPlugin([
,new webpack.BannerPlugin([
pkg.name + ' v' + pkg.version + ' (' + pkg.homepage + ')',
'Copyright ' + new Date().getFullYear() + ', ' + pkg.author,
pkg.license +' license'
Expand Down

0 comments on commit aed2a87

Please sign in to comment.