Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Small lib to define strictly typed objects
JavaScript
Branch: master
Failed to load latest commit information.
.gitignore added support files
.travis.yml added support files
LICENSE Initial commit
README.md Added boolean type
index.js Added boolean type
package.json Added boolean type
test.js Added boolean type

README.md

ministruct

build status

Small library to define strictly typed objects. Example:

var { struct, make, type } = require("ministruct");

var person = struct({
  name:  type.string,
  age:   type.number | type.nil,
  nicks: type.array
});

var bob = make(person);
bob.name = "Bob";
bob.age = 26;
bob.nicks = [ "bob1986", "sexybob" ];

console.log(bob.name); // Bob

bob.age = null;   // OK
bob.nicks = null; // TypeError

Supported types: nil, array, object, number, string, func, regexp.

Something went wrong with that request. Please try again.