{"id":22021509,"url":"https://github.com/lamansky/nearest-number","last_synced_at":"2026-04-11T01:42:25.613Z","repository":{"id":57309562,"uuid":"112176015","full_name":"lamansky/nearest-number","owner":"lamansky","description":"From a list of numbers, picks the one closest to a given target. Packaged as a Node.js module.","archived":false,"fork":false,"pushed_at":"2017-11-27T10:08:54.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T17:49:04.891Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-27T09:32:16.000Z","updated_at":"2017-11-27T10:09:16.000Z","dependencies_parsed_at":"2022-09-07T23:40:24.124Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/nearest-number","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/lamansky%2Fnearest-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fnearest-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fnearest-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fnearest-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/nearest-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245084991,"owners_count":20558320,"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-11-30T06:12:22.668Z","updated_at":"2026-04-11T01:42:19.585Z","avatar_url":"https://github.com/lamansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nearest-number\n\nFrom a list of numbers, picks the one closest to a given target. Packaged as a Node.js module.\n\n## Installation\n\n```bash\nnpm install nearest-number --save\n```\n\n## Usage\n\n```javascript\nconst nearestNumber = require('nearest-number')\n\n// Out of the numbers in the list, the number nearest to 13 is 10\nnearestNumber([10, 25, 30], 13) // 10\n\n// Returns the index of 10 in the array\nnearestNumber([10, 25, 30], 13, {returnIndex: true}) // 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fnearest-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fnearest-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fnearest-number/lists"}