aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-10-09 18:00:02 +0300
committerValentin Popov <info@valentineus.link>2017-10-09 18:00:02 +0300
commitcc2c50b07b33c4032c62c0c46f4ada139ea08664 (patch)
tree58b9b8b81e2fef9a673fbd87d35fa83b8468fe38
parent79243accc540b3d75bb3a228786274094d479ffe (diff)
downloadiii-client-cc2c50b07b33c4032c62c0c46f4ada139ea08664.tar.xz
iii-client-cc2c50b07b33c4032c62c0c46f4ada139ea08664.zip
Small code refactoring to support older platforms
-rw-r--r--package.json5
-rw-r--r--src/index.js10
2 files changed, 7 insertions, 8 deletions
diff --git a/package.json b/package.json
index 302ba3e..3381cd4 100644
--- a/package.json
+++ b/package.json
@@ -40,10 +40,7 @@
"build-standalone": "babel src/index.js --out-file dist/standalone.js",
"build-browser": "rollup --config rollup.config.js",
"build": "npm run build-browser && npm run build-standalone",
- "test": "mocha src/test.js --compilers js:babel-core/register --retries 3",
+ "test": "mocha src/test.js --compilers js:babel-core/register",
"check": "eslint ./src/index.js"
- },
- "dependencies": {
- "safe-buffer": "^5.1.1"
}
}
diff --git a/src/index.js b/src/index.js
index a0a9acb..869d2de 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,4 +1,3 @@
-import { Buffer } from 'safe-buffer';
import http from 'http';
/**
@@ -111,9 +110,12 @@ function decryptJSON(json) {
*/
function mergerString(data) {
var salt = Buffer.from('some very-very long string without any non-latin characters due to different string representations inside of variable programming languages');
- return data.map((item, index) => {
- return item ^ salt[index % salt.length];
- });
+
+ for (var i = 0; i < data.length; i++) {
+ data[i] ^= salt[i % salt.length];
+ }
+
+ return data;
}
/**