Nibbling Perfect Macaroni

    obligations

    0.0.2 • Public • Published

    Obligations

    Build Status

    Tiny JavaScript library for preconditions, postconditions and invariants, intended for use with Contractual.

    Installation

    npm install obligations
    

    Usage

    var obligations = require('obligations');
     
    obligations.precondition(1 > 0); // always ok
    obligations.precondition(false); // throws a PreconditionError
    obligations.precondition(0 > 1, "The world has ended!"); // throws a PreconditionError with a custom message
     
     
    obligations.postcondition(1 > 0); // always ok
    obligations.postcondition(false); // throws a PostconditionError
    obligations.postcondition(0 > 1, "The world has ended!"); // throws a PostconditionError with a custom message
     
    obligations.invariant(1 > 0); // always ok
    obligations.invariant(false); // throws an InvariantError
    obligations.invariant(0 > 1, "The world has ended!"); // throws a InvariantError with a custom message
     

    License

    MIT, see LICENSE.md.

    Install

    npm i obligations

    DownloadsWeekly Downloads

    33

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • charlespick