0.0.5 • Published 3 years ago

is-valid-object v0.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

is-valid-object

is-valid-object is a Javascript library for making sure objects conform to a defined structure.

Installation

npm install is-valid-object

Usage

import { ObjectChecker } from 'is-valid-object';

const schema = {
    "keyToCheck": {
        "type": "string"
    }
};

const objectToCheck = {
    "keyToCheck": "some string"
};

console.time("object-checker");
const checker = new ObjectChecker();
try {
    // will throw if there is some problem with the specified object
    checker.check(objectToCheck, schema);
} catch (error) {
    // some key is malformed
    console.log(error.message || error, "error");
}
console.timeEnd("object-checker");

A detailed example can be found in this file

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago