base64-url
Advanced tools
Comparing version 2.0.1 to 2.1.0
19
index.js
'use strict' | ||
const base64url = module.exports | ||
module.exports = { | ||
unescape, | ||
escape, | ||
encode, | ||
decode | ||
} | ||
base64url.unescape = function unescape (str) { | ||
function unescape (str) { | ||
return (str + '==='.slice((str.length + 3) % 4)) | ||
@@ -11,3 +16,3 @@ .replace(/-/g, '+') | ||
base64url.escape = function escape (str) { | ||
function escape (str) { | ||
return str.replace(/\+/g, '-') | ||
@@ -18,8 +23,8 @@ .replace(/\//g, '_') | ||
base64url.encode = function encode (str, encoding) { | ||
return this.escape(Buffer.from(str, encoding || 'utf8').toString('base64')) | ||
function encode (str, encoding) { | ||
return escape(Buffer.from(str, encoding || 'utf8').toString('base64')) | ||
} | ||
base64url.decode = function decode (str, encoding) { | ||
return Buffer.from(this.unescape(str), 'base64').toString(encoding || 'utf8') | ||
function decode (str, encoding) { | ||
return Buffer.from(unescape(str), 'base64').toString(encoding || 'utf8') | ||
} |
{ | ||
"name": "base64-url", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Base64 encode, decode, escape and unescape for URL applications", | ||
@@ -32,4 +32,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"coveralls": "^2.13.1", | ||
"nyc": "^11.1.0", | ||
"coveralls": "^3.0.0", | ||
"nyc": "^11.4.1", | ||
"pre-commit": "^1.2.2", | ||
@@ -36,0 +36,0 @@ "standard": "^10.0.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23
3964