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

pvtsutils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pvtsutils - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

19

build/index.d.ts

@@ -78,2 +78,21 @@ /*!

static isEqual(a: BufferSource, b: BufferSource): boolean;
/**
* Concatenates buffers
* @param buffers List of buffers
* @returns Concatenated buffer
*/
static concat(...buffers: BufferSource[]): ArrayBuffer;
/**
* Concatenates buffers
* @param buffers List of buffers
* @returns Concatenated buffer
*/
static concat(buffers: BufferSource[]): ArrayBuffer;
/**
* Concatenates buffers and converts it into specified ArrayBufferView
* @param buffers List of buffers
* @param type ArrayBufferView constructor
* @returns Concatenated buffer of specified type
*/
static concat<T extends ArrayBufferView>(buffers: BufferSource[], type: ArrayBufferViewConstructor<T>): T;
}

@@ -80,0 +99,0 @@

@@ -41,2 +41,5 @@ /*!

static toView(data, type) {
if (data.constructor === type) {
return data;
}
if (this.isArrayBuffer(data)) {

@@ -71,2 +74,25 @@ return new type(data);

}
static concat(...args) {
if (Array.isArray(args[0])) {
const buffers = args[0];
let size = 0;
for (const buffer of buffers) {
size += buffer.byteLength;
}
const res = new Uint8Array(size);
let offset = 0;
for (const buffer of buffers) {
const view = this.toUint8Array(buffer);
res.set(view, offset);
offset += view.length;
}
if (args[1]) {
return this.toView(res, args[1]);
}
return res.buffer;
}
else {
return this.concat(args);
}
}
}

@@ -73,0 +99,0 @@

@@ -45,2 +45,5 @@ /*!

static toView(data, type) {
if (data.constructor === type) {
return data;
}
if (this.isArrayBuffer(data)) {

@@ -75,2 +78,25 @@ return new type(data);

}
static concat(...args) {
if (Array.isArray(args[0])) {
const buffers = args[0];
let size = 0;
for (const buffer of buffers) {
size += buffer.byteLength;
}
const res = new Uint8Array(size);
let offset = 0;
for (const buffer of buffers) {
const view = this.toUint8Array(buffer);
res.set(view, offset);
offset += view.length;
}
if (args[1]) {
return this.toView(res, args[1]);
}
return res.buffer;
}
else {
return this.concat(args);
}
}
}

@@ -77,0 +103,0 @@

2

package.json
{
"name": "pvtsutils",
"version": "1.3.0",
"version": "1.3.1",
"description": "pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.",

@@ -5,0 +5,0 @@ "main": "build/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