couchdb-timestamp-model

1.0.1 • Public • Published

couchdb-timestamp-model

Build Status npm version License semantic-release

Data model for CouchDB timestamps

Installation

npm install --save couchdb-timestamp-model

Usage

const timestamp = require('couchdb-timestamp-model')
timestamp.validate({
  createdAt: '1970-01-01T00:00:00.000Z'
})
// => undefined
// undefined means the object validated

See json-clay for general API docs.

timestamp.validate(<json>)

Validate the given json against the schema. Returns undefined if the data is valid, otherwise an array of errors.

timestamp.generate([attributes])

Generates a model with fake data via json-schema-faker. If an attributes object is provided, its properties will be used instead of faked values.

CLI

A handy command line tool for creating test data:

$ couchdb-timestamp-model --updatedAt "1970-01-01T00:00:00.000Z"
{
  "createdAt""3175-08-28T09:59:11.646Z",
  "updatedAt""1970-01-01T00:00:00.000Z"
}

Contributors

© 2016 Tom Vincent tom@field.partners

License

Released under the Apache-2.0 license.

Dependents (0)

Package Sidebar

Install

npm i couchdb-timestamp-model

Weekly Downloads

5

Version

1.0.1

License

none

Last publish

Collaborators

  • fieldmachine