{"id":21485703,"url":"https://github.com/bitofsky/promise.chain","last_synced_at":"2025-03-17T10:09:00.725Z","repository":{"id":65371313,"uuid":"69433219","full_name":"bitofsky/promise.chain","owner":"bitofsky","description":"Javascript promise-chain module","archived":false,"fork":false,"pushed_at":"2016-09-28T10:22:10.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T22:45:45.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bitofsky.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":"2016-09-28T06:32:30.000Z","updated_at":"2016-09-28T07:56:20.000Z","dependencies_parsed_at":"2023-01-20T00:19:54.357Z","dependency_job_id":null,"html_url":"https://github.com/bitofsky/promise.chain","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/bitofsky%2Fpromise.chain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitofsky%2Fpromise.chain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitofsky%2Fpromise.chain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitofsky%2Fpromise.chain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitofsky","download_url":"https://codeload.github.com/bitofsky/promise.chain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244014136,"owners_count":20383715,"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-11-23T13:17:08.883Z","updated_at":"2025-03-17T10:09:00.686Z","avatar_url":"https://github.com/bitofsky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promise.chain\nJavascript promise.chain module\n\n## How to use\n```\nnpm install promise.chain\n```\n\n## Reduce Promise depth\n\n### Using Promise\n``` Javascript\nfunction asyncProcess() {\n\n    return asyncProcess1().then(result1 =\u003e {\n\n        let promise;\n\n        if( result1 )\n            promise = asyncProcess2();\n        else\n            promise = asyncProcess3()\n                .then(() =\u003e asyncProcess4())\n                .then(() =\u003e asyncProcess5())\n                .then(() =\u003e asyncProcess6());\n\n        return promise.then(() =\u003e asyncProcessCommon());\n        \n    }).then(result =\u003e {\n        // next something..\n    }).catch(err =\u003e {\n        // error handling\n    });\n\n}\n```\n\n### Using promise.chain\n``` Javascript\nconst PromiseChain = require('promise.chain');\n\nfunction asyncProcess() {\n\n    const oChain = new PromiseChain();\n\n    oChain.then = () =\u003e asyncProcess1();\n    oChain.then = result1 =\u003e {\n\n        const oSubChain = new PromiseChain();\n\n        if( result1 )\n            oSubChain.then = () =\u003e asyncProcess2();\n        else {\n            oSubChain.then = () =\u003e asyncProcess3();\n            oSubChain.then = () =\u003e asyncProcess4();\n            oSubChain.then = () =\u003e asyncProcess5();\n            oSubChain.then = () =\u003e asyncProcess6();\n        }\n\n        oSubChain.then = () =\u003e asyncProcessCommon();\n\n        return oSubChain;\n        \n    };\n    oChain.then = result =\u003e {\n        // next something..\n    };\n    oChain.catch = err =\u003e {\n        // error handling\n    };\n\n    return oChain;\n\n}\n```\n\n# License\nMIT License\n\nCopyright (c) 2016 Bum-Seok Hwang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitofsky%2Fpromise.chain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitofsky%2Fpromise.chain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitofsky%2Fpromise.chain/lists"}