firebase-server-value

1.0.2 • Public • Published

firebase-server-value Build Status

Create, detect, and validate Firebase.ServerValue

Install

$ npm install --save firebase-server-value

Usage

var firebaseServerValue = require('firebase-server-value')

firebaseServerValue.parse({
  '.sv': 'timestamp'
}) // => current timestamp

API

sv.ServerValue

An object deeply equal to Firebase.ServerValue

sv.is(value)

Checks whether a given value is a valid ServerValue placeholder.

value

Required
Type: any

sv.parse(value)

Parse a ServerValue placeholder into its actual value.

value

Required
Type: object

An error will be thrown if value is not a valid ServerValue according to sv.is.

sv.values

An object with keys corresponding to the valid '.sv' placeholders (currently just 'timestamp') and the function used by sv.parse to generate a result as the values. The functions are called with no arguments. They can be overridden to modify the conversion of placeholders to true values.

License

MIT © Ben Drucker

Readme

Keywords

Package Sidebar

Install

npm i firebase-server-value

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • bendrucker