CombineKeys is a function that combines javascript objects key-wise. This module exposes a single function, combineKeys, which has the following interface:
oResult = combineKeys(oSource, oTarget, bMutate = false)
This is hungarian notation to indicate types, where "o" means "object" and "b" means "boolean". The = false part means that a) the argument isn't required, and b) the default is false.
The action of the function is to combine source and target into a new object that has the keys of both. What is different about combineKeys is that it strives to be lossless. Target values with the same key aren't replaced, but rather the source and target is combined a controlled way that "makes sense".
To be honest it's a very short function, and I recommend you read the source. The tests are also important.
>npm install --save combine-keys
var combineKeys = require('combineKeys')
[install node]
[open a terminal]
git checkout combine-keys
cd combine-keys
npm install
npm run test
npm browser
If you don't get errors in the terminal (npm run test
) or the browser console (npm browser
), then it works. You'll then want to edit combineKeys.js, and/or add tests to tests.js, then run npm run test
again. (Actually you should fork this repo, create a branch, edit the branch, cleanup the branch, run npm run lint
and issue a pull request. But that's beyond the scope of this document!)
Note that you'll also want to install an EditorConfig plugin into your editor.
Add code to allow direct inclusion into a browser (with script.src='combineKeys.js').- Write more tests, especially around mutation
Spruce this project up with tips from filipedeschamps/rss-feed-emitter#119Push to github.push to npmAdd http://editorconfig.org/Also see https://duckduckgo.com/?q=sublime+text+editorconfig see .editorconfigAdd http://eslint.org/npm run lint
see .eslintrcAdd babelnpm run build
see .babelrc - support es2015 (es6). outputs to combineKeys.build.js