{"id":24537445,"url":"https://github.com/paraself/random-weight","last_synced_at":"2025-03-16T01:22:47.239Z","repository":{"id":65479585,"uuid":"181918084","full_name":"paraself/random-weight","owner":"paraself","description":"Randomly pick an array item by weight callback","archived":false,"fork":false,"pushed_at":"2019-04-18T15:00:26.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T08:49:41.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/paraself.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-04-17T15:21:03.000Z","updated_at":"2022-10-30T07:07:37.000Z","dependencies_parsed_at":"2023-01-25T08:25:13.057Z","dependency_job_id":null,"html_url":"https://github.com/paraself/random-weight","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraself%2Frandom-weight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraself%2Frandom-weight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraself%2Frandom-weight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraself%2Frandom-weight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paraself","download_url":"https://codeload.github.com/paraself/random-weight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243811073,"owners_count":20351649,"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":"2025-01-22T14:12:43.948Z","updated_at":"2025-03-16T01:22:47.213Z","avatar_url":"https://github.com/paraself.png","language":"TypeScript","readme":"# random-weight\nRandomly pick an array item by weight callback\n\n### Usage\n```\nnpm i -S random-weight\n```\n\n``` typescript\nimport rnd from 'random-weight'\nlet items = [\n  {\n    name: 'Alex',\n    weight: 1\n  },\n  {\n    name: 'Jonny',\n    weight: 2\n  },\n  {\n    name: 'Tom',\n    weight: 3\n  }\n]\n\nconsole.log(rnd(items, i =\u003e i.weight).name, ' is picked')\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaself%2Frandom-weight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparaself%2Frandom-weight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaself%2Frandom-weight/lists"}