Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    should-checkpublic

    should-check

    node.js object check module using should.js

    About

    You can check objects format (for example test cases..)

    Example

    var check = require('should-check');
     
    var obj = {
      Model: ['prop1'],
      List: [':[Model]'],
      ModelListObj: ['list:[Model]']
    };
     
    var sc = check.init(obj);
     
    sc.check('Model', {prop1: 'val1'});
    sc.check('List', [{prop1: 'val1'}]);
    sc.check('ModelListObj', {list: [{prop1: 'val1'}]});
     
    var json = sc.checkJSON('Model', '{"prop1": "val1"}');

    API

    init(obj)

    initialize and return SC object

    sc.check(name, target_obj)

    compare target_obj and name of object

    sc.checkJSON(name, json_str)

    parse json_str and compare the json and name of object. Also return the parsed json object.

    Keywords

    install

    npm i should-check

    Downloadslast 7 days

    3

    version

    0.1.1

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar