Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
resolve-vars
Advanced tools
Retrieving variables stored in a remote system can be painful, so resolve-vars
makes it simple to get and set values stored in Consul.
$ yarn add resolve-vars
or if using npm
:
$ npm install resolve-vars --save
Creating an instance of a variable resolver is simple:
const Resolver = require('resolve-vars');
const resolver = new Resolver();
Retrieving a value is an asynchronous action, as such, get
returns a promise
that resolves to the retrieved value if one existed.
resolver.get('foo/bar/baz')
.then((val) => {
console.log(`value is: ${val}`);
});
In some situations, you'll want to resolve variables in bulk, which is why
task
exists. task
returns a promise that resolves to the variables'
values (if found).
resolver.task([ 'foo/bar/baz', 'bizz/buzz' ])()
.then((vals) => {
console.log(vals);
});
This is especially useful in situations where you want to resolve a set of variables on startup, such as in Gulp.
gulp.task('resolve-vars', resolver.task([ 'foo/bar/baz', 'bizz/buzz' ]));
Setting a value is as simple as retrieving one with get. Set also returns a promise that resolves once the value is succcessfuly set, otherwise it rejects.
resolver.set('bizz/buzz', 'super')
.then(() => {
console.log('successfully set value')
}).catch((err) => {
console.log('failed to set value: ' + err);
});
FAQs
A simplified interface for resolving variables via Consul.
The npm package resolve-vars receives a total of 27 weekly downloads. As such, resolve-vars popularity was classified as not popular.
We found that resolve-vars demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 21 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.