How to use the warehouse.SchemaType function in warehouse

To help you get started, we’ve selected a few warehouse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexojs / hexo / lib / model / types / moment.js View on Github external
var moment = require('moment'),
  _ = require('lodash'),
  SchemaType = require('warehouse').SchemaType;

var SchemaMoment = module.exports = function(options){
  SchemaType.call(this, options);
};

SchemaMoment.__proto__ = SchemaType;
SchemaMoment.prototype.__proto__ = SchemaType.prototype;

SchemaMoment.prototype.checkRequired = function(value){
  return moment.isMoment(value);
};

var cast = SchemaMoment.prototype.cast = function(value){
  if (!value) return null;
  if (moment.isMoment(value)) return value;