from-protobuf-object
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

from-protobuf-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 from-protobuf-object

Usage

import { fromProtobufObject } from 'from-protobuf-object';
import { MyMessage } from './my-message_pb';

const myMessage = fromProtobufObject(MyMessage, {
    keyOne: 1,
    keyTwo: 'foo',
    keyThree: {
        keyA: 2,
        keyB: 'bar',
    },
});

Contributing

Contributions are always welcome!

License

Apache-2.0

Package Sidebar

Install

npm i from-protobuf-object

Weekly Downloads

128

Version

1.0.2

License

Apache-2.0

Unpacked Size

20.8 kB

Total Files

6

Last publish

Collaborators

  • infodusha