2.1.4 • Published 7 years ago

clay-serial v2.1.4

Weekly downloads
222
License
Apache-2.0
Repository
github
Last release
7 years ago

clay-serial

Build Status npm Version JS Standard

Conberter for ClayDB

Installation

$ npm install clay-serial --save

Usage

'use strict'

const { serialize, deserialize } = require('clay-serial')

{
  let book = {
    title: 'Wonderful Banana',
    version: 15,
    publishedAt: new Date('2012/12/12')
  }

  let serialized = serialize.all(book)

  console.log(serialized) // Serialized value

  let deserialized = deserialize.all(serialized)
  console.log(deserialized) // Restore the original data
}

Functions

Available functions

SignatureDescription
deserialize(Serialized) -> ObjectDeserialize value
deserialize.all(values) -> Object.<string, Serialized>Deserialize object properties
deserialize.recursive(values) -> Object.<string, Serialized>Deserialize recursively
serialize(value) -> SerializedSerialize value
serialize.all(values) -> Object.<string, Serialized>Serialize object properties
serialize.recursive(values) -> Object.<string, Serialized>Serialize recursively
typeOf(value) -> stringGet type of an value
withType(value, type) -> *Convert value with type

License

This software is released under the Apache-2.0 License.

Links