{"id":16845255,"url":"https://github.com/jimmywarting/lazy-resolver","last_synced_at":"2025-04-11T06:28:53.705Z","repository":{"id":66150049,"uuid":"91693987","full_name":"jimmywarting/lazy-resolver","owner":"jimmywarting","description":"Skip hoops with promises, make async code sync-ish looking (it is still async)","archived":false,"fork":false,"pushed_at":"2022-09-27T14:55:04.000Z","size":6,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T23:13:01.407Z","etag":null,"topics":["async","chain","javascript","promise"],"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/jimmywarting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-18T13:04:38.000Z","updated_at":"2022-09-28T02:40:46.000Z","dependencies_parsed_at":"2023-02-22T16:30:29.777Z","dependency_job_id":null,"html_url":"https://github.com/jimmywarting/lazy-resolver","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"afa1fa65afcfc2921616c38d311bd8486d1fb7e9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmywarting%2Flazy-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmywarting%2Flazy-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmywarting%2Flazy-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmywarting%2Flazy-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimmywarting","download_url":"https://codeload.github.com/jimmywarting/lazy-resolver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248354227,"owners_count":21089776,"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":["async","chain","javascript","promise"],"created_at":"2024-10-13T12:58:07.988Z","updated_at":"2025-04-11T06:28:53.686Z","avatar_url":"https://github.com/jimmywarting.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lazy-resolver\nSkip hoops with promises\n\n```bash\nnpm install lazy-resolver\n```\nDo you know how lodash _.get works or angulars $parse works?\nthis lib is kind of like that, you can test deep objects/path\nbut it dose it with promises and by chaining a dummy function\nto evaluate the code when a promise has been resolved\n\n# Example:\n\n```js\nconst resolve = require('lazy-resolver') // This is a Proxy handler\nconst fetch = resolve(import('node-fetch')).default\n\nfetch(url)\n  .then(response =\u003e console.log(response))\n```\n\nGo beond what's possible and make promise chain sync-ish looking\n```js\n// Node variant\nconst fetch = resolve(import('node-fetch')).default\nfetch('https://httpbin.org/get?items=4\u0026items=2')\n  .json()\n  .args\n  .items\n  .map(n =\u003e ~~n * 4)\n  .then(console.log, console.warn)\n\n// Browser variant\nresolve(window)\n  .fetch('https://httpbin.org/get?items=4\u0026items=2')\n  .json()\n  .args\n  .items\n  .map(n =\u003e ~~n * 4)\n  .forEach(n =\u003e console.log(n))\n```\n\nTest if obj exist, similar to lodash/get or optional chaining\n```js\nconst obj = {}\nexist = await resolve(obj).foo.bar().buz[28]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmywarting%2Flazy-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimmywarting%2Flazy-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmywarting%2Flazy-resolver/lists"}