{"id":15640575,"url":"https://github.com/bubkoo/natsort","last_synced_at":"2025-09-04T09:38:42.783Z","repository":{"id":57308956,"uuid":"54971483","full_name":"bubkoo/natsort","owner":"bubkoo","description":"🌴 Javascript natural sort algorithm with unicode support.","archived":false,"fork":false,"pushed_at":"2023-03-13T17:13:13.000Z","size":153,"stargazers_count":80,"open_issues_count":4,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-17T09:56:10.754Z","etag":null,"topics":["natsort","natural-sort","sort","unicode-support"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/natsort","language":"TypeScript","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/bubkoo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-29T11:50:02.000Z","updated_at":"2025-07-11T03:00:19.000Z","dependencies_parsed_at":"2024-06-18T15:23:18.279Z","dependency_job_id":"28b19797-464f-4eba-972f-3367b38ff692","html_url":"https://github.com/bubkoo/natsort","commit_stats":null,"previous_names":["bubkoo/natural-sort"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bubkoo/natsort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fnatsort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fnatsort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fnatsort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fnatsort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubkoo","download_url":"https://codeload.github.com/bubkoo/natsort/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Fnatsort/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273585817,"owners_count":25132431,"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-09-04T02:00:08.968Z","response_time":61,"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":["natsort","natural-sort","sort","unicode-support"],"created_at":"2024-10-03T11:37:38.884Z","updated_at":"2025-09-04T09:38:42.741Z","avatar_url":"https://github.com/bubkoo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo.svg](https://cdn.rawgit.com/bubkoo/natsort/e7f59ae/logo.svg)\n\n\u003e Javascript natural sort algorithm with unicode support.\n\n[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/bubkoo/natsort/blob/master/LICENSE)\n\n[![build:?](https://img.shields.io/travis/bubkoo/natsort/master.svg?style=flat-square)](https://travis-ci.org/bubkoo/natsort)\n[![coverage:?](https://img.shields.io/coveralls/bubkoo/natsort/master.svg?style=flat-square)](https://coveralls.io/github/bubkoo/natsort)\n\n\n## TL;DR\n\nMost sort implementations utilizing a fast sort algorithm but they all lack the ability to perform a \"**natural sort**\". That is, sorting an array of dates, numeric string, software version numbers, etc. and getting the \"natural\" a.k.a. \"expected\" ordering on the results. \n\nThis algorithm was deeply inspired from [this blog post](http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm/) of [Jim Palmer](http://www.linkedin.com/in/jimbob).\n\nThe project name \"**natsort**\" was inspired from Python's [natsort()](https://pypi.python.org/pypi/natsort).\n\n### Features\n\n- Numeric support\n- Unicode support\n- Dates sorting support\n- Empty strings are always come first\n- Case-Insensitive sorting\n- Desc sorting\n\n\n## Install\n\nYou can get it on npm.\n\n```\n$ npm install natsort --save\n```\n\nIf you're not into package management, just [download a ZIP](https://github.com/bubkoo/natsort/releases) file.\n\n## Setup\n\nFirst, include the script located on the `dist` folder:\n\n```html\n\u003cscript src=\"dist//natsort.min.js\"\u003e\u003c/script\u003e\n```\n\nOr load it from [jsdelivr](http://www.jsdelivr.com/projects/natsort):\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/natsort@\u003cversion\u003e/index.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/natsort@latest/index.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```js\nvar natsort = require('natsort');\nvar someArr = [2, 5, 3, 4, 1, 'a', 'B'];\n\nsomeArr.sort(natsort());\nsomeArr.sort(natsort({ desc: true }));\nsomeArr.sort(natsort({ insensitive: true }));\n\n// sort with object array\nvar objArr = [\n  { val: 'B' },\n  { val: 'a' },\n  { val: 'D' },\n  { val: 'c' }\n];\n\nvar sorter = natsort();\n\nobjArr.sort(function(a, b) {\n  return sorter(a.val, b.val);\n});\n```\n\n\n## Examples\n\nFind more examples see the [tests](https://github.com/bubkoo/natsort/blob/master/test/spec/). \n\n```js\n// simple numerics\n['10', 9, 2, '1', '4'].sort(natsort());\n// ['1',2,'4',9,'10']\n\n// floats\n[\n  '10.0401',\n  10.022,\n  10.042,\n  '10.021999'\n].sort(natsort());\n// [\n//  '10.021999',\n//  10.022,\n//  '10.0401',\n//  10.042\n// ]\n\n// float \u0026 decimal notation\n[\n  '10.04f',\n  '10.039F',\n  '10.038d',\n  '10.037D'\n].sort(natsort());\n// [\n//  '10.037D',\n//  '10.038d',\n//  '10.039F',\n//  '10.04f'\n// ]\n\n// scientific notation\n[\n  '1.528535047e5',\n  '1.528535047e7',\n  '1.528535047e3'\n].sort(natsort());\n// [\n//  '1.528535047e3',\n//  '1.528535047e5',\n//  '1.528535047e7'\n// ]\n\n// ip addresses\n[\n  '192.168.0.100',\n  '192.168.0.1',\n  '192.168.1.1'\n].sort(natsort());\n// [\n//  '192.168.0.1',\n//  '192.168.0.100',\n//  '192.168.1.1'\n// ]\n\n// Filenames\n[\n  'car.mov',\n  '01alpha.sgi',\n  '001alpha.sgi',\n  'my.string_41299.tif'\n].sort(natsort());\n// [\n//  '001alpha.sgi',\n//  '01alpha.sgi',\n//  'car.mov',\n//  'my.string_41299.tif'\n// ]\n\n// dates\n[\n  '10/12/2008',\n  '10/11/2008',\n  '10/11/2007',\n  '10/12/2007'\n].sort(natsort());\n// [\n//  '10/11/2007',\n//  '10/12/2007',\n//  '10/11/2008',\n//  '10/12/2008'\n// ]\n\n// money\n[\n  '$10002.00',\n  '$10001.02',\n  '$10001.01'\n].sort(natsort());\n// [\n//  '$10001.01',\n//  '$10001.02',\n//  '$10002.00'\n// ]\n\n// versions\n[\n  '1.0.2',\n  '1.0.1',\n  '1.0.0',\n  '1.0.9'\n].sort(natsort());\n// [\n//  '1.0.0',\n//  '1.0.1',\n//  '1.0.2',\n//  '1.0.9'\n// ]\n\n// movie titles\n[\n  '1 Title - The Big Lebowski',\n  '1 Title - Gattaca',\n  '1 Title - Last Picture Show'\n].sort(natsort());\n// [\n//  '1 Title - Gattaca',\n//  '1 Title - Last Picture Show',\n//  '1 Title - The Big Lebowski'\n// ]\n\n// by default - case-sensitive sorting\n['a', 'B'].sort(natsort());\n// ['B', 'a']\n\n// enable case-insensitive sorting\n['a', 'B'].sort(natsort({ insensitive: true }));\n// ['a', 'B']\n\n// desc\n[4, 2, 3, 5, 1].sort(natsort({ desc: true }));\n//[1, 2, 3, 4, 5]\n```\n\n## Contributing\n\nPull requests and stars are highly welcome.\n\nFor bugs and feature requests, please [create an issue](https://github.com/bubkoo/natsort/issues/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fnatsort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubkoo%2Fnatsort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Fnatsort/lists"}