{"id":22576946,"url":"https://github.com/danvc/theorem","last_synced_at":"2025-03-28T15:45:03.332Z","repository":{"id":51655381,"uuid":"229107530","full_name":"danvc/theorem","owner":"danvc","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-11T01:17:56.000Z","size":65,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T15:55:50.785Z","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/danvc.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":"2019-12-19T17:37:43.000Z","updated_at":"2019-12-19T18:25:56.000Z","dependencies_parsed_at":"2022-08-22T19:20:55.973Z","dependency_job_id":null,"html_url":"https://github.com/danvc/theorem","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/danvc%2Ftheorem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Ftheorem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Ftheorem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Ftheorem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvc","download_url":"https://codeload.github.com/danvc/theorem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246057955,"owners_count":20717020,"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-12-08T04:10:19.851Z","updated_at":"2025-03-28T15:45:03.312Z","avatar_url":"https://github.com/danvc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# theorem\n\n## The problem\nWrite some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -\u0026gt; [1,2,3,4]. \n\n## Prerequisits for testing\nMake sure that all dependencies for tests are available. Run:\n```\nyarn install\n```\n\n## How to test\n```\nyarn test\n```\n\n## The implementation\nThere are `2` implementations for this problem. One (`lazyFlatArray`) is using the very familiar method called `reduce` from the `Array` which reduces each elements to a initial value that is an empty `[]`.\n\nThe second (`fasterFlatArray`) method is a function that runs through the array which could be calling itself (recursively) to do a deeper flatten in the array.\n\nThe `fastFlatArray` is faster than the `reducer` method in almost 100%;\n\nThere is a `third` method called `createsNestedArray` which creates random nested arrays (that may contain numbers or, array of (numbers||array)\n\n## The tests covering\nThe test cover the following scenarios:\n- [x] pass theorem test using lazyFlatArray(); \n- [x] pass theorem test using fastFlatArray(); \n- [x] lazyFlatArray() pass over 1000 tests; \n- [x] fasterFlatArray() pass over 1000 tests;\n- [x] fasterFlatArray() is faster than lazyFlatArray() method;\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvc%2Ftheorem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvc%2Ftheorem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvc%2Ftheorem/lists"}