Socket
Socket
Sign inDemoInstall

@bjesuiter/serializr-helpers

Package Overview
Dependencies
5
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bjesuiter/serializr-helpers

Provides some helper functions and serialization PropertySchemas for mobxjs/serializr - library


Version published
Maintainers
1
Created

Changelog

Source

[2.2.1] - 2019-07-12

  • add dist.commonjs.es6 build
  • add dist.esm.es6 build

Readme

Source

serializr-helpers

Provides some helper functions and serialization PropertySchemas for mobxjs/serializr - library

Content

Usage 'MomentSerializationSchema

Can be used as a factory for serializr PropSchema to serialize Moment Objects.

/**
 * A Timestamp as Moment.js object
 */
@serializable(MomentSerializationSchema())
timestamp: Moment;

With options:

/**
 * A Timestamp as Moment.js object
 */
@serializable(
MomentSerializationSchema({
    useUtc: true
})
)
timestamp: Moment;

All available options and their details could be read in ./src/lib/moment-serialization-options.ts

Usage serializr-helpers

serializeToJson()

Takes a serializr annotated object and serializes directly to json without an intermediate js-object.

deserializeFromJson()

Takes a json string and a target class object and deserializes the string into the target class instance.

serializeJson()

Alias for serializeToJson

deserializeJson()

Alias for deserializeFromJson

serializeToPojo()

Alias for native serializr serialize() function, to make the meaning less ambiguous

deserializeFromPojo()

Alias for native serializr deserialize() function, to make the meaning less ambiguous

TODOs

  • fix wallaby test running (problems with modern import syntax => current workaround: npm run test:watch)

Uses

mixu/minilog: A lighweight client & server logging lib with StreamApi backends
Docs URL: http://mixu.net/minilog/

Keywords

FAQs

Last updated on 12 Jul 2019

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