Skip to content

Commit

Permalink
Added JSDoc to slackEscape method
Browse files Browse the repository at this point in the history
  • Loading branch information
philliphenslee committed Oct 30, 2015
1 parent 30b02a6 commit e227721
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/common.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
'use strict';
var _ = require('lodash');

function slackEscape(data) {
/**
* Escape message text for Slack
* @param {string} text The slack message text
* @returns {string} text The escaped message text
*/
function slackEscape(text) {
var char = [['&', '&amp;'], ['<', '&lt;'], ['>', '&gt;']];
_.each(char, function (i) {
data = data.replace(i[0], i[1]);
text = text.replace(i[0], i[1]);
});
return data;
return text;
}

module.exports = {
Expand Down

0 comments on commit e227721

Please sign in to comment.