{
  "manifest": {
    "name": "string-natural-compare",
    "version": "3.0.1",
    "description": "Compare alphanumeric strings the same way a human would, using a natural order algorithm",
    "author": {
      "name": "Nathan Woltman",
      "email": "nwoltman@outlook.com"
    },
    "license": "MIT",
    "main": "natural-compare.js",
    "files": [
      "natural-compare.js"
    ],
    "repository": {
      "type": "git",
      "url": "https://github.com/nwoltman/string-natural-compare.git"
    },
    "homepage": "https://github.com/nwoltman/string-natural-compare",
    "bugs": {
      "url": "https://github.com/nwoltman/string-natural-compare/issues"
    },
    "keywords": [
      "string",
      "natural",
      "compare",
      "comparison",
      "order",
      "natcmp",
      "strnatcmp",
      "sort",
      "natsort",
      "alphanum",
      "alphanumeric"
    ],
    "eslintIgnore": [
      "benchmark/node_modules/",
      "coverage/"
    ],
    "nyc": {
      "reporter": [
        "html",
        "text-summary"
      ],
      "check-coverage": true,
      "branches": 100,
      "lines": 100,
      "statements": 100
    },
    "devDependencies": {
      "@nwoltman/eslint-config": "^0.6.0",
      "coveralls": "^3.0.9",
      "eslint": "^6.8.0",
      "mocha": "^7.0.0",
      "nyc": "^15.0.0",
      "should": "^13.2.3"
    },
    "scripts": {
      "lint": "eslint .",
      "test": "eslint . && nyc mocha",
      "coveralls": "nyc report --reporter=text-lcov | coveralls"
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-string-natural-compare-3.0.1-7a42d58474454963759e8e8b7ae63d71c1e7fdf4-integrity/node_modules/string-natural-compare/package.json",
    "readmeFilename": "README.md",
    "readme": "# String Natural Compare\n\n[![NPM Version](https://img.shields.io/npm/v/string-natural-compare.svg)](https://www.npmjs.com/package/string-natural-compare)\n[![Build Status](https://travis-ci.org/nwoltman/string-natural-compare.svg?branch=master)](https://travis-ci.org/nwoltman/string-natural-compare)\n[![Coverage Status](https://coveralls.io/repos/nwoltman/string-natural-compare/badge.svg?branch=master)](https://coveralls.io/r/nwoltman/string-natural-compare?branch=master)\n[![Dependencies Status](https://img.shields.io/david/nwoltman/string-natural-compare)](https://david-dm.org/nwoltman/string-natural-compare)\n\nCompare alphanumeric strings the same way a human would, using a natural order algorithm (originally known as the [alphanum algorithm](http://davekoelle.com/alphanum.html)) where numeric characters are sorted based on their numeric values rather than their ASCII values.\n\n```\nStandard sorting:   Natural order sorting:\n    img1.png            img1.png\n    img10.png           img2.png\n    img12.png           img10.png\n    img2.png            img12.png\n```\n\nThis module exports a function that returns a number indicating whether one string should come before, after, or is the same as another string.\nIt can be used directly with the native [`.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) array method.\n\n### Fast and Robust\n\nThis module can compare strings containing any size of number and is heavily tested with a custom [benchmark suite](https://github.com/nwoltman/string-natural-compare/tree/master/benchmark) to make sure that it is as fast as possible.\n\n\n## Installation\n\n```sh\nnpm install string-natural-compare --save\n# or\nyarn add string-natural-compare\n```\n\n\n## Usage\n\n#### `naturalCompare(strA, strB[, options])`\n\n+ `strA` (_string_)\n+ `strB` (_string_)\n+ `options` (_object_) - Optional options object with the following options:\n  + `caseInsensitive` (_boolean_) - Set to `true` to compare strings case-insensitively. Default: `false`.\n  + `alphabet` (_string_) - A string of characters that define a custom character ordering. Default: `undefined`.\n\n```js\nconst naturalCompare = require('string-natural-compare');\n\n// Simple, case-sensitive sorting\nconst files = ['z1.doc', 'z10.doc', 'z17.doc', 'z2.doc', 'z23.doc', 'z3.doc'];\nfiles.sort(naturalCompare);\n// -> ['z1.doc', 'z2.doc', 'z3.doc', 'z10.doc', 'z17.doc', 'z23.doc']\n\n\n// Case-insensitive sorting\nconst chars = ['B', 'C', 'a', 'd'];\nconst naturalCompareCI = (a, b) => naturalCompare(a, b, {caseInsensitive: true});\nchars.sort(naturalCompareCI);\n// -> ['a', 'B', 'C', 'd']\n\n// Note:\n['a', 'A'].sort(naturalCompareCI); // -> ['a', 'A']\n['A', 'a'].sort(naturalCompareCI); // -> ['A', 'a']\n\n\n// Compare strings containing large numbers\nnaturalCompare(\n  '1165874568735487968325787328996865',\n  '265812277985321589735871687040841'\n);\n// -> 1\n// (Other inputs with the same ordering as this example may yield a different number > 0)\n\n\n// Sorting an array of objects\nconst hotelRooms = [\n  {street: '350 5th Ave', room: 'A-1021'},\n  {street: '350 5th Ave', room: 'A-21046-b'}\n];\n// Sort by street (case-insensitive), then by room (case-sensitive)\nhotelRooms.sort((a, b) => (\n  naturalCompare(a.street, b.street, {caseInsensitive: true}) ||\n  naturalCompare(a.room, b.room)\n));\n\n\n// When text transformation is needed or when doing a case-insensitive sort on a\n// large array of objects, it is best for performance to pre-compute the\n// transformed text and store it on the object. This way, the text will not need\n// to be transformed for every comparison while sorting.\nconst cars = [\n  {make: 'Audi', model: 'R8'},\n  {make: 'Porsche', model: '911 Turbo S'}\n];\n// Sort by make, then by model (both case-insensitive)\nfor (const car of cars) {\n  car.sortKey = (car.make + ' ' + car.model).toLowerCase();\n}\ncars.sort((a, b) => naturalCompare(a.sortKey, b.sortKey));\n\n\n// Using a custom alphabet (Russian alphabet)\nconst russianOpts = {\n  alphabet: 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя',\n};\n['Ё', 'А', 'б', 'Б'].sort((a, b) => naturalCompare(a, b, russianOpts));\n// -> ['А', 'Б', 'Ё', 'б']\n```\n\n**Note:** Putting numbers in the custom alphabet can cause undefined behaviour.\n",
    "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2015-2016 Nathan Woltman\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz",
    "hash": "7a42d58474454963759e8e8b7ae63d71c1e7fdf4",
    "integrity": "sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==",
    "registry": "npm",
    "packageName": "string-natural-compare",
    "cacheIntegrity": "sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== sha1-ekLVhHRFSWN1no6LeuY9ccHn/fQ="
  },
  "registry": "npm",
  "hash": "7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
}