
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
resolve-value
Advanced tools
Deeply resolve all promises in a value.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm (requires Node.js >=10):
$ npm install --save resolve-value
const resolve = require('resolve-value');
assert.equal(await resolveValue(10), 10); //=> 10
assert.equal(await resolveValue(Promise.resolve(10)), 10); //=> 10
Functions
By default all functions are called.
assert.equal(await resolveValue(() => Promise.resolve(10)), 10); //=> 10
assert.equal(await resolveValue(async () => Promise.resolve(10)), 10); //=> 10
Pass a custom replacer function as the second argument to override this behavior.
const obj = { fn: () => 'do nothing', num: Promise.resolve(10) };
const result = await resolveValue(obj, (value, parent) => {
if (parent && parent.someKey === true) {
return value;
}
return value();
});
console.log(result.fn); //=> [Function: fn]
Objects
Resolves all property values, including functions.
const obj = { foo: async () => delay('bar', 10), num: Promise.resolve(10) };
const actual = await resolve(obj);
//=> { foo: 'bar', num: 10 }
Deeply nested
const obj = { foo: async () => delay('bar', 10), num: Promise.resolve(10) };
const arr = [obj, Promise.resolve(1), Promise.resolve(() => 2)];
const actual = await resolve(arr);
//=> [ { foo: 'bar', num: 10 }, 1, 2 ]
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Jon Schlinkert
Copyright © 2021, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on April 19, 2021.
FAQs
Deeply resolve all promises in a value.
We found that resolve-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.