diff --git a/lib/string.js b/lib/string.js
index f574ead..bca8476 100644
--- a/lib/string.js
+++ b/lib/string.js
@@ -784,6 +784,25 @@ string = new (function () {
return uuid.join('');
};
+
+ /**
+ @name string#stripTags
+ @public
+ @function
+ @return {String} A String with HTML tags removed.
+ @description Strips HTML tags from a string.
+ @param {String} The string to strip HTML tags from
+ @param {String|Array} A String or Array containing allowed tags. e.g. "
"
+ */
+ this.stripTags = function(string, allowed) {
+ // taken from http://phpjs.org/functions/strip_tags/
+ var allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase ( bar bar
wooby
': function () {
+ var html = '
wooby
wooby';
+ assert.equal(string.stripTags(html, '
'), expected);
+ }
};
module.exports = tests;