{"id":15743797,"url":"https://github.com/jonschlinkert/resolve-value","last_synced_at":"2025-03-13T10:31:00.894Z","repository":{"id":57354692,"uuid":"359433279","full_name":"jonschlinkert/resolve-value","owner":"jonschlinkert","description":"Deeply resolve promises in a value, including all properties of an object.","archived":false,"fork":false,"pushed_at":"2021-04-19T11:29:22.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T19:51:45.225Z","etag":null,"topics":["all","array","async","await","function","hydrate","javascript","jonschlinkert","node","nodejs","object","promise","properties","resolve","value","values"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["jonschlinkert","doowb"]}},"created_at":"2021-04-19T11:23:27.000Z","updated_at":"2022-03-16T04:26:22.000Z","dependencies_parsed_at":"2022-09-12T03:40:19.426Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/resolve-value","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fresolve-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fresolve-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fresolve-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fresolve-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/resolve-value/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243385898,"owners_count":20282644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["all","array","async","await","function","hydrate","javascript","jonschlinkert","node","nodejs","object","promise","properties","resolve","value","values"],"created_at":"2024-10-04T03:21:25.920Z","updated_at":"2025-03-13T10:31:00.608Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","readme":"# resolve-value [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/jonathanschlinkert?locale.x=en_US) [![NPM version](https://img.shields.io/npm/v/resolve-value.svg?style=flat)](https://www.npmjs.com/package/resolve-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/resolve-value.svg?style=flat)](https://npmjs.org/package/resolve-value) [![NPM total downloads](https://img.shields.io/npm/dt/resolve-value.svg?style=flat)](https://npmjs.org/package/resolve-value)\n\n\u003e Deeply resolve all promises in a value.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/) (requires [Node.js](https://nodejs.org/en/) \u003e=10):\n\n```sh\n$ npm install --save resolve-value\n```\n\n## Usage\n\n```js\nconst resolve = require('resolve-value');\n```\n\n### Examples\n\n```js\nassert.equal(await resolveValue(10), 10); //=\u003e 10\nassert.equal(await resolveValue(Promise.resolve(10)), 10); //=\u003e 10\n```\n\n**Functions**\n\nBy default all functions are called.\n\n```js\nassert.equal(await resolveValue(() =\u003e Promise.resolve(10)), 10); //=\u003e 10\nassert.equal(await resolveValue(async () =\u003e Promise.resolve(10)), 10); //=\u003e 10\n```\n\nPass a custom replacer function as the second argument to override this  behavior.\n\n```js\nconst obj = { fn: () =\u003e 'do nothing', num: Promise.resolve(10) };\n\nconst result = await resolveValue(obj, (value, parent) =\u003e {\n  if (parent \u0026\u0026 parent.someKey === true) {\n    return value;\n  }\n  return value();\n});\n\nconsole.log(result.fn); //=\u003e [Function: fn]\n```\n\n**Objects**\n\nResolves all property values, including functions.\n\n```js\nconst obj = { foo: async () =\u003e delay('bar', 10), num: Promise.resolve(10) };\nconst actual = await resolve(obj);\n//=\u003e { foo: 'bar', num: 10 }\n```\n\n**Deeply nested**\n\n```js\nconst obj = { foo: async () =\u003e delay('bar', 10), num: Promise.resolve(10) };\nconst arr = [obj, Promise.resolve(1), Promise.resolve(() =\u003e 2)];\n\nconst actual = await resolve(arr);\n//=\u003e [ { foo: 'bar', num: 10 }, 1, 2 ]\n```\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning 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:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 19, 2021._\n","funding_links":["https://github.com/sponsors/jonschlinkert","https://github.com/sponsors/doowb","https://paypal.me/jonathanschlinkert?locale.x=en_US"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fresolve-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fresolve-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fresolve-value/lists"}