immodel-types
Add type registration capabilities to immodel
Last updated 6 years ago by ashaffer88 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install immodel-types 
SYNC missed versions from official npm registry.

immodel-types

Adds type registration to immodel

Usage

type

Registers a type. It may be used in two ways, at the end of a chain:

model
  .validator(isString)
  .caster(toString)
  .type('string');

In which case it registers the this in the current chain as the type string. And alternatively, with a function that takes a model and returns a type:

model
  .type('string', function(model) {
    return model
      .validator(isString)
      .caster(toString);
  });

The second method should be used by plugins that are registering types.

Current Tags

  • 0.1.3                                ...           latest (6 years ago)

4 Versions

  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |