@compositor/util
v0.3.2
Published
Collection of node utilities for compositor apps
Readme
util 
Collection of node utilities for compositor apps.
Currently all utility functions are found in index.js.
We will likely move them into their own directories eventually.
installation
npm i -S @compositor/utilusage
timeNow()
const { timeNow } = require('@compositor/util')
timeNow() // => Time since epoch as integerhash(string, sha)
const { hash } = require('@compositor/util')
hash('foo') // => 'SOME SHA256 HEX'
hash('foo', '512') // => 'SOME SHA512 HEX'uuid
const { uuid } = require('@compositor/util')
uuid()envPostfix
Postfixes the NODE_ENV when not production.
Useful for dynamodb table names, etc.
const { envPostfix } = require('@compositor/util')
envPostfix('foobar') // => 'foobar-development'auth
This can be used to authenticate a request against the user table.
const auth = require('@compositor/util/auth')
auth(req)
.then(doStuff)
.catch(handleUnauth)license
MIT
contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Crafted with by (@getcompositor).
