{"id":16351193,"url":"https://github.com/samverschueren/rfpify","last_synced_at":"2025-03-23T01:30:43.010Z","repository":{"id":65490067,"uuid":"44168026","full_name":"SamVerschueren/rfpify","owner":"SamVerschueren","description":"[DEPRECATED] Promisify a result-first callback function.","archived":false,"fork":false,"pushed_at":"2017-06-05T19:45:32.000Z","size":6,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T18:03:11.250Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamVerschueren.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}},"created_at":"2015-10-13T10:08:57.000Z","updated_at":"2018-02-03T16:32:51.000Z","dependencies_parsed_at":"2023-01-25T17:45:16.136Z","dependency_job_id":null,"html_url":"https://github.com/SamVerschueren/rfpify","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamVerschueren%2Frfpify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamVerschueren%2Frfpify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamVerschueren%2Frfpify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamVerschueren%2Frfpify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamVerschueren","download_url":"https://codeload.github.com/SamVerschueren/rfpify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244952799,"owners_count":20537474,"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-11T01:08:51.286Z","updated_at":"2025-03-23T01:30:42.690Z","avatar_url":"https://github.com/SamVerschueren.png","language":"JavaScript","readme":"# rfpify\n\n\u003e Promisify a result-first callback-style function.\n\n---\n\n\u003cp align=\"center\"\u003e\u003cb\u003eDeprecated\u003c/b\u003e in favour of \u003ca href=\"https://github.com/sindresorhus/pify\"\u003epify\u003c/a\u003e with the \u003ca href=\"https://github.com/sindresorhus/pify#errorfirst\"\u003eerrorFirst\u003c/a\u003e option.\u003c/p\u003e\n\n---\n\n\n## Install\n\n```\n$ npm install --save rfpify\n```\n\n\n## Usage\n\n```js\nconst rfpify = require('rfpify');\n\nrfpify(stream.once.bind(stream))('data').then(data =\u003e {\n\t// handle data\n});\n```\n\n\n## API\n\n### rfpify(input, [promiseModule], [options])\n\nReturns a promise wrapped version of the supplied function or module.\n\n#### input\n\nType: `function`, `object`\n\nResult-first callback-style function.\n\n#### promiseModule\n\nType: `function`\n\nCustom promise module to use instead of the native one.\n\nCheck out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill.\n\n#### options\n\n##### multiArgs\n\nType: `boolean`\nDefault: `false`\n\nBy default, the promisified function will only return the first argument from the callback, which works fine for most APIs. Turning this on will make it return an array of\nall arguments from the callback, instead of just the first argument.\n\n##### include\n\nType: `array` of (`string`|`regex`)\n\nMethods in a module to promisify. Remaining methods will be left untouched.\n\n##### exclude\n\nType: `array`\nDefault: `[/.+Sync$/]`\n\nMethods in a module **not** to promisify. Methods with names ending with 'Sync' are excluded by default.\n\n##### excludeMain\n\nType: `boolean`\nDefault: `false`\n\nBy default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module.\n\n```js\nconst rfpify = require('rfpify');\n\nfunction fn() {\n\treturn true;\n}\n\nfn.method = (data, callback) =\u003e {\n\tsetImmediate(() =\u003e {\n\t\tcallback(data);\n\t});\n};\n\n// promisify methods but not fn()\nconst promiseFn = rfpify.all(fn, {excludeMain: true});\n\nif (promiseFn()) {\n\tpromiseFn.method('hi').then(data =\u003e {\n\t\tconsole.log(data);\n\t});\n}\n```\n\n## Related\n\n- [pify](https://github.com/sindresorhus/pify) - Promisify a callback-style function\n\n## License\n\nMIT © [Sam Verschueren](http://github.com/SamVerschueren)\n","funding_links":[],"categories":["Packages","包"],"sub_categories":["Control flow Promises","Control flow"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamverschueren%2Frfpify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamverschueren%2Frfpify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamverschueren%2Frfpify/lists"}