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 unescapeJSString(string) { | |
var named = {b: "\b", f: "\f", n: "\n", r: "\r", t: "\t", v: "\v"}; | |
return string.replace(/\\(?:([bfnrtv])|u([0-9a-fA-F]{4})|x([0-9a-fA-F]{2})|([0-3][0-7]{0,2}|[0-7]{1,2})|([^]))/g, function(seq, name, hex4, hex2, oct, char) { | |
var hex; | |
if (name) { // e.g. \n | |
return named[name]; | |
} else if (char) { // e.g. \" | |
return char; | |
} else if (hex = hex4 || hex2) { // e.g. \u0022 or \x22 | |
return String.fromCharCode(parseInt(hex, 16)); |
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
Array.prototype.forSome = function(callback, thisValue) { | |
if (typeof thisValue !== 'object') { | |
thisValue = null; | |
} | |
try { | |
for (var i = 0; i < this.length; i++) { | |
if (this.hasOwnProperty(i)) { | |
var returnValue = callback.call(thisValue, this[i], i, this); | |
if (typeof returnValue !== 'undefined') { | |
return returnValue; |
NewerOlder