{"id":30060053,"url":"https://github.com/tiaanduplessis/prop-sort","last_synced_at":"2025-08-08T01:41:48.015Z","repository":{"id":57331753,"uuid":"89804837","full_name":"tiaanduplessis/prop-sort","owner":"tiaanduplessis","description":"Sort array of objects based on property (supports nested properties)","archived":false,"fork":false,"pushed_at":"2019-06-02T22:44:02.000Z","size":30,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T21:45:52.809Z","etag":null,"topics":["array","nested","object","property","sorting"],"latest_commit_sha":null,"homepage":null,"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/tiaanduplessis.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-04-29T18:32:27.000Z","updated_at":"2022-05-30T09:50:09.000Z","dependencies_parsed_at":"2022-09-05T10:11:54.134Z","dependency_job_id":null,"html_url":"https://github.com/tiaanduplessis/prop-sort","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tiaanduplessis/prop-sort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Fprop-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Fprop-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Fprop-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Fprop-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiaanduplessis","download_url":"https://codeload.github.com/tiaanduplessis/prop-sort/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Fprop-sort/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269352394,"owners_count":24402671,"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-07T02:00:09.698Z","response_time":73,"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":["array","nested","object","property","sorting"],"created_at":"2025-08-08T01:41:35.748Z","updated_at":"2025-08-08T01:41:47.981Z","avatar_url":"https://github.com/tiaanduplessis.png","language":"JavaScript","funding_links":["https://www.paypal.me/tiaanduplessis/1"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eprop-sort\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eSort array of objects based on property (supports nested properties)\u003c/strong\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/prop-sort\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/prop-sort.svg?style=flat-square\" alt=\"Package version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/prop-sort\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dm/prop-sort.svg?style=flat-square\" alt=\"Downloads\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/feross/standard\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\" alt=\"Standard\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/tiaanduplessis/prop-sort\"\u003e\n    \u003cimg src=\"https://img.shields.io/travis/tiaanduplessis/prop-sort.svg?style=flat-square\" alt=\"Travis Build\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/RichardLitt/standard-readme)\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square\" alt=\"Standard Readme\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/gh/tiaanduplessis%2Fprop-sort\"\u003e\n    \u003cimg src=\"https://badge.fury.io/gh/tiaanduplessis%2Fprop-sort.svg?style=flat-square\" alt=\"GitHub version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://dependencyci.com/github/tiaanduplessis/prop-sort\"\u003e\n    \u003cimg src=\"https://dependencyci.com/github/tiaanduplessis/prop-sort/badge?style=flat-square\" alt=\"Dependency CI\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/tiaanduplessis/prop-sort/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/prop-sort.svg?style=flat-square\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://makeapullrequest.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\" alt=\"PRs\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.paypal.me/tiaanduplessis/1\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/$-support-green.svg?style=flat-square\" alt=\"Donate\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/tiaanduplessis/prop-sort/watchers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/watchers/tiaanduplessis/prop-sort.svg?style=social\" alt=\"Github Watch Badge\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/tiaanduplessis/prop-sort/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/tiaanduplessis/prop-sort.svg?style=social\" alt=\"Github Star Badge\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/intent/tweet?text=Check%20out%20prop-sort!%20https://github.com/tiaanduplessis/prop-sort%20%F0%9F%91%8D\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/url/https/github.com/tiaanduplessis/prop-sort.svg?style=social\" alt=\"Tweet\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n  Built with ❤︎ by \u003ca href=\"tiaan.beer\"\u003eTiaan\u003c/a\u003e and \u003ca href=\"https://github.com/tiaanduplessis/prop-sort/graphs/contributors\"\u003econtributors\u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003cli\u003e\u003ca href=\"#install\"\u003eInstall\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#contribute\"\u003eContribute\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n\u003c/details\u003e\n\n## Install\n\n```sh\n$ npm install --save prop-sort\n# OR\n$ yarn add prop-sort\n```\n\n## Usage\n\nThe original array **is not mutated**.\n\n```js\nconst propSort = require('prop-sort')\n\nconst data = [\n  {\n    value: 1,\n    priority: 'c'\n  },\n  {\n    value: 2,\n    priority: 'a'\n  },\n  {\n    value: 9\n  },\n  {\n    value: 1,\n    priority: 'z'\n  },\n  {\n    value: 2,\n    priority: 'a'\n  }\n]\n\nconsole.log(propSort(data, 'priority'))\n//[ { value: 9 },\n//  { value: 2, priority: 'a' },\n//  { value: 2, priority: 'a' },\n//  { value: 1, priority: 'c' },\n//  { value: 1, priority: 'z' } ]\n\n```\n\nUse `dot notation` to sort by nested properties:\n\n```js\nconst propSort = require('prop-sort')\n\nconst data = [\n  {\n    value: 1,\n    foo: {\n      bar: 8\n    }\n  },\n  {\n    value: 2,\n    foo: {\n      bar: 1\n    }\n  },\n  {\n    value: 9,\n    foo: {\n      bar: 5\n    }\n  },\n  {\n    value: 1,\n    foo: {\n      bar: 99\n    }\n  },\n  {\n    value: 2,\n    foo: {\n      bar: 70\n    }\n  }\n]\n\nconsole.log(propSort(data, 'foo.bar'))\n// [ { value: 2, foo: { bar: 1 } },\n//  { value: 9, foo: { bar: 5 } },\n//  { value: 1, foo: { bar: 8 } },\n//  { value: 2, foo: { bar: 70 } },\n//  { value: 1, foo: { bar: 99 } } ]\n```\n\nCan also use own custom comparator function:\n\n```js\nconst propSort = require('prop-sort')\n\ndata = [...]\n\npropSort(data, 'property', (valueOfFirstProperty, valueOfSecondProperty) =\u003e {\n\t//...\n})\n\n```\n\n## Contribute\n\nContributions are welcome. Please open up an issue or create PR if you would like to help out.\n\nNote: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nLicensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaanduplessis%2Fprop-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiaanduplessis%2Fprop-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaanduplessis%2Fprop-sort/lists"}