{"id":18095308,"url":"https://github.com/sindresorhus/filled-array","last_synced_at":"2025-04-09T15:06:43.231Z","repository":{"id":44650206,"uuid":"45537166","full_name":"sindresorhus/filled-array","owner":"sindresorhus","description":"Returns an array filled with the specified input","archived":false,"fork":false,"pushed_at":"2022-07-08T11:26:14.000Z","size":15,"stargazers_count":42,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-09T15:06:40.510Z","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/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-11-04T12:20:44.000Z","updated_at":"2025-01-07T20:11:16.000Z","dependencies_parsed_at":"2022-09-11T01:10:20.931Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/filled-array","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffilled-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffilled-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffilled-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffilled-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/filled-array/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"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-31T19:09:47.326Z","updated_at":"2025-04-09T15:06:43.212Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# filled-array\n\n\u003e Returns an array filled with the specified input\n\n## Install\n\n```sh\nnpm install filled-array\n```\n\n## Usage\n\n```js\nimport filledArray from 'filled-array';\n\nfilledArray('x', 3);\n//=\u003e ['x', 'x', 'x']\n\nfilledArray(0, 3);\n//=\u003e [0, 0, 0]\n\nfilledArray(index =\u003e {\n\treturn (++index % 3 ? '' : 'Fizz') + (index % 5 ? '' : 'Buzz') || index;\n}, 15);\n//=\u003e [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz']\n```\n\n## API\n\n### filledArray(fillValue, count)\n\n#### fillValue\n\nType: `unknown`\n\nThe value to fill the array with.\n\nYou can pass a function to generate the array items dynamically. The function is expected to return the value for each iteration and will be called with the following arguments: index, the count you passed in, and the filled array thus far.\n\n#### count\n\nType: `number` *(non-negative integer)*\n\nThe number of items to fill the array with.\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["模块","Modules"],"sub_categories":["数组","Array"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ffilled-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Ffilled-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ffilled-array/lists"}