{"id":17034564,"url":"https://github.com/caub/acquire","last_synced_at":"2026-04-12T22:41:15.574Z","repository":{"id":151002924,"uuid":"70238392","full_name":"caub/acquire","owner":"caub","description":"async require","archived":false,"fork":false,"pushed_at":"2017-02-26T15:45:15.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T02:11:12.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-10-07T10:52:40.000Z","updated_at":"2017-02-26T15:42:36.000Z","dependencies_parsed_at":"2023-04-09T04:01:31.831Z","dependency_job_id":null,"html_url":"https://github.com/caub/acquire","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Facquire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Facquire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Facquire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Facquire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caub","download_url":"https://codeload.github.com/caub/acquire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245026042,"owners_count":20549073,"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":[],"created_at":"2024-10-14T08:43:58.206Z","updated_at":"2026-04-12T22:41:10.536Z","avatar_url":"https://github.com/caub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Async require\n\nThe syntax is like a classic CommonJS require, but it's asynchronous in the browser, so it works by adding yield (or await). Because of this, in this simple first version, it won't work when a require call is nested in a function.\n\nfile a.js:\n```js\nexports.PI = Math.PI;\nexports.rand = n =\u003e Math.floor(10*Math.random());\n```\nfile b.js:\n```js\nconst {PI} = require('./a');\nmodule.exports = deg =\u003e deg/180*PI;\n```\nfile c.js:\n```js\nconst [{rand}, toRadian] = require('./a', './b');\nconsole.log('random angle:', toRadian(rand(360)))\n```\n\ncould work on node with \n```js\nconst {parse: URL} = require('url');\nconst {readFile} = require('fs'), fetch=url=\u003enew Promise((res,rej)=\u003ereadFile(url, (err,data)=\u003eerr?rej(err):res({ text(){ return data }})));\n// window, location, ..\n```\n\n\n### Tests\n- https://caub.github.io/acquire/test.html\n- https://caub.github.io/acquire/demo\n- https://caub.github.io/todo-list/\n\n\n\u003csub\u003einspired by [1](https://gist.github.com/caub/cf82c451120373dc1568#file-main-js)\u003c/sub\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaub%2Facquire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaub%2Facquire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaub%2Facquire/lists"}