{"id":21297490,"url":"https://github.com/fvdm/nodejs-fibonacci","last_synced_at":"2025-07-04T11:39:50.823Z","repository":{"id":3287530,"uuid":"4328294","full_name":"fvdm/nodejs-fibonacci","owner":"fvdm","description":"Return any (big) fibonacci number","archived":false,"fork":false,"pushed_at":"2024-04-02T16:36:54.000Z","size":200,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2024-11-14T09:05:12.650Z","etag":null,"topics":["fibonacci","iteration","math","nodejs","unlicense"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fibonacci","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fvdm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"franklin"}},"created_at":"2012-05-14T19:58:33.000Z","updated_at":"2022-05-18T23:19:52.000Z","dependencies_parsed_at":"2024-06-11T21:32:38.798Z","dependency_job_id":null,"html_url":"https://github.com/fvdm/nodejs-fibonacci","commit_stats":{"total_commits":248,"total_committers":8,"mean_commits":31.0,"dds":0.05241935483870963,"last_synced_commit":"7351522e7b808eaac0d0358fff26567dccd2b47e"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvdm%2Fnodejs-fibonacci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvdm%2Fnodejs-fibonacci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvdm%2Fnodejs-fibonacci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvdm%2Fnodejs-fibonacci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvdm","download_url":"https://codeload.github.com/fvdm/nodejs-fibonacci/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225708244,"owners_count":17511634,"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":["fibonacci","iteration","math","nodejs","unlicense"],"created_at":"2024-11-21T14:37:43.040Z","updated_at":"2025-07-04T11:39:50.803Z","avatar_url":"https://github.com/fvdm.png","language":"JavaScript","funding_links":["https://ko-fi.com/franklin"],"categories":[],"sub_categories":[],"readme":"fibonacci\n=========\n\nModule for [node.js](https://nodejs.org/) to calculate fibonacci numbers for one or\nendless iterations, until you run out of memory.\n\n[![npm](https://img.shields.io/npm/v/fibonacci.svg?maxAge=3600)](https://github.com/fvdm/nodejs-fibonacci/releases)\n[![Build Status](https://github.com/fvdm/nodejs-fibonacci/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/fvdm/nodejs-fibonacci/actions/workflows/node.js.yml)\n[![Coverage Status](https://coveralls.io/repos/github/fvdm/nodejs-fibonacci/badge.svg?branch=master)](https://coveralls.io/github/fvdm/nodejs-fibonacci?branch=master)\n\nUsing the [bn.js](https://www.npmjs.com/package/bn.js) module it can return numbers\nof any size without being limited by the hardcoded javascript `Number.MAX_LIMIT`.\n\n\n## Usage\n\n### Just one\n\nFind one fibonacci number at 3000 iterations:\n\n```js\nconst fibonacci = require ('fibonacci');\nconst bigNumber = fibonacci.iterate (3000);\nconsole.log (bigNumber);\n```\n\nResult:\n\n```js\n{ number: '410615886307971260333568378719267105220125108637369252408885430926905584274113403731330491660850044560830036835706942274588569362145476502674373045446852160486606292497360503469773453733196887405847255290082049086907512622059054542195889758031109222670849274793859539133318371244795543147611073276240066737934085191731810993201706776838934766764778739502174470268627820918553842225858306408301661862900358266857238210235802504351951472997919676524004784236376453347268364152648346245840573214241419937917242918602639810097866942392015404620153818671425739835074851396421139982713640679581178458198658692285968043243656709796000',\nlength: 627,\niterations: '3000',\nms: 208 }\n```\n\n\n### Many numbers\n\nGet all numbers up to 4 seconds.\n\n\u003e [!CAUTION]\n\u003e It is very important that you run the `iterate()` function AFTER the `.on('result')` event,\n\u003e otherwise the iteration will continue forever without emitting the events!\n\n```js\nfibonacci.on ('result', num =\u003e {\n  console.log (`${num.iterations} / ${num.number}\\n`);\n\n  if (num.ms \u003e 4000) {\n    console.log ('Done!');\n    fibonacci.kill();\n  }\n});\n\n// run this AFTER everything\nfibonacci.iterate();\n```\n\nHere you see I use the **[result](#event-result)** event to catch each result,\nthe `num.ms` property to figure out how many milliseconds have passed\nand finally **[kill()](#method-kill)** to stop the iteration.\n\n\n## Installation\n\n`npm i fibonacci`\n\n\n## Methods\n\n### Method .iterate\n**( [max_iterations] )**\n\nRun the iteration\n\n\nargument         | type   | default | description\n:----------------|:-------|:--------|:-----------\n[max_iterations] | number |         | Limit iterations, otherwise continue forever\n\n\nWithout this argument it will continue untill **[kill()](#method-kill)** is called,\nthe process terminated or system ran out of memory.\n\n\n#### Returns\n\n_resultObject_ with these elements:\n\nproperty   | type    | description\n:----------|:--------|:-----------\nnumber     | string  | calculated number\nlength     | string  | number of digits\niterations | string  | amount of iterations to find number\nms         | integer | duration in milliseconds\n\n\n### Method .kill\n**( )**\n\nStop the iteration loop.\n\n\n## Events\n\n### Event result\n**( resultObject )**\n\nEmitted when a result is found.\n\n\n#### Callback\n\n_resultObject_ with these elements:\n\nproperty   | type    | description\n:----------|:--------|:-----------\nnumber     | string  | calculated number\nlength     | string  | number of digits\niterations | string  | amount of iterations to find number\nms         | integer | duration in milliseconds\n\n\n### Event done\n**( resultObject )**\n\nEmitted when `max_iterations` is reached,\nsee [Event result](#event-result) for details.\n\n\n## Unlicense\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \u003chttps://unlicense.org/\u003e\n\n\n## Author\n\n[Franklin](https://fvdm.com)\n| [Buy me a coffee](https://fvdm.com/donating)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvdm%2Fnodejs-fibonacci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvdm%2Fnodejs-fibonacci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvdm%2Fnodejs-fibonacci/lists"}