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

@lrnwebcomponents/utils

Package Overview
Dependencies
Maintainers
4
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/utils - npm Package Compare versions

Comparing version 4.0.8 to 4.0.29

4

package.json
{
"name": "@lrnwebcomponents/utils",
"version": "4.0.8",
"version": "4.0.29",
"description": "Helper functions to clean up web component data handling.",

@@ -20,3 +20,3 @@ "repository": {

},
"gitHead": "546e19dc98d156fe786ad6410a8229e3a4167deb"
"gitHead": "1c2b9fb55d09a8c07c955a663f507f8e17efa3fc"
}

@@ -6,2 +6,26 @@ /**

/**
* Convert a base64 encoded string to type Blob
* @param {String} b64Data - base64 encoded string
* @param {String} contentType - type to mark as the encoding of the blob
* @param {Number} sliceSize - size of chunks
* @returns {Blob} class blob for file operations
*/
export function b64toBlob(b64Data, contentType='', sliceSize=512) {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, {type: contentType});
return blob;
}
/**
* Mix of solutions from https://stackoverflow.com/questions/8493195/how-can-i-parse-a-csv-string-with-javascript-which-contains-comma-in-data

@@ -8,0 +32,0 @@ */

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