{"id":20493221,"url":"https://github.com/segment-boneyard/human-intervals","last_synced_at":"2026-06-01T08:31:26.485Z","repository":{"id":28116373,"uuid":"31615218","full_name":"segment-boneyard/human-intervals","owner":"segment-boneyard","description":"Create clean, human friendly labels for a chart.","archived":false,"fork":false,"pushed_at":"2015-03-03T22:58:54.000Z","size":113,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-07-12T07:33:46.257Z","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/segment-boneyard.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2015-03-03T18:51:35.000Z","updated_at":"2019-02-06T23:35:53.000Z","dependencies_parsed_at":"2022-09-12T22:40:23.154Z","dependency_job_id":null,"html_url":"https://github.com/segment-boneyard/human-intervals","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/segment-boneyard/human-intervals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-boneyard%2Fhuman-intervals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-boneyard%2Fhuman-intervals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-boneyard%2Fhuman-intervals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-boneyard%2Fhuman-intervals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segment-boneyard","download_url":"https://codeload.github.com/segment-boneyard/human-intervals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-boneyard%2Fhuman-intervals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33767434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"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":[],"created_at":"2024-11-15T17:33:56.857Z","updated_at":"2026-06-01T08:31:26.467Z","avatar_url":"https://github.com/segment-boneyard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# human-intervals\n\n## Installation\n\n```\nnpm install human-intervals\n```\n\n```\ncomponent install segmentio/human-intervals\n```\n\n## Example\n\n```js\nvar humanize = require('human-intervals');\nvar assert = require('assert');\n\nvar values = [ 341, 12, 793, 42, 54, 591, 123, 271, 804 ];\nvar max = Math.max.apply(Math, values);\n\nassert.deepEqual(humanize({ segments: 2, value: max }).map(format), [ '0', '450', '900' ]);\nassert.deepEqual(humanize({ segments: 3, value: max }).map(format), [ '0', '300', '600', '900' ]);\nassert.deepEqual(humanize({ segments: 4, value: max }).map(format), [ '0', '210', '420', '630', '840' ]);\nassert.deepEqual(humanize({ segments: 5, value: max }).map(format), [ '0', '180', '360', '540', '720', '900']);\n\nvar values = [ 341, 12, 793, 42, 54, 591, 123, 271, 804, 1029 ].map(thousand);\nvar max = Math.max.apply(Math, values);\n\nassert.deepEqual(humanize({ segments: 2, value: max }).map(format), [ '0', '1M', '2M' ]);\nassert.deepEqual(humanize({ segments: 3, value: max }).map(format), [ '0', '400K', '800K', '1.2M' ]);\nassert.deepEqual(humanize({ segments: 4, value: max }).map(format), [ '0', '300K', '600K', '900K', '1.2M' ]);\nassert.deepEqual(humanize({ segments: 5, value: max }).map(format), [ '0', '400K', '800K', '1.2M', '1.6M', '2M']);\n\nfunction format(value) {\n  if (value \u003e 10e5) return (value / 10e5) + 'M'; // millions\n  if (value \u003e 10e2) return (value / 10e2) + 'K'; // thousands\n  return String(value); // \u003c= hundreds\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-boneyard%2Fhuman-intervals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegment-boneyard%2Fhuman-intervals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-boneyard%2Fhuman-intervals/lists"}