Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const assert = require('assert');
const queryString = require('query-string');
const Entities = require('html-entities').AllHtmlEntities;
const pify = require('pify');
const cheerio = require('cheerio');
const striptags = require('striptags');
const forOwn = require('lodash.forown');
const es6Promise = require('es6-promise');
es6Promise.polyfill();
const isoFetch = require('isomorphic-fetch');
let parseString = require('xml2js').parseString;
const entities = new Entities();
const decode = entities.decode;
parseString = pify(parseString);
const flattenArticles = article => {
let flattenObj = {};
forOwn(article, (value, key) => {
// omit guid
if (key === 'guid') {
return;
}
const mergeObj = {};
mergeObj[key] = value[0];
flattenObj = Object.assign(flattenObj, mergeObj);
});
return flattenObj;
CONVERSATION_SUCCESS,
CONVERSATION_ID_REQUEST,
CONVERSATIONS_REQUEST,
CONVERSATIONS_SUCCESS,
MESSAGE_SUCCESS,
MESSAGE_READ,
WEBSOCKET_MESSAGE,
CONVERSATION_ID_SUCCESS,
BELLS_SUCCESS
} from '../common/constants'
import { MessageType, Bell } from '../common/typings'
import { Actions } from 'react-native-router-flux'
const entities = new AllHtmlEntities()
,countUnread = (conversations: any[]) =>
conversations.reduce(
(num, conversation) => num + (conversation.unread !== "0" ? 1 : 0),
0
)
function* fetch() {
try {
// Pull the conversations from the API
const conversations = yield getConversations()
// Decode HTML entities before the content gets into the hands of any other method
for (const conversation of conversations)
conversation.last_message = entities.decode(conversation.last_message)
// ... and publish it on the bus
const cheerio = require('cheerio');
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities();
const TITLE = /^H[123456]$/;
const POINTLESS_P = /<p><br><\/p>/g;
const RAW_IFRAME = /]*>[^<]*<\/iframe>/g;
function getImageOrientation(width, height) {
if (!width || !height)
return 'paysage';
// TODO: What about squares?
// TODO: keep with and height to help with browser rendering
return width >= height ? 'paysage' : 'portrait';
}
function getImageClassName(format, width, height, even) {</p>
const urlUtils = require('lib/urlUtils.js');
const Entities = require('html-entities').AllHtmlEntities;
const htmlentities = new Entities().encode;
// [\s\S] instead of . for multiline matching
// https://stackoverflow.com/a/16119722/561309
const imageRegex = //gi;
const anchorRegex = //gi;
class HtmlUtils {
headAndBodyHtml(doc) {
const output = [];
if (doc.head) output.push(doc.head.innerHTML);
if (doc.body) output.push(doc.body.innerHTML);
return output.join('\n');
}
extractImageUrls(html) {
if (!html) return [];
import * as md5 from 'md5';
import { Component, AfterContentInit } from '@angular/core';
import { RichEditor, INLINE_STYLES, BLOCK_TYPES } from '../../../angular-draft-js/editors/rich';
import * as html from 'html';
import { js_beautify } from 'js-beautify';
import { AllHtmlEntities } from 'html-entities';
const htmlEntities = new AllHtmlEntities();
// In these strings whitespace and linebreaks are important,
// as they will be rendered inside of a <pre>.
const configHead = htmlEntities.encode(`@Component({template: \`
`);
const configFoot = htmlEntities.encode(`\`})
class NgxDraftDemo {
`);
</pre>
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var request = require("request");
var entities = require("html-entities");
var qnaMakerV2ServiceEndpoint = 'https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/';
var qnaMakerServiceEndpoint = null;
var endpointHostName = null;
var qnaApi = 'generateanswer';
var qnaTrainApi = 'train';
var htmlentities = new entities.AllHtmlEntities();
var QnAMakerRecognizer = (function () {
function QnAMakerRecognizer(options) {
this.options = options;
if (this.options.endpointHostName != null) {
var hostName = this.options.endpointHostName.toLowerCase();
if (hostName.indexOf('https://') > -1)
hostName = hostName.split('/')[2];
if (hostName.indexOf("qnamaker") > -1) {
hostName = hostName.split('/')[0];
}
hostName = hostName.replace("/", "");
this.kbUri = 'https://' + hostName + '/qnamaker/knowledgebases/' + this.options.knowledgeBaseId + '/' + qnaApi;
this.authHeader = 'Authorization';
var re = /endpointkey/gi;
if (this.options.authKey.search(re) > -1) {
this.authorizationKey = this.options.authKey.trim();
/**
* Required Dependencies
*/
var AsciiTable = require("ascii-table");
var numeral = require("numeral");
var request = require("request");
var Entities = require("html-entities").AllHtmlEntities;
var version = require("../package.json").version;
/**
* Required Files
*/
var config = require("./config.json");
var logger = require('./logger.js');
var entities = new Entities();
function correctUsage(cmd, usage, msg, bot, delay) {
bot.sendMessage(msg, msg.author.username.replace(/@/g, "@\u200b") + ", the correct usage is *`" + config.command_prefix + cmd + " " + usage + "`*", (erro, wMessage) => {
bot.deleteMessage(wMessage, {
"wait": delay || 10000
});
});
bot.deleteMessage(msg, {
"wait": 10000
});
}
var aliases = {
"h": "help",
"commands": "help",
"join": "invite",
"gametime": "time",
const fs = require('fs')
const Handlebars = require('handlebars')
const Entities = require('html-entities').AllHtmlEntities
const alfy = require('alfy')
const jsonfile = require('jsonfile')
const config = require('../config').card
const {getProfileName} = require('../config')
const ankiInfo = require('../anki/anki-info')
const {Render} = require('../utils/engine')
const {markdownIt} = require('../utils/engine')
const header = require(`${process.env.alfred_workflow_data}/header.json`)
const modelFieldNames = require(`${process.env.alfred_workflow_data}/anki-model-fields.json`)
const entities = new Entities()
const inFile = './src/input/preview/preview.hbs'
const outFile = `${config.mediaDir}_preview.html`
const source = fs.readFileSync(inFile, 'utf8')
const modelId = alfy.config.get('default-model') ? alfy.config.get('default-model')[Object.keys(alfy.config.get('default-model'))[0]] : null
const handleFields = async () => {
const items = []
const subtitle = 'toggle the option: remember last input'
const mods = field => {
return {
ctrl: {
subtitle,
variables: {[field]: field}
},
var Entities = require('html-entities').AllHtmlEntities;
entities = new Entities();
var htmlparser = require('htmlparser2');
var utils = require('./../utils.js');
var strFnObj = require('../serializer');
var log4js = require('log4js');
var logger = log4js.getLogger('[VueServer Compile]');
var noCloseTags = {
input: true,
img: true,
br: true,
hr: true,
meta: true,
link: true
};
function addVariable(variableName, defaultValue, file) {
const entities = new AllHtmlEntities();
defaultValue = entities.encode(defaultValue);
defaultValue = defaultValue.replace('!default;', '');
variables.push({
name: variableName,
defaultValue: defaultValue.trim(),
file: relative('./', file.path)
});
}