phadej / typify

Runtime type checking for JavaScript
BSD 3-Clause "New" or "Revised" License
76 stars 7 forks source link

Add integer and nat to default types #11

Closed phadej closed 10 years ago

phadej commented 11 years ago
typify.type("integer", function (v) {
    return v === (v|0);
});

typify.type("nat", function (v) {
    return v === (v|0) && v >= 0;
});