A small node module providing utility methods to search JavaScript objects by key or value. Can be very handy with large shared objects and variable search values.
npm install ohme --save
Simply reqiure ohme on the base page and its ready to use.
const ohme = require('ohme');
const phoneListObj = {
tina: '555-1212',
sam: '444-4040',
jane: '777-1212'
}
Using the above phoneList object to get the phone number (value) by a person (key) use this code:
const phone = ohme.getVal(phoneListObj, 'jane') //returns '777-1212'
Using the above phoneList object to get the person (key) by a phone number (value) use this code:
const phone = ohme.getVal(phoneListObj, '777-1212') //returns 'jane'
npm test
If you would like to contribute code, please do the following:
- Fork this repository and make your changes.
- Write tests for any new functionality or bug fixes.
- Add your name to the "contributors" section in the
package.json
file. - Squash all of your commits into a single commit via
git rebase -i
. - Run the tests by running
npm install && make test
from the source directory. - When those pass, send the Pull Request off to me for review!
Please do not iterate the package.json version number – I will do that myself when I publish it to NPM.
Please follow this simple style-guide for all code contributions:
- Indent using spaces.
- camelCase all callables.
- Use semi-colons.
- Place a space after a conditional or function name, and its conditions/arguments.
function (...) {...}
- 0.1.0 Initial release