{"id":16376498,"url":"https://github.com/bengl/pifall","last_synced_at":"2025-09-16T14:30:46.673Z","repository":{"id":57324053,"uuid":"102088276","full_name":"bengl/pifall","owner":"bengl","description":"promisifyAll, in terms of util.promisify","archived":false,"fork":false,"pushed_at":"2020-01-03T04:41:46.000Z","size":16,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T04:12:10.409Z","etag":null,"topics":["javscript","promise","promises","promisify","promisifyall"],"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/bengl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-01T07:52:04.000Z","updated_at":"2020-08-27T21:33:31.000Z","dependencies_parsed_at":"2022-09-15T15:23:14.430Z","dependency_job_id":null,"html_url":"https://github.com/bengl/pifall","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fpifall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fpifall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fpifall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fpifall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bengl","download_url":"https://codeload.github.com/bengl/pifall/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232796860,"owners_count":18577973,"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":["javscript","promise","promises","promisify","promisifyall"],"created_at":"2024-10-11T03:24:54.842Z","updated_at":"2025-09-16T14:30:41.343Z","avatar_url":"https://github.com/bengl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pifall\n\n[![Build Status](https://travis-ci.org/bengl/pifall.svg?branch=master)](https://travis-ci.org/bengl/pifall)\n\n**`pifall`** is an implementation of `promisifyAll` in terms of Node 8's\nincluded [`util.promisify`](https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original).\n\nThat is, it will iterate over your object's properties (`Reflect.ownKeys`), and\nmake an `Async`-suffixed copy of any functions it finds. If it runs into a\ngetter, it will create the `Async` version, which will grab the value from the\ngetter, and work as normal, if the value ends up being a function. Otherwise it\nwill throw.\n\nThe `Async`-suffixed versions are as returned by `util.promisify`.\n\nIn the event that you already have a `foo` and a `fooAsync`, the `fooAsync` will\nbe overwritten. If it's not writable, or not configurable, `pifall` will make no\nattempt to circumvent that, meaning it will throw.\n\nNote that `pifall` operates **in-place** on the object. It does not return\nanything, and the original object is augmented with the new methods.\n\n`pifall` will flat-out refuse to promisify a built-in prototype, even it it's in\na prototype chain when the `proto` option is provided. It will also flat-out\nrefuse to promisify objects whose `typeof` is not `function` or `object`. It\nwill do this by throwing a `TypeError`.\n\nOn versions of Node not supporting `util.promisify`, a polyfill is used.\n\n### Usage\n\nExample:\n```\nconst obj = {\n  func (cb) {\n    setImmediate(() =\u003e {\n      cb(null, 'hello');\n    });\n  }\n}\n\nrequire('pifall')(obj);\n\nobj.funcAsync().then(result =\u003e console.assert(result === 'hello'));\n```\n\nIt can also take a second parameter, an optional options object, with the\nfollowing properties:\n\n* **`proto`**: If truthy, this causes `pifall` to include any properties\naccessible on the object, including those in its prototype chain. Default is\n`false`;\n* **`classes`**: If truthy, this causes `pifall` to treat functions whose names\nstart with a capital letter as \"classes\". That is, the function itself will not\nbe promisified, but its prototype will be `pifall`ed. (*Note: This does not\ncurrently work for functions retrieved via getters. No matter what, these are\ntreated as ordinary non-class functions. In practice, this doesn't come up a\nwhole lot.*) Default is false.\n* **`suffix`**: Sets the suffix for promisified versions of functions. Default\nis `'Async'`.\n* **`promisifier`**: Use custom promisifier instead of `util.promisify`\n\n### License\n\nMIT License. See LICENSE.txt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbengl%2Fpifall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbengl%2Fpifall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbengl%2Fpifall/lists"}