Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@poppinss/utils

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poppinss/utils - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

build/src/StateJar.d.ts

10

build/src/base64.d.ts

@@ -15,3 +15,6 @@ /// <reference types="node" />

*/
decode(encoded: string | Buffer, encoding?: BufferEncoding): string;
decode(encode: string, encoding: BufferEncoding, strict: true): string | null;
decode(encode: string, encoding: undefined, strict: true): string | null;
decode(encode: string, encoding?: BufferEncoding, strict?: false): string;
decode(encode: Buffer, encoding?: BufferEncoding): string;
/**

@@ -25,5 +28,8 @@ * Base64 encode Buffer or string to be URL safe. (RFC 4648)

*/
urlDecode(encoded: string | Buffer, encoding?: BufferEncoding): string;
urlDecode(encode: string, encoding: BufferEncoding, strict: true): string | null;
urlDecode(encode: string, encoding: undefined, strict: true): string | null;
urlDecode(encode: string, encoding?: BufferEncoding, strict?: false): string;
urlDecode(encode: Buffer, encoding?: BufferEncoding): string;
}
export declare const base64: Base64;
export {};

@@ -22,9 +22,11 @@ "use strict";

}
/**
* Base64 decode a previously encoded string or Buffer.
*/
decode(encoded, encoding = 'utf-8') {
return Buffer.isBuffer(encoded)
? encoded.toString(encoding)
: Buffer.from(encoded, 'base64').toString(encoding);
decode(encoded, encoding = 'utf-8', strict = false) {
if (Buffer.isBuffer(encoded)) {
return encoded.toString(encoding);
}
const decoded = Buffer.from(encoded, 'base64').toString(encoding);
if (strict && this.encode(decoded, encoding) !== encoded) {
return null;
}
return decoded;
}

@@ -35,9 +37,13 @@ urlEncode(data, encoding) {

}
/**
* Base64 URL decode a previously encoded string or Buffer. (RFC 4648)
*/
urlDecode(encoded, encoding = 'utf-8') {
return this.decode(encoded, encoding);
urlDecode(encoded, encoding = 'utf-8', strict = false) {
if (Buffer.isBuffer(encoded)) {
return encoded.toString(encoding);
}
const decoded = Buffer.from(encoded, 'base64').toString(encoding);
if (strict && this.urlEncode(decoded, encoding) !== encoded) {
return null;
}
return decoded;
}
}
exports.base64 = new Base64();

12

package.json
{
"name": "@poppinss/utils",
"version": "2.2.0",
"version": "2.2.1",
"description": "Handy utilities for repetitive work",

@@ -33,4 +33,4 @@ "main": "build/index.js",

"@adonisjs/mrm-preset": "^2.3.0",
"@poppinss/dev-utils": "^1.0.4",
"@types/node": "^13.11.0",
"@poppinss/dev-utils": "^1.0.5",
"@types/node": "^13.11.1",
"commitizen": "^4.0.4",

@@ -41,7 +41,7 @@ "cz-conventional-changelog": "^3.1.0",

"eslint": "^6.8.0",
"eslint-plugin-adonis": "^1.0.8",
"husky": "^4.2.3",
"eslint-plugin-adonis": "^1.0.9",
"husky": "^4.2.5",
"japa": "^3.0.1",
"lodash-cli": "^4.17.5",
"mrm": "^2.2.0",
"mrm": "^2.2.1",
"np": "^5.2.1",

@@ -48,0 +48,0 @@ "ts-node": "^8.8.2",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc