Comparing version 3.0.0 to 3.1.0
26
index.js
@@ -48,4 +48,28 @@ import crypto from 'crypto'; | ||
} | ||
static base64Encode(_string) { | ||
if (typeof window !== 'undefined' && window.btoa) { | ||
// Browser environment | ||
return window.btoa(_string); | ||
} | ||
if(typeof Buffer !== 'undefined') { | ||
// Node.js environment | ||
return Buffer.from(_string).toString('base64'); | ||
} | ||
} | ||
static base64Decode(_string) { | ||
if (typeof window !== 'undefined' && window.atob) { | ||
// Browser environment | ||
return window.atob(_string); | ||
} | ||
if (typeof Buffer !== 'undefined') { | ||
// Node.js environment | ||
return Buffer.from(_string, 'base64').toString('utf-8'); | ||
} | ||
} | ||
} | ||
export default ArcHash; | ||
export default ArcHash; |
{ | ||
"name": "arc-hash", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "ES6 convenience library for hashing arrays, objects, strings as md5 or sha256", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
10075
165