{"id":16482488,"url":"https://github.com/f/puremise.js","last_synced_at":"2025-10-27T17:31:54.759Z","repository":{"id":11591124,"uuid":"14081993","full_name":"f/puremise.js","owner":"f","description":"Yet another purely functional Promise Monad implementation","archived":false,"fork":false,"pushed_at":"2016-05-30T07:23:51.000Z","size":124,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T07:23:07.856Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f.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}},"created_at":"2013-11-03T07:54:31.000Z","updated_at":"2021-05-31T19:14:17.000Z","dependencies_parsed_at":"2022-08-20T17:50:39.971Z","dependency_job_id":null,"html_url":"https://github.com/f/puremise.js","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/f%2Fpuremise.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fpuremise.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fpuremise.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fpuremise.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f","download_url":"https://codeload.github.com/f/puremise.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238535851,"owners_count":19488605,"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-11T13:10:59.333Z","updated_at":"2025-10-27T17:31:54.372Z","avatar_url":"https://github.com/f.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"puremise.js\n===========\n\nYet another purely functional Promise Monad implementation. I tried to implement it obeying functional programming rules.\n\n[Implementation Details in Turkish](http://blog.fatihak.in/fonksiyonel-programlama-notlari-promise-monad-pure-functional/)\n\n## Examples\n\n```javascript\nx = Promise(function () {\n  console.log(\"x resolved\");\n})\n\nx.success(function () {\n  console.log(\"x resolved again..\");\n});\n\nx.success(function () {\n  console.log(\"x resolved again and again..\");\n});\n\ny = Promise().success(function () {\n  console.log(\"y resolved\");\n});\n\ny.fail(function () {\n  console.log(\"y rejected\");\n});\n\nWhen([x, y]).success(function () {\n  console.log(\"x and y all resolved\");\n});\n```\n\nResolve the promises:\n\n```javascript\nx.resolve(); //=\u003e \"x resolved\", \"x resolved again..\", \"x resolved again and again..\"\n\ny.resolve(); //=\u003e \"y resolved\", \"x and y all resolved\"\n```\n\nAnd it can be rejected, too:\n\n```javascript\nWhen([x, y]).success(function () {\n  console.log(\"x and y all resolved\");\n}).fail(function () {\n  console.log(\"something rejected!\");\n});\n\ny.reject(); //=\u003e \"something rejected!\"\n```\n\n## Async Usage\n\n```javascript\nfunction defer() {\n  var deferred = Promise();\n  setTimeout(deferred.resolve, 1000);\n  return deferred;\n}\n\ndefer().success(function () {\n  console.log(\"this will be resolved after 1 sec.!\");\n});\n\n// after 1 sec: =\u003e \"this will be resolved after 1 sec.!\"\n```\n\n## License\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff%2Fpuremise.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff%2Fpuremise.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff%2Fpuremise.js/lists"}