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

@aws-sdk/util-base64-browser

Package Overview
Dependencies
Maintainers
5
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/util-base64-browser - npm Package Compare versions

Comparing version 3.170.0 to 3.183.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
**Note:** Version bump only for package @aws-sdk/util-base64-browser
# [3.170.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.169.0...v3.170.0) (2022-09-13)

@@ -8,0 +16,0 @@

66

dist-es/index.js

@@ -1,18 +0,18 @@

var alphabetByEncoding = {};
var alphabetByValue = new Array(64);
for (var i = 0, start = "A".charCodeAt(0), limit = "Z".charCodeAt(0); i + start <= limit; i++) {
var char = String.fromCharCode(i + start);
const alphabetByEncoding = {};
const alphabetByValue = new Array(64);
for (let i = 0, start = "A".charCodeAt(0), limit = "Z".charCodeAt(0); i + start <= limit; i++) {
const char = String.fromCharCode(i + start);
alphabetByEncoding[char] = i;
alphabetByValue[i] = char;
}
for (var i = 0, start = "a".charCodeAt(0), limit = "z".charCodeAt(0); i + start <= limit; i++) {
var char = String.fromCharCode(i + start);
var index = i + 26;
for (let i = 0, start = "a".charCodeAt(0), limit = "z".charCodeAt(0); i + start <= limit; i++) {
const char = String.fromCharCode(i + start);
const index = i + 26;
alphabetByEncoding[char] = index;
alphabetByValue[index] = char;
}
for (var i = 0; i < 10; i++) {
for (let i = 0; i < 10; i++) {
alphabetByEncoding[i.toString(10)] = i + 52;
var char = i.toString(10);
var index = i + 52;
const char = i.toString(10);
const index = i + 52;
alphabetByEncoding[char] = index;

@@ -25,7 +25,7 @@ alphabetByValue[index] = char;

alphabetByValue[63] = "/";
var bitsPerLetter = 6;
var bitsPerByte = 8;
var maxLetterValue = 63;
const bitsPerLetter = 6;
const bitsPerByte = 8;
const maxLetterValue = 0b111111;
export function fromBase64(input) {
var totalByteLength = (input.length / 4) * 3;
let totalByteLength = (input.length / 4) * 3;
if (input.slice(-2) === "==") {

@@ -37,11 +37,11 @@ totalByteLength -= 2;

}
var out = new ArrayBuffer(totalByteLength);
var dataView = new DataView(out);
for (var i = 0; i < input.length; i += 4) {
var bits = 0;
var bitLength = 0;
for (var j = i, limit = i + 3; j <= limit; j++) {
const out = new ArrayBuffer(totalByteLength);
const dataView = new DataView(out);
for (let i = 0; i < input.length; i += 4) {
let bits = 0;
let bitLength = 0;
for (let j = i, limit = i + 3; j <= limit; j++) {
if (input[j] !== "=") {
if (!(input[j] in alphabetByEncoding)) {
throw new TypeError("Invalid character ".concat(input[j], " in base64 string."));
throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
}

@@ -55,7 +55,7 @@ bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);

}
var chunkOffset = (i / 4) * 3;
const chunkOffset = (i / 4) * 3;
bits >>= bitLength % bitsPerByte;
var byteLength = Math.floor(bitLength / bitsPerByte);
for (var k = 0; k < byteLength; k++) {
var offset = (byteLength - k - 1) * bitsPerByte;
const byteLength = Math.floor(bitLength / bitsPerByte);
for (let k = 0; k < byteLength; k++) {
const offset = (byteLength - k - 1) * bitsPerByte;
dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);

@@ -67,14 +67,14 @@ }

export function toBase64(input) {
var str = "";
for (var i = 0; i < input.length; i += 3) {
var bits = 0;
var bitLength = 0;
for (var j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
let str = "";
for (let i = 0; i < input.length; i += 3) {
let bits = 0;
let bitLength = 0;
for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
bits |= input[j] << ((limit - j - 1) * bitsPerByte);
bitLength += bitsPerByte;
}
var bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
bits <<= bitClusterCount * bitsPerLetter - bitLength;
for (var k = 1; k <= bitClusterCount; k++) {
var offset = (bitClusterCount - k) * bitsPerLetter;
for (let k = 1; k <= bitClusterCount; k++) {
const offset = (bitClusterCount - k) * bitsPerLetter;
str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];

@@ -81,0 +81,0 @@ }

export declare function fromBase64(input: string): Uint8Array;
export declare function toBase64(input: Uint8Array): string;
{
"name": "@aws-sdk/util-base64-browser",
"version": "3.170.0",
"version": "3.183.0",
"description": "A pure JS Base64 <-> UInt8Array converter",

@@ -5,0 +5,0 @@ "main": "./dist-cjs/index.js",

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