mirror of
https://github.com/valentineus/iii-client.git
synced 2025-04-28 01:41:25 +03:00
Small code refactoring to support older platforms
This commit is contained in:
parent
79243accc5
commit
cc2c50b07b
@ -40,10 +40,7 @@
|
|||||||
"build-standalone": "babel src/index.js --out-file dist/standalone.js",
|
"build-standalone": "babel src/index.js --out-file dist/standalone.js",
|
||||||
"build-browser": "rollup --config rollup.config.js",
|
"build-browser": "rollup --config rollup.config.js",
|
||||||
"build": "npm run build-browser && npm run build-standalone",
|
"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"
|
"check": "eslint ./src/index.js"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "^5.1.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/index.js
10
src/index.js
@ -1,4 +1,3 @@
|
|||||||
import { Buffer } from 'safe-buffer';
|
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,9 +110,12 @@ function decryptJSON(json) {
|
|||||||
*/
|
*/
|
||||||
function mergerString(data) {
|
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');
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user