diff options
Diffstat (limited to 'node_modules/locutus/php/xml')
-rw-r--r-- | node_modules/locutus/php/xml/index.js | 5 | ||||
-rw-r--r-- | node_modules/locutus/php/xml/index.js.map | 1 | ||||
-rw-r--r-- | node_modules/locutus/php/xml/utf8_decode.js | 62 | ||||
-rw-r--r-- | node_modules/locutus/php/xml/utf8_decode.js.map | 1 | ||||
-rw-r--r-- | node_modules/locutus/php/xml/utf8_encode.js | 70 | ||||
-rw-r--r-- | node_modules/locutus/php/xml/utf8_encode.js.map | 1 |
6 files changed, 140 insertions, 0 deletions
diff --git a/node_modules/locutus/php/xml/index.js b/node_modules/locutus/php/xml/index.js new file mode 100644 index 0000000..8cb435c --- /dev/null +++ b/node_modules/locutus/php/xml/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports['utf8_decode'] = require('./utf8_decode'); +module.exports['utf8_encode'] = require('./utf8_encode'); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/xml/index.js.map b/node_modules/locutus/php/xml/index.js.map new file mode 100644 index 0000000..3e194be --- /dev/null +++ b/node_modules/locutus/php/xml/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/xml/index.js"],"names":["module","exports","require"],"mappings":";;AAAAA,OAAOC,OAAP,CAAe,aAAf,IAAgCC,QAAQ,eAAR,CAAhC;AACAF,OAAOC,OAAP,CAAe,aAAf,IAAgCC,QAAQ,eAAR,CAAhC","file":"index.js","sourcesContent":["module.exports['utf8_decode'] = require('./utf8_decode')\nmodule.exports['utf8_encode'] = require('./utf8_encode')\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/xml/utf8_decode.js b/node_modules/locutus/php/xml/utf8_decode.js new file mode 100644 index 0000000..d27de52 --- /dev/null +++ b/node_modules/locutus/php/xml/utf8_decode.js @@ -0,0 +1,62 @@ +'use strict'; + +module.exports = function utf8_decode(strData) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/utf8_decode/ + // original by: Webtoolkit.info (http://www.webtoolkit.info/) + // input by: Aman Gupta + // input by: Brett Zamir (http://brett-zamir.me) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Norman "zEh" Fuchs + // bugfixed by: hitwork + // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: kirilloid + // bugfixed by: w35l3y (http://www.wesley.eti.br) + // example 1: utf8_decode('Kevin van Zonneveld') + // returns 1: 'Kevin van Zonneveld' + + var tmpArr = []; + var i = 0; + var c1 = 0; + var seqlen = 0; + + strData += ''; + + while (i < strData.length) { + c1 = strData.charCodeAt(i) & 0xFF; + seqlen = 0; + + // http://en.wikipedia.org/wiki/UTF-8#Codepage_layout + if (c1 <= 0xBF) { + c1 = c1 & 0x7F; + seqlen = 1; + } else if (c1 <= 0xDF) { + c1 = c1 & 0x1F; + seqlen = 2; + } else if (c1 <= 0xEF) { + c1 = c1 & 0x0F; + seqlen = 3; + } else { + c1 = c1 & 0x07; + seqlen = 4; + } + + for (var ai = 1; ai < seqlen; ++ai) { + c1 = c1 << 0x06 | strData.charCodeAt(ai + i) & 0x3F; + } + + if (seqlen === 4) { + c1 -= 0x10000; + tmpArr.push(String.fromCharCode(0xD800 | c1 >> 10 & 0x3FF)); + tmpArr.push(String.fromCharCode(0xDC00 | c1 & 0x3FF)); + } else { + tmpArr.push(String.fromCharCode(c1)); + } + + i += seqlen; + } + + return tmpArr.join(''); +}; +//# sourceMappingURL=utf8_decode.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/xml/utf8_decode.js.map b/node_modules/locutus/php/xml/utf8_decode.js.map new file mode 100644 index 0000000..3d963ab --- /dev/null +++ b/node_modules/locutus/php/xml/utf8_decode.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/xml/utf8_decode.js"],"names":["module","exports","utf8_decode","strData","tmpArr","i","c1","seqlen","length","charCodeAt","ai","push","String","fromCharCode","join"],"mappings":";;AAAAA,OAAOC,OAAP,GA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decode.js","sourcesContent":["module.exports = function utf8_decode (strData) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/utf8_decode/\n // original by: Webtoolkit.info (http://www.webtoolkit.info/)\n // input by: Aman Gupta\n // input by: Brett Zamir (http://brett-zamir.me)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Norman \"zEh\" Fuchs\n // bugfixed by: hitwork\n // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: kirilloid\n // bugfixed by: w35l3y (http://www.wesley.eti.br)\n // example 1: utf8_decode('Kevin van Zonneveld')\n // returns 1: 'Kevin van Zonneveld'\n\n var tmpArr = []\n var i = 0\n var c1 = 0\n var seqlen = 0\n\n strData += ''\n\n while (i < strData.length) {\n c1 = strData.charCodeAt(i) & 0xFF\n seqlen = 0\n\n // http://en.wikipedia.org/wiki/UTF-8#Codepage_layout\n if (c1 <= 0xBF) {\n c1 = (c1 & 0x7F)\n seqlen = 1\n } else if (c1 <= 0xDF) {\n c1 = (c1 & 0x1F)\n seqlen = 2\n } else if (c1 <= 0xEF) {\n c1 = (c1 & 0x0F)\n seqlen = 3\n } else {\n c1 = (c1 & 0x07)\n seqlen = 4\n }\n\n for (var ai = 1; ai < seqlen; ++ai) {\n c1 = ((c1 << 0x06) | (strData.charCodeAt(ai + i) & 0x3F))\n }\n\n if (seqlen === 4) {\n c1 -= 0x10000\n tmpArr.push(String.fromCharCode(0xD800 | ((c1 >> 10) & 0x3FF)))\n tmpArr.push(String.fromCharCode(0xDC00 | (c1 & 0x3FF)))\n } else {\n tmpArr.push(String.fromCharCode(c1))\n }\n\n i += seqlen\n }\n\n return tmpArr.join('')\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/xml/utf8_encode.js b/node_modules/locutus/php/xml/utf8_encode.js new file mode 100644 index 0000000..94bb3eb --- /dev/null +++ b/node_modules/locutus/php/xml/utf8_encode.js @@ -0,0 +1,70 @@ +'use strict'; + +module.exports = function utf8_encode(argString) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/utf8_encode/ + // original by: Webtoolkit.info (http://www.webtoolkit.info/) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: sowberry + // improved by: Jack + // improved by: Yves Sucaet + // improved by: kirilloid + // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) + // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) + // bugfixed by: Ulrich + // bugfixed by: Rafał Kukawski (http://blog.kukawski.pl) + // bugfixed by: kirilloid + // example 1: utf8_encode('Kevin van Zonneveld') + // returns 1: 'Kevin van Zonneveld' + + if (argString === null || typeof argString === 'undefined') { + return ''; + } + + // .replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + var string = argString + ''; + var utftext = ''; + var start; + var end; + var stringl = 0; + + start = end = 0; + stringl = string.length; + for (var n = 0; n < stringl; n++) { + var c1 = string.charCodeAt(n); + var enc = null; + + if (c1 < 128) { + end++; + } else if (c1 > 127 && c1 < 2048) { + enc = String.fromCharCode(c1 >> 6 | 192, c1 & 63 | 128); + } else if ((c1 & 0xF800) !== 0xD800) { + enc = String.fromCharCode(c1 >> 12 | 224, c1 >> 6 & 63 | 128, c1 & 63 | 128); + } else { + // surrogate pairs + if ((c1 & 0xFC00) !== 0xD800) { + throw new RangeError('Unmatched trail surrogate at ' + n); + } + var c2 = string.charCodeAt(++n); + if ((c2 & 0xFC00) !== 0xDC00) { + throw new RangeError('Unmatched lead surrogate at ' + (n - 1)); + } + c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000; + enc = String.fromCharCode(c1 >> 18 | 240, c1 >> 12 & 63 | 128, c1 >> 6 & 63 | 128, c1 & 63 | 128); + } + if (enc !== null) { + if (end > start) { + utftext += string.slice(start, end); + } + utftext += enc; + start = end = n + 1; + } + } + + if (end > start) { + utftext += string.slice(start, stringl); + } + + return utftext; +}; +//# sourceMappingURL=utf8_encode.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/xml/utf8_encode.js.map b/node_modules/locutus/php/xml/utf8_encode.js.map new file mode 100644 index 0000000..373c85f --- /dev/null +++ b/node_modules/locutus/php/xml/utf8_encode.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/xml/utf8_encode.js"],"names":["module","exports","utf8_encode","argString","string","utftext","start","end","stringl","length","n","c1","charCodeAt","enc","String","fromCharCode","RangeError","c2","slice"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,SAAtB,EAAiC;AAAE;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIA,cAAc,IAAd,IAAsB,OAAOA,SAAP,KAAqB,WAA/C,EAA4D;AAC1D,WAAO,EAAP;AACD;;AAED;AACA,MAAIC,SAAUD,YAAY,EAA1B;AACA,MAAIE,UAAU,EAAd;AACA,MAAIC,KAAJ;AACA,MAAIC,GAAJ;AACA,MAAIC,UAAU,CAAd;;AAEAF,UAAQC,MAAM,CAAd;AACAC,YAAUJ,OAAOK,MAAjB;AACA,OAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIF,OAApB,EAA6BE,GAA7B,EAAkC;AAChC,QAAIC,KAAKP,OAAOQ,UAAP,CAAkBF,CAAlB,CAAT;AACA,QAAIG,MAAM,IAAV;;AAEA,QAAIF,KAAK,GAAT,EAAc;AACZJ;AACD,KAFD,MAEO,IAAII,KAAK,GAAL,IAAYA,KAAK,IAArB,EAA2B;AAChCE,YAAMC,OAAOC,YAAP,CACHJ,MAAM,CAAP,GAAY,GADR,EACcA,KAAK,EAAN,GAAY,GADzB,CAAN;AAGD,KAJM,MAIA,IAAI,CAACA,KAAK,MAAN,MAAkB,MAAtB,EAA8B;AACnCE,YAAMC,OAAOC,YAAP,CACHJ,MAAM,EAAP,GAAa,GADT,EACgBA,MAAM,CAAP,GAAY,EAAb,GAAmB,GADjC,EACuCA,KAAK,EAAN,GAAY,GADlD,CAAN;AAGD,KAJM,MAIA;AACL;AACA,UAAI,CAACA,KAAK,MAAN,MAAkB,MAAtB,EAA8B;AAC5B,cAAM,IAAIK,UAAJ,CAAe,kCAAkCN,CAAjD,CAAN;AACD;AACD,UAAIO,KAAKb,OAAOQ,UAAP,CAAkB,EAAEF,CAApB,CAAT;AACA,UAAI,CAACO,KAAK,MAAN,MAAkB,MAAtB,EAA8B;AAC5B,cAAM,IAAID,UAAJ,CAAe,kCAAkCN,IAAI,CAAtC,CAAf,CAAN;AACD;AACDC,WAAK,CAAC,CAACA,KAAK,KAAN,KAAgB,EAAjB,KAAwBM,KAAK,KAA7B,IAAsC,OAA3C;AACAJ,YAAMC,OAAOC,YAAP,CACHJ,MAAM,EAAP,GAAa,GADT,EACgBA,MAAM,EAAP,GAAa,EAAd,GAAoB,GADlC,EACyCA,MAAM,CAAP,GAAY,EAAb,GAAmB,GAD1D,EACgEA,KAAK,EAAN,GAAY,GAD3E,CAAN;AAGD;AACD,QAAIE,QAAQ,IAAZ,EAAkB;AAChB,UAAIN,MAAMD,KAAV,EAAiB;AACfD,mBAAWD,OAAOc,KAAP,CAAaZ,KAAb,EAAoBC,GAApB,CAAX;AACD;AACDF,iBAAWQ,GAAX;AACAP,cAAQC,MAAMG,IAAI,CAAlB;AACD;AACF;;AAED,MAAIH,MAAMD,KAAV,EAAiB;AACfD,eAAWD,OAAOc,KAAP,CAAaZ,KAAb,EAAoBE,OAApB,CAAX;AACD;;AAED,SAAOH,OAAP;AACD,CAvED","file":"utf8_encode.js","sourcesContent":["module.exports = function utf8_encode (argString) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/utf8_encode/\n // original by: Webtoolkit.info (http://www.webtoolkit.info/)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: sowberry\n // improved by: Jack\n // improved by: Yves Sucaet\n // improved by: kirilloid\n // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)\n // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)\n // bugfixed by: Ulrich\n // bugfixed by: Rafał Kukawski (http://blog.kukawski.pl)\n // bugfixed by: kirilloid\n // example 1: utf8_encode('Kevin van Zonneveld')\n // returns 1: 'Kevin van Zonneveld'\n\n if (argString === null || typeof argString === 'undefined') {\n return ''\n }\n\n // .replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n var string = (argString + '')\n var utftext = ''\n var start\n var end\n var stringl = 0\n\n start = end = 0\n stringl = string.length\n for (var n = 0; n < stringl; n++) {\n var c1 = string.charCodeAt(n)\n var enc = null\n\n if (c1 < 128) {\n end++\n } else if (c1 > 127 && c1 < 2048) {\n enc = String.fromCharCode(\n (c1 >> 6) | 192, (c1 & 63) | 128\n )\n } else if ((c1 & 0xF800) !== 0xD800) {\n enc = String.fromCharCode(\n (c1 >> 12) | 224, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128\n )\n } else {\n // surrogate pairs\n if ((c1 & 0xFC00) !== 0xD800) {\n throw new RangeError('Unmatched trail surrogate at ' + n)\n }\n var c2 = string.charCodeAt(++n)\n if ((c2 & 0xFC00) !== 0xDC00) {\n throw new RangeError('Unmatched lead surrogate at ' + (n - 1))\n }\n c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000\n enc = String.fromCharCode(\n (c1 >> 18) | 240, ((c1 >> 12) & 63) | 128, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128\n )\n }\n if (enc !== null) {\n if (end > start) {\n utftext += string.slice(start, end)\n }\n utftext += enc\n start = end = n + 1\n }\n }\n\n if (end > start) {\n utftext += string.slice(start, stringl)\n }\n\n return utftext\n}\n"]}
\ No newline at end of file |