{"id":18320094,"url":"https://github.com/atlassubbed/atlas-median","last_synced_at":"2025-04-09T14:23:43.895Z","repository":{"id":57186088,"uuid":"141076386","full_name":"atlassubbed/atlas-median","owner":"atlassubbed","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-16T02:47:33.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T08:21:47.894Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atlassubbed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-16T02:22:49.000Z","updated_at":"2018-07-16T02:47:34.000Z","dependencies_parsed_at":"2022-09-14T09:50:23.143Z","dependency_job_id":null,"html_url":"https://github.com/atlassubbed/atlas-median","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassubbed%2Fatlas-median","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassubbed%2Fatlas-median/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassubbed%2Fatlas-median/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassubbed%2Fatlas-median/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atlassubbed","download_url":"https://codeload.github.com/atlassubbed/atlas-median/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054313,"owners_count":21039976,"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-05T18:15:09.536Z","updated_at":"2025-04-09T14:23:43.877Z","avatar_url":"https://github.com/atlassubbed.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# atlas-median\n\nCalculates the median of a set of data points in-place.\n\n[![Travis](https://img.shields.io/travis/atlassubbed/atlas-median.svg)](https://travis-ci.org/atlassubbed/atlas-median)\n\n---\n\n## install\n\n```\nnpm install --save atlas-median\n```\n\n## why\n\nBreaking up [atlas-dataset](https://github.com/atlassubbed/atlas-dataset#readme) into standalone functions. This module computes the median value over an array of numbers:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"median(V) = (v[ceil(|V|/2)] + v[ceil((|V|+1)/2)])/2\" src=\"docs/median.png\"\u003e\n\u003c/p\u003e\n\n## examples\n\n#### unsorted array\n\nThe `median` function sorts the array in-place before taking the middle value. In the case of an even-length array, the median is the mean of the two middle values.\n\n```javascript\nconst median = require(\"atlas-median\")\nconsole.log(median([4,3,1,2]))\n// 2.5\n```\n\n#### sorted array\n\nTo avoid sorting a pre-sorted array, use a boolean flag:\n\n```javascript\n...\nconst isSorted = true;\nconsole.log(median([1,2,3,4,5], isSorted)) // fast\n// 3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassubbed%2Fatlas-median","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlassubbed%2Fatlas-median","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassubbed%2Fatlas-median/lists"}