From cc2c50b07b33c4032c62c0c46f4ada139ea08664 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 9 Oct 2017 19:00:02 +0400 Subject: Small code refactoring to support older platforms --- src/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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; } /** -- cgit v1.2.3