This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// originally from: http://stackoverflow.com/questions/5796718/html-entity-decode/27385169 | |
function(str) { | |
var element = document.createElement('div'); | |
// regular expression matching HTML entities | |
var entity = /&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig; | |
function decodeHTMLEntities() { | |
// find and replace all the html entities | |
str = str.replace(entity, function(m) { | |
element.innerHTML = m; | |
return element.textContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Util = require('util'); | |
module.exports = function AlpOpenError(message, extra) { | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
Util.inherits(module.exports, Error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {Object|String} data string or keys of object are named in form of snake | |
* @param {number} depth to which level of keys should it process | |
* @return {Object|String} string or keys of object are named in form of camel case | |
*/ | |
exports.snakeToCamel = function(data, depth) { | |
if (Util.isObject(data)) { | |
if (typeof depth === 'undefined') { | |
depth = 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2017-05-31T01:35:50.116Z","extensionVersion":"v2.8.1"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadIamge(imageSrc, name) { | |
var image = new Image() | |
image.setAttribute('crossOrigin', 'anonymous') | |
image.onload = function () { | |
var canvas = document.createElement('canvas') | |
canvas.width = image.width | |
canvas.height = image.height | |
var context = canvas.getContext('2d') | |
context.drawImage(image, 0, 0, image.width, image.height) |
OlderNewer