zengenti-utils
v0.3.0
Published
A collection of utils
Downloads
5
Readme
Utils
This module/repo contains a collection of general utilities.
add(Number, Number)
Example util for testing that this module works, and utils can be imported into external projects. It adds two numbers.
getSymbolDescription(Symbol)
This is used in PublishSubscribe module to get the string value passed into Symbol(string), which should be on the symbol.description property, but it is not in every environment, which is why this function was made.
hasKey(object:Object, key: String)
Returns Boolean, true if key is a key on object, else false.
structure/
The structure/ folder is for development, used as the input folder when utilizing https://www.npmjs.com/package/zengenti-make-component, when defining a new util.
Contribute
TLDR; If you want to add a util to this repository, export it in main.js and then publish with
sudo np
.
Guidelines:
Install make-component with
npm i zengenti-make-component -g
(only do this once).Clone and cd this repository to your local filesystem.
Run this command
make-component nameOfUtil src structure
and change nameOfUtil to the name of your utility. src is output directory, and structure is input directory.Paste and export your code from your src/nameOfUtil/nameOfUtil.js file.
Additionally, paste any existing test code, or write some new test code in the .test.js file. This uses mocha which should be sufficient for utils.
Add info about your util to the README.md file
export your util in main.js to expose it for use in external code which imports our 'zengenti-utils' module.
npm i
to install the repo, and thennpm run test
to run the tests. Check that they all pass before proceeding, else fix the issue.Kindly ask a colleague to review the changes / code, and push this to the remote git repo.
Publish the module zengenti-utils using
sudo np
(see np on github)
TODO
- Automate adding a new component more, so that it adds the import/export to main.js and makes an entry in README.md