{"id":16231562,"url":"https://github.com/hustcc/evenly","last_synced_at":"2025-08-17T21:12:35.897Z","repository":{"id":57231163,"uuid":"83257379","full_name":"hustcc/evenly","owner":"hustcc","description":":sweat_drops: How to divide the gold evenly? No surplus. 怎么均匀并且无遗漏的分配黄金？","archived":false,"fork":false,"pushed_at":"2017-03-02T02:53:47.000Z","size":6,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-09T05:50:27.575Z","etag":null,"topics":["allocate","average","divide","evenly","gold","robbers"],"latest_commit_sha":null,"homepage":"http://git.hust.cc/evenly/","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/hustcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-27T01:56:21.000Z","updated_at":"2018-08-21T12:16:10.000Z","dependencies_parsed_at":"2022-09-04T15:04:41.189Z","dependency_job_id":null,"html_url":"https://github.com/hustcc/evenly","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hustcc/evenly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fevenly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fevenly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fevenly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fevenly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hustcc","download_url":"https://codeload.github.com/hustcc/evenly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fevenly/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270572690,"owners_count":24608835,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["allocate","average","divide","evenly","gold","robbers"],"created_at":"2024-10-10T13:06:06.527Z","updated_at":"2025-08-17T21:12:35.829Z","avatar_url":"https://github.com/hustcc.png","language":"JavaScript","readme":"# evenly\n\n\u003e **evenly** is a simple javascript library to solve problem which is similar to **how to divide the gold evenly?**\n\n**Q**: How **3 robbers** to divide **100 gold**?\n\n**A**: 100 / 3 can not solve it. But evenly can, **`evenly(100, 3)`** can get `[33.34, 33.33, 33.33]`. Done ^_^.\n\n[![Build Status](https://travis-ci.org/hustcc/evenly.svg?branch=master)](https://travis-ci.org/hustcc/evenly) [![npm](https://img.shields.io/npm/v/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly) [![npm](https://img.shields.io/npm/dt/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly) [![npm](https://img.shields.io/npm/l/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly)\n\n\n# 1. Install\n\n\u003e **npm install evenly**\n\nThen import it.\n\n```js\nvar evenly = require('evenly');\n//or\nimport evenly from 'evenly';\n```\n\nThen use **evenly(gold, robber, fixed=2)** API.\n\n```js\n// 3 robber divide 100 golds, with 2 decimal.\nevenly(100, 3, 1); // will return [33.4, 33.3, 33.3];\n\nevenly(100, 6); // will return [16.67, 16.67, 16.67, 16.67, 16.66, 16.66];\n```\n\n\n# 2. API\n\nThe unique API is: **evenly(gold, robber, fixed=2)**.\n\n - **gold** (Number): the number of gold.\n - **robber** (Number): the number of robber who will divide the gold.\n - **fixed** (Number): the decimal length, default is `2`.\n\nThe api return the array which shows how to divide the gold evenly.\n\n\n# 3. Build \u0026 Test\n\n\u003e npm install\n\n\u003e npm run build\n\n\u003e npm test\n\n\n# 4. LICENSE\n\nMIT @[hustcc](https://github.com/hustcc)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fevenly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhustcc%2Fevenly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fevenly/lists"}