{"id":24535219,"url":"https://github.com/cebor/es-promisify","last_synced_at":"2025-09-02T11:37:56.806Z","repository":{"id":57227030,"uuid":"117003924","full_name":"cebor/es-promisify","owner":"cebor","description":"ES2015 Promisify Library","archived":false,"fork":false,"pushed_at":"2020-04-16T07:55:01.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T20:35:53.911Z","etag":null,"topics":["es2015","es6","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/cebor.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":"2018-01-10T19:54:52.000Z","updated_at":"2020-04-16T07:55:04.000Z","dependencies_parsed_at":"2022-09-04T15:05:01.005Z","dependency_job_id":null,"html_url":"https://github.com/cebor/es-promisify","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cebor%2Fes-promisify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cebor%2Fes-promisify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cebor%2Fes-promisify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cebor%2Fes-promisify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cebor","download_url":"https://codeload.github.com/cebor/es-promisify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243805681,"owners_count":20350768,"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":["es2015","es6","javascript","promise"],"created_at":"2025-01-22T12:16:09.964Z","updated_at":"2025-03-15T23:27:07.239Z","avatar_url":"https://github.com/cebor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ES2015 Promisify Library\n\n[![NPM version](https://img.shields.io/npm/v/es-promisify.svg)](https://npmjs.org/package/es-promisify)\n[![NPM downloads](https://img.shields.io/npm/dt/es-promisify.svg)](https://npmjs.org/package/es-promisify)\n[![Build Status](https://travis-ci.org/cebor/es-promisify.svg?branch=master)](https://travis-ci.org/cebor/es-promisify)\n\nThis library enables node-styled functions to work as [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Promise)s through the use of ES2015 syntax.\n\n## Examples\n\n### Single-valued callback with multiple parameters\n\nFor a snipped like the following:\n\n```javascript\n'use strict';\n\nconst Promisify = require('es-promisify');\n\n// Test a promise that returns a single value\nfunction sum (a, b, callback) {\n    callback(null, a + b);\n}\n\nasync function main () {\n    let sumPromise = Promisify(sum);\n    console.log(await sumPromise(2, 2));\n}\n\nmain();\n```\n\nWe'd expect to have an output like this one:\n\n```bash\n4\n```\n\n## Multiple-valued output with multiple arguments\n\nFor a snippet like the following\n\n```javascript\n'use strict';\n\nconst Promisify = require('es-promisify');\n\n// Test return of multiple values\nfunction multiOutput (a, b, callback) {\n    callback(null, a, b);\n}\n\nasync function main () {\n    let multiOutputPromise = Promisify(multiOutput);\n    console.log(await multiOutputPromise('a', 'b');\n}\n\nmain();\n```\n\nWe'd expect to have an output like this one:\n\n```bash\n['a', 'b']\n```\n\n## Function bound to an object state\n\nFor a snippet like the following:\n\n```javascript\n'use strict';\n\nconst Promisify = require('es-promisify');\n\n// Test binding of methods inside objects\nclass Bindable {\n    constructor () {\n        this._prop = 3;\n    }\n\n    get prop () {\n        return this._prop;\n    }\n\n    increment (callback) {\n        this._prop += 1;\n        callback(null, this.prop);\n    }\n}\n\nasync function main () {\n    let bindable = new Bindable();\n    let incrementPromise = Promisify(bindable.increment, bindable);\n    console.log(await incrementPromise());\n}\n\nmain();\n```\n\nWe'd expect an output like this one:\n\n```bash\n4\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcebor%2Fes-promisify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcebor%2Fes-promisify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcebor%2Fes-promisify/lists"}