@kba/anno-util-loaders
Loaders for processors
Last updated 2 years ago by kba .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @kba/anno-util-loaders 
SYNC missed versions from official npm registry.

anno-util-loaders

Wrappers to configure processors

class myprocessor {
  constructor(data) {
    this.data = data
  }
}
const {StaticLoader,ConfigReloader} = require('@kba/anno-util-loaders')
process.env.ANNO_MYPROC_FILE='/path/to/config.json'
const myprocessorFromFile = ConfigReloader(myprocessor, 'MYPROC_FILE')
const proc = myprocessorFromFile()
// proc will be initialized once with the data parsed from '/path/to/config.json' and
// re-initialized whenever the configuration file changes

StaticLoader(processorClass, envyconfVar, defaultValue='')

Load configuration once by parsing the contents of the config variable as JSON. Fall back to defaultValue.

ConfigReloader(processorClass, envyconfVar)

Load configuration once from a file and then for every change again.

Current Tags

  • 0.0.8                                ...           latest (2 years ago)

4 Versions

  • 0.0.8                                ...           2 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 4
Last Month 5
Dependencies (5)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |