Skip to content

Commit bb4785a

Browse files
update the function to detect html in personality insights
1 parent 9ed39fd commit bb4785a

File tree

1 file changed

+2
-10
lines changed
  • services/personality_insights

1 file changed

+2
-10
lines changed

services/personality_insights/v2.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,9 @@ var extend = require('extend');
2020
var requestFactory = require('../../lib/requestwrapper');
2121
var pick = require('object.pick');
2222
var omit = require('object.omit');
23+
var herper = require('../../lib/helper');
2324

2425

25-
/**
26-
* Return true if 'text' is html
27-
* @param {String} text The 'text' to analyze
28-
* @return {Boolean} true if 'text' has html tags
29-
*/
30-
function isHTML(text){
31-
return /<[a-z][\s\S]*>/i.test(text);
32-
}
33-
3426
function PersonalityInsights(options) {
3527
// Default URL
3628
var serviceDefaults = {
@@ -62,7 +54,7 @@ PersonalityInsights.prototype.profile = function(params, callback) {
6254
// Content-Type
6355
var content_type = null;
6456
if (params.text)
65-
content_type = isHTML(params.text) ? 'text/html' : 'text/plain';
57+
content_type = herper.isHTML(params.text) ? 'text/html' : 'text/plain';
6658
else
6759
content_type = 'application/json';
6860

0 commit comments

Comments
 (0)