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

js-base64

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-base64 - npm Package Compare versions

Comparing version 3.5.0 to 3.5.1

14

base64.d.ts

@@ -12,7 +12,7 @@ /**

*/
declare const version = "3.5.0";
declare const version = "3.5.1";
/**
* @deprecated use lowercase `version`.
*/
declare const VERSION = "3.5.0";
declare const VERSION = "3.5.1";
/**

@@ -34,2 +34,7 @@ * polyfill version of `btoa`

declare const fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string;
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-8 string
* @returns {string} UTF-16 string
*/
declare const utob: (u: string) => string;

@@ -47,2 +52,7 @@ /**

declare const encodeURI: (src: string) => string;
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-16 string
* @returns {string} UTF-8 string
*/
declare const btou: (b: string) => string;

@@ -49,0 +59,0 @@ /**

40

base64.js

@@ -43,3 +43,3 @@

*/
const version = '3.5.0';
const version = '3.5.1';
/**

@@ -52,2 +52,4 @@ * @deprecated use lowercase `version`.

const _hasBuffer = typeof Buffer === 'function';
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

@@ -114,7 +116,2 @@ const b64chs = [...b64ch];

const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-8 string
* @returns {string} UTF-16 string
*/
// This trick is found broken https://github.com/dankogai/js-base64/issues/130

@@ -144,2 +141,7 @@ // const utob = (src: string) => unescape(encodeURIComponent(src));

const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-8 string
* @returns {string} UTF-16 string
*/
const utob = (u) => u.replace(re_utob, cb_utob);

@@ -149,3 +151,4 @@ //

? (s) => Buffer.from(s, 'utf8').toString('base64')
: (s) => _btoa(utob(s));
: _TE ? (s) => _fromUint8Array(_TE.encode(s))
: (s) => _btoa(utob(s));
/**

@@ -164,7 +167,2 @@ * converts a UTF-8-encoded string to a Base64 string.

const encodeURI = (src) => encode(src, true);
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-16 string
* @returns {string} UTF-8 string
*/
// This trick is found broken https://github.com/dankogai/js-base64/issues/130

@@ -192,2 +190,7 @@ // const btou = (src: string) => decodeURIComponent(escape(src));

};
/**
* @deprecated should have been internal use only.
* @param {string} src UTF-16 string
* @returns {string} UTF-8 string
*/
const btou = (b) => b.replace(re_btou, cb_btou);

@@ -225,3 +228,5 @@ /**

? (a) => Buffer.from(a, 'base64').toString('utf8')
: (a) => btou(_atob(a));
: _TD
? (a) => _TD.decode(_toUint8Array(a))
: (a) => btou(_atob(a));
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));

@@ -234,8 +239,11 @@ /**

const decode = (src) => _decode(_unURI(src));
//
const _toUint8Array = _hasBuffer
? (a) => _U8Afrom(Buffer.from(a, 'base64'))
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
/**
* converts a Base64 string to a Uint8Array.
*/
const toUint8Array = _hasBuffer
? (a) => _U8Afrom(Buffer.from(_unURI(a), 'base64'))
: (a) => _U8Afrom(_atob(_unURI(a)), c => c.charCodeAt(0));
const toUint8Array = (a) => _toUint8Array(_unURI(a));
//
const _noEnum = (v) => {

@@ -242,0 +250,0 @@ return {

{
"name": "js-base64",
"version": "3.5.0",
"version": "3.5.1",
"description": "Yet another Base64 transcoder in pure-JS",

@@ -5,0 +5,0 @@ "main": "base64.js",

@@ -32,3 +32,3 @@ [![build status](https://secure.travis-ci.org/dankogai/js-base64.png)](http://travis-ci.org/dankogai/js-base64)

```html
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.5.0/base64.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.min.js"></script>
```

@@ -56,3 +56,3 @@

// note jsdelivr.net does not automatically minify .mjs
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.0/base64.mjs';
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.mjs';
</script>

@@ -64,3 +64,3 @@ ```

// or if you prefer no Base64 namespace
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.0/base64.mjs';
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.mjs';
</script>

@@ -67,0 +67,0 @@ ```

Sorry, the diff of this file is not supported yet

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