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

grpc-web-from-object

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-web-from-object - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

8

CHANGELOG.md
# Changelog
## [2.1.0](https://github.com/infodusha/grpc-web-from-object/compare/v2.0.3...v2.1.0) (2023-02-05)
### Features
* validate missing factory ([9cdacd3](https://github.com/infodusha/grpc-web-from-object/commit/9cdacd3dcde582ea57b21155b8611ede259dcb23))
* validate missing properties ([ba17bfd](https://github.com/infodusha/grpc-web-from-object/commit/ba17bfd0b6e8eed35d160be1a804a52625a22136))
## [2.0.3](https://github.com/infodusha/grpc-web-from-object/compare/v2.0.2...v2.0.3) (2023-02-03)

@@ -4,0 +12,0 @@

@@ -8,2 +8,3 @@ "use strict";

const instance = new MessageType();
validateMissingProps(instance, data);
for (const [key, value] of Object.entries(data)) {

@@ -29,2 +30,3 @@ if (value === null) {

else {
validateMissingFactory(key, value);
setValue(instance, key, value);

@@ -49,1 +51,22 @@ }

}
function validateMissingProps(instance, data) {
const dataSetters = Object.keys(data).map((key) => getSetter(key));
const instanceSetters = Object.keys(Object.getPrototypeOf(instance)).filter((key) => key.startsWith('set'));
for (const key of instanceSetters) {
if (!dataSetters.includes(key) && instance['clear' + key.slice(3)] === undefined) {
const prop = key.slice(3, 4).toLowerCase() + key.slice(4);
throw new Error(`Missing property '${prop}'`);
}
}
}
function validateMissingFactory(key, value) {
if (Array.isArray(value)) {
for (const v of value) {
validateMissingFactory(key, v);
}
return;
}
if (typeof value === 'object') {
throw new Error(`Missing factory for '${key}'`);
}
}

2

package.json
{
"name": "grpc-web-from-object",
"version": "2.0.3",
"version": "2.1.0",
"description": "fromObject method for grpc-web",

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