Socket
Socket
Sign inDemoInstall

grpc-web-from-object

Package Overview
Dependencies
1
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grpc-web-from-object

fromObject method for grpc-web


Version published
Weekly downloads
44
increased by340%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

2.6.2 (2023-09-04)

Bug Fixes

  • add deprecation warning (3eb5a51)

Readme

Source

⛔️ DEPRECATED

Use from-protobuf-object instead.

grpc-web-from-object

fromObject method for grpc-web

In general that is opposite for 'toObject' method in protobufjs.

Supports:

  • Simple keys
  • Repeated
  • OneOf
  • Protobuf Map
  • Recursive messages
  • Type validation (at runtime)
  • TypeScript
  • Missing keys validation

Installation

npm i grpc-web-from-object

Usage

import { createFromObject } from 'grpc-web-from-object';
import { MyMessage } from './my-message_pb';
import { MyInnerMessage } from './my-inner-message_pb';

const fromMyMessage = createFromObject(MyMessage, {
    keyThree: createFromObject(MyInnerMessage),
});

const myMessage = fromMyMessage({
    keyOne: 1,
    keyTwo: 'foo',
    keyThree: {
        keyA: 2,
        keyB: 'bar',
    },
});
For recursive message:
import { createFromObject, createFromObjectRecursive } from 'grpc-web-from-object';
import { MyMessage } from './my-message_pb';

const fromMyMessage = createFromObject(MyMessage, {
    message: createFromObjectRecursive(MyMessage),
});

Authors

Contributing

Contributions are always welcome!

License

Apache-2.0

Keywords

FAQs

Last updated on 04 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc