summaryrefslogtreecommitdiff
path: root/src/node_modules/charenc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2021-12-21 16:52:28 +0100
committerMinteck <contact@minteck.org>2021-12-21 16:52:28 +0100
commit46e43f4bde4a35785b4997b81e86cd19f046b69b (patch)
treec53c2f826f777f9d6b2d249dab556feb72a6c3a6 /src/node_modules/charenc
downloadlangdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.gz
langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.bz2
langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.zip
Commit
Diffstat (limited to 'src/node_modules/charenc')
-rw-r--r--src/node_modules/charenc/LICENSE.mkd27
-rw-r--r--src/node_modules/charenc/README.js1
-rw-r--r--src/node_modules/charenc/charenc.js33
-rw-r--r--src/node_modules/charenc/package.json24
4 files changed, 85 insertions, 0 deletions
diff --git a/src/node_modules/charenc/LICENSE.mkd b/src/node_modules/charenc/LICENSE.mkd
new file mode 100644
index 0000000..96d4c42
--- /dev/null
+++ b/src/node_modules/charenc/LICENSE.mkd
@@ -0,0 +1,27 @@
+Copyright © 2011, Paul Vorbach. All rights reserved.
+Copyright © 2009, Jeff Mott. All rights reserved.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+* Neither the name Crypto-JS nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/node_modules/charenc/README.js b/src/node_modules/charenc/README.js
new file mode 100644
index 0000000..cfb1baa
--- /dev/null
+++ b/src/node_modules/charenc/README.js
@@ -0,0 +1 @@
+**enc** provides crypto character encoding utilities.
diff --git a/src/node_modules/charenc/charenc.js b/src/node_modules/charenc/charenc.js
new file mode 100644
index 0000000..6627f9d
--- /dev/null
+++ b/src/node_modules/charenc/charenc.js
@@ -0,0 +1,33 @@
+var charenc = {
+ // UTF-8 encoding
+ utf8: {
+ // Convert a string to a byte array
+ stringToBytes: function(str) {
+ return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
+ },
+
+ // Convert a byte array to a string
+ bytesToString: function(bytes) {
+ return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
+ }
+ },
+
+ // Binary encoding
+ bin: {
+ // Convert a string to a byte array
+ stringToBytes: function(str) {
+ for (var bytes = [], i = 0; i < str.length; i++)
+ bytes.push(str.charCodeAt(i) & 0xFF);
+ return bytes;
+ },
+
+ // Convert a byte array to a string
+ bytesToString: function(bytes) {
+ for (var str = [], i = 0; i < bytes.length; i++)
+ str.push(String.fromCharCode(bytes[i]));
+ return str.join('');
+ }
+ }
+};
+
+module.exports = charenc;
diff --git a/src/node_modules/charenc/package.json b/src/node_modules/charenc/package.json
new file mode 100644
index 0000000..aece310
--- /dev/null
+++ b/src/node_modules/charenc/package.json
@@ -0,0 +1,24 @@
+{
+ "author": "Paul Vorbach <paul@vorb.de> (http://vorb.de)",
+ "name": "charenc",
+ "description": "character encoding utilities",
+ "tags": [
+ "utf8",
+ "binary",
+ "byte",
+ "string"
+ ],
+ "version": "0.0.2",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/pvorb/node-charenc.git"
+ },
+ "bugs": {
+ "url": "https://github.com/pvorb/node-charenc/issues"
+ },
+ "main": "charenc.js",
+ "engines": {
+ "node": "*"
+ }
+}