aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-09-29 00:43:36 +0300
committerValentin Popov <info@valentineus.link>2017-09-29 00:43:36 +0300
commit3eff453aacac2f558c81cc7dc2b012ee2c82ff7c (patch)
tree49b86c186a46790046ac1c48adf119a710bdae99
parent37c134838210e81043b6684f8b49cd41987c3498 (diff)
downloadiii-client-3eff453aacac2f558c81cc7dc2b012ee2c82ff7c.tar.xz
iii-client-3eff453aacac2f558c81cc7dc2b012ee2c82ff7c.zip
Refusal to support older versions of NodeJS
-rw-r--r--.travis.yml3
-rw-r--r--src/index.js10
2 files changed, 5 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index ecd089f..c50cf2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,8 +4,6 @@ node_js:
- "8"
- "7"
- "6"
- - "5"
- - "4"
os:
- linux
@@ -20,7 +18,6 @@ before_install:
- npm install --global codacy-coverage
install:
- - npm install --only=production
- npm install --only=development
script:
diff --git a/src/index.js b/src/index.js
index e1c0b4a..7cbf47a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -76,8 +76,8 @@ function send(cuid, text, callback) {
* @description Encrypts the received string.
*/
function encrypt(data) {
- var base64 = new Buffer(data).toString('base64');
- var string = new Buffer(base64);
+ var base64 = Buffer.from(data).toString('base64');
+ var string = Buffer.from(base64);
return mergerString(string).toString('base64');
}
@@ -87,9 +87,9 @@ function encrypt(data) {
* @description Decrypts the received string.
*/
function decrypt(data) {
- var string = new Buffer(data, 'base64');
+ var string = Buffer.from(data, 'base64');
var decrypted = mergerString(string).toString();
- return new Buffer(decrypted, 'base64');
+ return Buffer.from(decrypted, 'base64');
}
/**
@@ -109,7 +109,7 @@ function decryptJSON(json) {
* @description Merges the source string.
*/
function mergerString(data) {
- var salt = new Buffer('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];
});