aboutsummaryrefslogtreecommitdiff
path: root/node_modules/natural-compare
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/natural-compare
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
node_modules
Diffstat (limited to 'node_modules/natural-compare')
-rw-r--r--node_modules/natural-compare/README.md125
-rw-r--r--node_modules/natural-compare/index.js57
-rw-r--r--node_modules/natural-compare/package.json42
3 files changed, 0 insertions, 224 deletions
diff --git a/node_modules/natural-compare/README.md b/node_modules/natural-compare/README.md
deleted file mode 100644
index c85dfdf98..000000000
--- a/node_modules/natural-compare/README.md
+++ /dev/null
@@ -1,125 +0,0 @@
-
-[Build]: http://img.shields.io/travis/litejs/natural-compare-lite.png
-[Coverage]: http://img.shields.io/coveralls/litejs/natural-compare-lite.png
-[1]: https://travis-ci.org/litejs/natural-compare-lite
-[2]: https://coveralls.io/r/litejs/natural-compare-lite
-[npm package]: https://npmjs.org/package/natural-compare-lite
-[GitHub repo]: https://github.com/litejs/natural-compare-lite
-
-
-
- @version 1.4.0
- @date 2015-10-26
- @stability 3 - Stable
-
-
-Natural Compare &ndash; [![Build][]][1] [![Coverage][]][2]
-===============
-
-Compare strings containing a mix of letters and numbers
-in the way a human being would in sort order.
-This is described as a "natural ordering".
-
-```text
-Standard sorting: Natural order sorting:
- img1.png img1.png
- img10.png img2.png
- img12.png img10.png
- img2.png img12.png
-```
-
-String.naturalCompare returns a number indicating
-whether a reference string comes before or after or is the same
-as the given string in sort order.
-Use it with builtin sort() function.
-
-
-
-### Installation
-
-- In browser
-
-```html
-<script src=min.natural-compare.js></script>
-```
-
-- In node.js: `npm install natural-compare-lite`
-
-```javascript
-require("natural-compare-lite")
-```
-
-### Usage
-
-```javascript
-// Simple case sensitive example
-var a = ["z1.doc", "z10.doc", "z17.doc", "z2.doc", "z23.doc", "z3.doc"];
-a.sort(String.naturalCompare);
-// ["z1.doc", "z2.doc", "z3.doc", "z10.doc", "z17.doc", "z23.doc"]
-
-// Use wrapper function for case insensitivity
-a.sort(function(a, b){
- return String.naturalCompare(a.toLowerCase(), b.toLowerCase());
-})
-
-// In most cases we want to sort an array of objects
-var a = [ {"street":"350 5th Ave", "room":"A-1021"}
- , {"street":"350 5th Ave", "room":"A-21046-b"} ];
-
-// sort by street, then by room
-a.sort(function(a, b){
- return String.naturalCompare(a.street, b.street) || String.naturalCompare(a.room, b.room);
-})
-
-// When text transformation is needed (eg toLowerCase()),
-// it is best for performance to keep
-// transformed key in that object.
-// There are no need to do text transformation
-// on each comparision when sorting.
-var a = [ {"make":"Audi", "model":"A6"}
- , {"make":"Kia", "model":"Rio"} ];
-
-// sort by make, then by model
-a.map(function(car){
- car.sort_key = (car.make + " " + car.model).toLowerCase();
-})
-a.sort(function(a, b){
- return String.naturalCompare(a.sort_key, b.sort_key);
-})
-```
-
-- Works well with dates in ISO format eg "Rev 2012-07-26.doc".
-
-
-### Custom alphabet
-
-It is possible to configure a custom alphabet
-to achieve a desired order.
-
-```javascript
-// Estonian alphabet
-String.alphabet = "ABDEFGHIJKLMNOPRSŠZŽTUVÕÄÖÜXYabdefghijklmnoprsšzžtuvõäöüxy"
-["t", "z", "x", "õ"].sort(String.naturalCompare)
-// ["z", "t", "õ", "x"]
-
-// Russian alphabet
-String.alphabet = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя"
-["Ё", "А", "Б"].sort(String.naturalCompare)
-// ["А", "Б", "Ё"]
-```
-
-
-External links
---------------
-
-- [GitHub repo][https://github.com/litejs/natural-compare-lite]
-- [jsperf test](http://jsperf.com/natural-sort-2/12)
-
-
-Licence
--------
-
-Copyright (c) 2012-2015 Lauri Rooden &lt;lauri@rooden.ee&gt;
-[The MIT License](http://lauri.rooden.ee/mit-license.txt)
-
-
diff --git a/node_modules/natural-compare/index.js b/node_modules/natural-compare/index.js
deleted file mode 100644
index e705d49f5..000000000
--- a/node_modules/natural-compare/index.js
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-/*
- * @version 1.4.0
- * @date 2015-10-26
- * @stability 3 - Stable
- * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
- * @license MIT License
- */
-
-
-var naturalCompare = function(a, b) {
- var i, codeA
- , codeB = 1
- , posA = 0
- , posB = 0
- , alphabet = String.alphabet
-
- function getCode(str, pos, code) {
- if (code) {
- for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
- return +str.slice(pos - 1, i)
- }
- code = alphabet && alphabet.indexOf(str.charAt(pos))
- return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
- : code < 46 ? 65 // -
- : code < 48 ? code - 1
- : code < 58 ? code + 18 // 0-9
- : code < 65 ? code - 11
- : code < 91 ? code + 11 // A-Z
- : code < 97 ? code - 37
- : code < 123 ? code + 5 // a-z
- : code - 63
- }
-
-
- if ((a+="") != (b+="")) for (;codeB;) {
- codeA = getCode(a, posA++)
- codeB = getCode(b, posB++)
-
- if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
- codeA = getCode(a, posA, posA)
- codeB = getCode(b, posB, posA = i)
- posB = i
- }
-
- if (codeA != codeB) return (codeA < codeB) ? -1 : 1
- }
- return 0
-}
-
-try {
- module.exports = naturalCompare;
-} catch (e) {
- String.naturalCompare = naturalCompare;
-}
diff --git a/node_modules/natural-compare/package.json b/node_modules/natural-compare/package.json
deleted file mode 100644
index 1a71362ee..000000000
--- a/node_modules/natural-compare/package.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "name": "natural-compare",
- "version": "1.4.0",
- "stability": 3,
- "author": "Lauri Rooden (https://github.com/litejs/natural-compare-lite)",
- "license": "MIT",
- "description": "Compare strings containing a mix of letters and numbers in the way a human being would in sort order.",
- "keywords": [
- "string",
- "natural",
- "order",
- "sort",
- "natsort",
- "natcmp",
- "compare",
- "alphanum",
- "litejs"
- ],
- "main": "index.js",
- "readmeFilename": "README.md",
- "files": [
- "index.js"
- ],
- "scripts": {
- "build": "node node_modules/buildman/index.js --all",
- "test": "node tests/index.js"
- },
- "repository": "git://github.com/litejs/natural-compare-lite.git",
- "bugs": {
- "url": "https://github.com/litejs/natural-compare-lite/issues"
- },
- "devDependencies": {
- "buildman": "*",
- "testman": "*"
- },
- "buildman": {
- "dist/index-min.js": {
- "banner": "/*! litejs.com/MIT-LICENSE.txt */",
- "input": "index.js"
- }
- }
-}