0.1.5 • Published 9 years ago

missing-keys v0.1.5

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

Find missing object keys (node and browser support)

Travis CI Downloads average per month Npm version Bower version Depedencies

Return missing keys if the given object hasn't all required keys.

Can I improve something or help you?

Just open an issue and I will help you :)

Install

with npm

$ npm install missing-keys --save

with bower

$ bower install missing-keys --save

Usage in node

var missingKeys = require('missing-keys');

var config = {
    name: 'missing-keys',
    description: 'Return missing keys if the given object has not all required keys.',
    version: '0.1.0',
    homepage: 'https://github.com/tobiasoberrauch/missing-keys',
    author: 'Tobias Oberrauch <tobias.oberrauch@grolba.com>'
};

missingKeys.has(config, 'name');
//-> false

missingKeys.get(config, ['name', 'bin']);
//-> ['bin']

missingKeys(config, ['bin', 'dependencies']);
//-> ['bin', 'dependencies']

var requiredKeys = ['bin', 'dependencies'];
if (missingKeys.has(config, requiredKeys)) {
  var keys = missingKeys.get(config, requiredKeys);
}

Usage in browser

<script type="text/javascript" src="./bower_components/missing-keys/index.js"></script>
<script type="text/javascript">
var config = {
    name: 'missing-keys',
    description: 'Return missing keys if the given object has not all required keys.',
    version: '0.1.0',
    homepage: 'https://github.com/tobiasoberrauch/missing-keys',
    author: 'Tobias Oberrauch <tobias.oberrauch@grolba.com>'
};

missingKeys.has(config, 'name');
//-> false

missingKeys.get(config, ['name', 'bin']);
//-> ['bin']

missingKeys(config, ['bin', 'dependencies']);
//-> ['bin', 'dependencies']

var requiredKeys = ['bin', 'dependencies'];
if (missingKeys.has(config, requiredKeys)) {
  var keys = missingKeys.get(config, requiredKeys);
}
</script>

Do you like it? Please star it and follow me :)

Star on Github Follow me on Github

Running tests in node

$ npm install && npm test

Running test in browser

Open ./test/index.html with your browser

Contributing

Pull requests and stars are always welcome :) For bugs and feature requests, please create an issue

Author

Tobias Oberrauch

License

Copyright © 2015 Tobias Oberrauch Released under the MIT license.

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago