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

tsbuffer

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsbuffer - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

package.json
{
"name": "tsbuffer",
"version": "0.1.1",
"version": "0.1.2",
"description": "",

@@ -31,2 +31,2 @@ "main": "index.js",

"homepage": "https://github.com/k8w/tsbuffer#readme"
}
}

@@ -5,2 +5,3 @@ import { TSBufferProto } from "tsbuffer-schema";

import { Decoder } from "./decoder/Decoder";
import { ValidateResult } from "tsbuffer-validator/src/ValidateResult";
export declare class TSBuffer {

@@ -30,2 +31,3 @@ protected _validator: TSBufferValidator;

}): unknown;
validate(value: any, schemaId: string): ValidateResult;
}

@@ -27,3 +27,4 @@ "use strict";

if (!vRes.isSucc) {
throw new Error("Invalid value: " + vRes.originalError.message);
var err = vRes.originalError;
throw new Error("Invalid value: " + (err.fieldName ? (err.fieldName + ' ') : '') + vRes.originalError.message);
}

@@ -44,7 +45,14 @@ }

}
var value = this._decoder.decode(buf, schema);
var value;
try {
value = this._decoder.decode(buf, schema);
}
catch (e) {
throw new Error('Invalid encoding: ' + e.message);
}
if (!options || !options.skipValidate) {
var vRes = this._validator.validateBySchema(value, schema);
if (!vRes.isSucc) {
throw new Error("Invalid decoded value: " + vRes.originalError.message);
var err = vRes.originalError;
throw new Error("Invalid decoded value: " + (err.fieldName ? (err.fieldName + ' ') : '') + vRes.originalError.message);
}

@@ -54,4 +62,7 @@ }

};
TSBuffer.prototype.validate = function (value, schemaId) {
return this._validator.validate(value, schemaId);
};
return TSBuffer;
}());
exports.TSBuffer = TSBuffer;
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