Socket
Socket
Sign inDemoInstall

base64-url

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.3 to 2.0.0

26

index.js

@@ -1,10 +0,10 @@

'use strict';
'use strict'
var base64url = module.exports;
const base64url = module.exports
base64url.unescape = function unescape (str) {
return (str + '==='.slice((str.length + 3) % 4))
.replace(/\-/g, '+')
.replace(/_/g, '/');
};
.replace(/-/g, '+')
.replace(/_/g, '/')
}

@@ -14,11 +14,11 @@ base64url.escape = function escape (str) {

.replace(/\//g, '_')
.replace(/=/g, '');
};
.replace(/=/g, '')
}
base64url.encode = function encode (str) {
return this.escape(new Buffer(str).toString('base64'));
};
base64url.encode = function encode (str, encoding) {
return this.escape(Buffer.from(str, encoding || 'utf8').toString('base64'))
}
base64url.decode = function decode (str) {
return new Buffer(this.unescape(str), 'base64').toString();
};
base64url.decode = function decode (str, encoding) {
return Buffer.from(this.unescape(str), 'base64').toString(encoding || 'utf8')
}
{
"name": "base64-url",
"version": "1.3.3",
"version": "2.0.0",
"description": "Base64 encode, decode, escape and unescape for URL applications",

@@ -12,7 +12,6 @@ "main": "index.js",

"scripts": {
"test": "istanbul cover tape test.js",
"lint": "jshint -c .jshintrc *.js",
"style": "jscs -p google *.js",
"coverage:check": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"coverage": "open coverage/lcov-report/index.html"
"coverage:open": "open coverage/index.html",
"coverage:check": "nyc check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"test": "standard --fix && nyc --reporter=html --reporter=text tape test.js"
},

@@ -34,14 +33,15 @@ "repository": {

"devDependencies": {
"istanbul": "^0.3.5",
"jscs": "^1.9.0",
"jshint": "^2.5.11",
"pre-commit": "^1.1.3",
"tape": "^4.6.0"
"coveralls": "^2.13.1",
"nyc": "^11.1.0",
"pre-commit": "^1.2.2",
"standard": "^10.0.3",
"tape": "^4.8.0"
},
"pre-commit": [
"lint",
"style",
"test",
"coverage:check"
]
],
"engines": {
"node": ">=6"
}
}

@@ -7,47 +7,43 @@ # base64-url

[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)
[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.svg?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)[![Coverage Status](https://coveralls.io/repos/github/joaquimserafim/base64-url/badge.svg)](https://coveralls.io/github/joaquimserafim/base64-url)[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg?style=flat-square)](https://github.com/joaquimserafim/base64-url/blob/master/LICENSE)[![NodeJS](https://img.shields.io/badge/node-6.x.x-brightgreen.svg?style=flat-square)](https://github.com/joaquimserafim/base64-url/blob/master/package.json#L43)
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
## API
`const base64url = require('base64-url')`
### examples
```js
var base64url = require('base64-url');
base64url.encode('Node.js is awesome.');
base64url.encode('Node.js is awesome.')
// returns Tm9kZS5qcyBpcyBhd2Vzb21lLg
base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');
base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg')
// returns Node.js is awesome.
base64url.escape('This+is/goingto+escape==');
base64url.escape('This+is/goingto+escape==')
// returns This-is_goingto-escape
base64url.unescape('This-is_goingto-escape');
base64url.unescape('This-is_goingto-escape')
// returns This+is/goingto+escape==
```
//
// setting a different econding
//
## Development
base64url.encode(string to encode, encoding)
base64url.decode(string to decode, encoding)
**this project has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit**
```
to run test
``` js
npm test
```
#### ISC License (ISC)
to run lint
``` js
npm run lint
```
# Alternatives
to run code style
``` js
npm run style
```
to check code coverage
``` js
npm run coverage:check
```
- [base64url](https://github.com/brianloveswords/base64url)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc