feat: 合入航空账号、子账号及会员管理更新

Import the supplied management frontend, including request encryption, withdrawal updates, and vendored dependencies.
Use incoming versions for overlapping source files and retain existing environment configuration absent from the supplied directory.
This commit is contained in:
dzc committed 2026-10-29 16:52:46 +08:00
1 parent 401c7c1dd6
commit f087d6ba57
179 files changed
+21027 -9976

No files matched your search

@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+163
View File
@@ -0,0 +1,163 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store
+76
View File
@@ -0,0 +1,76 @@
### Simple numerics
```javascript
>>> ['10',9,2,'1','4'].sort(naturalSort)
['1',2,'4',9,'10']
```
### Floats
```javascript
>>> ['10.0401',10.022,10.042,'10.021999'].sort(naturalSort)
['10.021999',10.022,'10.0401',10.042]
```
### Float & decimal notation
```javascript
>>> ['10.04f','10.039F','10.038d','10.037D'].sort(naturalSort)
['10.037D','10.038d','10.039F','10.04f']
```
### Scientific notation
```javascript
>>> ['1.528535047e5','1.528535047e7','1.528535047e3'].sort(naturalSort)
['1.528535047e3','1.528535047e5','1.528535047e7']
```
### IP addresses
```javascript
>>> ['192.168.0.100','192.168.0.1','192.168.1.1'].sort(naturalSort)
['192.168.0.1','192.168.0.100','192.168.1.1']
```
### Filenames
```javascript
>>> ['car.mov','01alpha.sgi','001alpha.sgi','my.string_41299.tif'].sort(naturalSort)
['001alpha.sgi','01alpha.sgi','car.mov','my.string_41299.tif'
```
### Dates
```javascript
>>> ['10/12/2008','10/11/2008','10/11/2007','10/12/2007'].sort(naturalSort)
['10/11/2007', '10/12/2007', '10/11/2008', '10/12/2008']
```
### Money
```javascript
>>> ['$10002.00','$10001.02','$10001.01'].sort(naturalSort)
['$10001.01','$10001.02','$10002.00']
```
### Movie Titles
```javascript
>>> ['1 Title - The Big Lebowski','1 Title - Gattaca','1 Title - Last Picture Show'].sort(naturalSort)
['1 Title - Gattaca','1 Title - Last Picture Show','1 Title - The Big Lebowski']
```
### By default - case-sensitive sorting
```javascript
>>> ['a', 'B'].sort(naturalSort);
['B', 'a']
```
### To enable case-insensitive sorting
```javascript
>>> naturalSort.insensitive = true;
>>> ['a', 'B'].sort(naturalSort);
['a', 'B']
```
+100
View File
@@ -0,0 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>overset/javascript-natural-sort @ GitHub</title>
<style type="text/css">
body {
margin-top: 1.0em;
background-color: #ffffff;
font-family: Helvetica, Arial, FreeSans, san-serif;
color: #000000;
}
#container {
margin: 0 auto;
width: 700px;
}
h1 { font-size: 3.8em; color: #000000; margin-bottom: 3px; }
h1 .small { font-size: 0.4em; }
h1 a { text-decoration: none }
h2 { font-size: 1.5em; color: #000000; }
h3 { text-align: center; color: #000000; }
a { color: #000000; }
.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
.download { float: right; }
pre { background: #000; color: #fff; padding: 15px;}
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
.footer { text-align:center; padding-top:30px; font-style: italic; }
</style>
</head>
<body>
<a href="https://github.com/overset/javascript-natural-sort"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
<div id="container">
<div class="download">
<a href="https://github.com/overset/javascript-natural-sort/zipball/master">
<img border="0" width="90" src="https://github.com/images/modules/download/zip.png"></a>
<a href="https://github.com/overset/javascript-natural-sort/tarball/master">
<img border="0" width="90" src="https://github.com/images/modules/download/tar.png"></a>
</div>
<h1><a href="https://github.com/overset/javascript-natural-sort">javascript-natural-sort</a>
<span class="small">by <a href="https://github.com/overset">overset</a></span></h1>
<div class="description">
A fast and lightweight function to be used in conjunction with the Array.sort() using the browser's default bubble sort. This will properly sort padded numbers, numbers preceding text, dates, floats, etc.
</div>
<h2>License</h2>
<p>MIT</p>
<h2>Authors</h2>
<p>Jim Palmer (jimpalmer@gmail.com)␍<br/> </p>
<h2>Contact</h2>
<p>Jim Palmer (jimpalmer@gmail.com)␍<br/> </p>
<h2>Download</h2>
<p>
You can download this project in either
<a href="https://github.com/overset/javascript-natural-sort/zipball/master">zip</a> or
<a href="https://github.com/overset/javascript-natural-sort/tarball/master">tar formats.
</p>
<p>You can also clone the project with <a href="http://git-scm.com">Git</a>
by running:
<pre>$ git clone git://github.com/overset/javascript-natural-sort</pre>
</p>
<div class="footer">
get the source code on GitHub : <a href="https://github.com/overset/javascript-natural-sort">overset/javascript-natural-sort</a>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-87585-8");
pageTracker._trackPageview();
} catch(err) {}</script>"
</body>
</html>
+45
View File
@@ -0,0 +1,45 @@
/*
* Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
* Author: Jim Palmer (based on chunking idea from Dave Koelle)
*/
/*jshint unused:false */
module.exports = function naturalSort (a, b) {
"use strict";
var re = /(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,
sre = /(^[ ]*|[ ]*$)/g,
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
hre = /^0x[0-9a-f]+$/i,
ore = /^0/,
i = function(s) { return naturalSort.insensitive && ('' + s).toLowerCase() || '' + s; },
// convert all to strings strip whitespace
x = i(a).replace(sre, '') || '',
y = i(b).replace(sre, '') || '',
// chunk/tokenize
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
// numeric, hex or date detection
xD = parseInt(x.match(hre), 16) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre), 16) || xD && y.match(dre) && Date.parse(y) || null,
oFxNcL, oFyNcL;
// first try and sort Hex codes or Dates
if (yD) {
if ( xD < yD ) { return -1; }
else if ( xD > yD ) { return 1; }
}
// natural sorting through split numeric strings and default strings
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) { return -1; }
if (oFxNcL > oFyNcL) { return 1; }
}
return 0;
};
+27
View File
@@ -0,0 +1,27 @@
{
"name": "javascript-natural-sort",
"version": "0.7.1",
"description": "Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license",
"main": "naturalSort.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/Bill4Time/javascript-natural-sort.git"
},
"keywords": [
"natural",
"sort",
"javascript",
"array",
"sort",
"sorting"
],
"author": "Jim Palmer (based on chunking idea from Dave Koelle, packaged by @khous of Bill4Time)",
"license": "MIT",
"bugs": {
"url": "https://github.com/Bill4Time/javascript-natural-sort/issues"
},
"homepage": "https://github.com/Bill4Time/javascript-natural-sort"
}
+105
View File
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<script src="naturalSort.js" type="text/javascript"></script>
<script>
/* Mike Grier's fixes on v0.2 http://mgrier.com/code/natsort.optimized.txt */
function naturalSort2(a,b){
// setup temp-scope variables for comparison evauluation
var x = a.toString().toLowerCase() || '',
re=/(-?[0-9.]+)/g,
y = b.toString().toLowerCase() || '',
nC = String.fromCharCode(0),
xN = x.replace( re, nC + '$1' + nC ).split(nC),
yN = y.replace( re, nC + '$1' + nC ).split(nC),
xD = (new Date(x)).getTime(),yD;
if(xD) yD = (new Date(y)).getTime(); //no point in getting yD if xD is not a date
// natural sorting of dates
if(yD){ // we already checked if(xD), so if(yD), it's a date, too
if( xD < yD ) return -1;
else if( xD > yD ) return 1;
}
// natural sorting through split numeric strings and default strings
var cLoc, numS=Math.max(xN.length,yN.length);
for(cLoc=0; cLoc<numS; cLoc++){
// instead of performing these next 6 operations in the if
// and the same 6 operations in the else if, just do them once
// so we can reuse results instead of computing twice
xNcL = xN[cLoc]; // only look up values
yNcL = yN[cLoc]; // in arrays once
FxNcL = parseFloat(xNcL);
FyNcL = parseFloat(yNcL);
oFxNcL = FxNcL || xNcL;
oFyNcL = FyNcL || yNcL;
if(oFxNcL < oFyNcL)return -1;
else if(oFxNcL > oFyNcL)return 1;
}
return 0;
}
/*
* Natural Sort algorithm for Javascript
* Version 0.3
* Author: Jim Palmer (based on chunking idea from Dave Koelle)
* optimizations and safari fix by Mike Grier (mgrier.com)
* Released under MIT license.
*/
function naturalSort3(a, b){
// setup temp-scope variables for comparison evauluation
var re = /(-?[0-9\.]+)/g,
x = a.toString().toLowerCase() || '',
y = b.toString().toLowerCase() || '',
nC = String.fromCharCode(0),
xN = x.replace( re, nC + '$1' + nC ).split(nC),
yN = y.replace( re, nC + '$1' + nC ).split(nC),
xD = (new Date(x)).getTime(),
yD = xD ? (new Date(y)).getTime() : null;
// natural sorting of dates
if ( yD )
if ( xD < yD ) return -1;
else if ( xD > yD ) return 1;
// natural sorting through split numeric strings and default strings
for( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
if (oFxNcL < oFyNcL) return -1;
else if (oFxNcL > oFyNcL) return 1;
}
return 0;
}
var a = [], b = [], c = [];
for ( var i = 0; i < 1000; i++ ) {
a.push(String.fromCharCode( Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65 ));
b.push(String.fromCharCode( Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65 ));
c.push(String.fromCharCode( Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65, Math.floor(Math.random() * (90-66)) + 65 ));
}
for ( i = 0; i < 1000; i++ ) {
a.push(Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() );
b.push(Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() );
c.push(Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() + Math.floor(Math.random() * 9).toString() );
}
for ( i = 0; i < 1000; i++ ) {
a.push( (Math.floor(Math.random() * 12) + 1).toString() + '/' + (Math.floor(Math.random() * 28) + 1).toString() + '/' + ( 2009 - Math.floor(Math.random() * 2)) );
b.push( (Math.floor(Math.random() * 12) + 1).toString() + '/' + (Math.floor(Math.random() * 28) + 1).toString() + '/' + ( 2009 - Math.floor(Math.random() * 2)) );
c.push( (Math.floor(Math.random() * 12) + 1).toString() + '/' + (Math.floor(Math.random() * 28) + 1).toString() + '/' + ( 2009 - Math.floor(Math.random() * 2)) );
}
var d = new Date();
document.write(a.sort(naturalSort)[0] + ' <BR>[' + ((new Date()).getTime() - d.getTime()) + 'ms]<BR><BR>');
//d = new Date();
//document.write(b.sort(naturalSort2)[0] + ' <BR>[' + ((new Date()).getTime() - d.getTime()) + 'ms]<BR><BR>');
//d = new Date();
//document.write(c.sort(naturalSort3)[0] + ' <BR>[' + ((new Date()).getTime() - d.getTime()) + 'ms]');
</script>
<style>*{font-family:tahoma;font-size:9px;}</style>
</head>
<body></body>
</html>
+365
View File
@@ -0,0 +1,365 @@
<!DOCTYPE html>
<html>
<head>
<title>js-naturalsort test suite</title>
<script src='http://code.jquery.com/jquery-latest.js'></script>
<link rel='stylesheet' href='http://code.jquery.com/qunit/git/qunit.css' type='text/css' media='screen' />
<script type='text/javascript' src='http://code.jquery.com/qunit/git/qunit.js'></script>
<script src='naturalSort.js' type='text/javascript'></script>
<script type='text/javascript'>
$(function () {
test('different values types', function () {
wrapTest(
['a',1],
[1,'a'],
'number always comes first');
wrapTest(
['1',1],
['1',1],
'number vs numeric string - should remain unchanged (error in chrome)');
wrapTest(
['02',3,2,'01'],
['01','02',2,3],
'padding numeric string vs number');
});
test('datetime', function () {
wrapTest(
['10/12/2008','10/11/2008','10/11/2007','10/12/2007'],
['10/11/2007','10/12/2007','10/11/2008','10/12/2008'],
'similar dates');
wrapTest(
['01/01/2008','01/10/2008','01/01/1992','01/01/1991'],
['01/01/1991','01/01/1992','01/01/2008','01/10/2008'],
'similar dates');
wrapTest(
[
'Wed Jan 01 2010 00:00:00 GMT-0800 (Pacific Standard Time)',
'Thu Dec 31 2009 00:00:00 GMT-0800 (Pacific Standard Time)',
'Wed Jan 01 2010 00:00:00 GMT-0500 (Eastern Standard Time)'
],[
'Thu Dec 31 2009 00:00:00 GMT-0800 (Pacific Standard Time)',
'Wed Jan 01 2010 00:00:00 GMT-0500 (Eastern Standard Time)',
'Wed Jan 01 2010 00:00:00 GMT-0800 (Pacific Standard Time)'
], 'javascript toString(), different timezones');
wrapTest(
[
'Saturday, July 3, 2010',
'Monday, August 2, 2010',
'Monday, May 3, 2010'
],[
'Monday, May 3, 2010',
'Saturday, July 3, 2010',
'Monday, August 2, 2010'
], 'Date.toString(), Date.toLocaleString()');
wrapTest(
[
'Mon, 15 Jun 2009 20:45:30 GMT',
'Mon, 3 May 2010 17:45:30 GMT',
'Mon, 15 Jun 2009 17:45:30 GMT'
],[
'Mon, 15 Jun 2009 17:45:30 GMT',
'Mon, 15 Jun 2009 20:45:30 GMT',
'Mon, 3 May 2010 17:45:30 GMT'
], 'Date.toUTCString()');
wrapTest(
[
'Saturday, July 3, 2010 1:45 PM',
'Saturday, July 3, 2010 1:45 AM',
'Monday, August 2, 2010 1:45 PM',
'Monday, May 3, 2010 1:45 PM'
],[
'Monday, May 3, 2010 1:45 PM',
'Saturday, July 3, 2010 1:45 AM',
'Saturday, July 3, 2010 1:45 PM',
'Monday, August 2, 2010 1:45 PM'
], '');
wrapTest(
[
'Saturday, July 3, 2010 1:45:30 PM',
'Saturday, July 3, 2010 1:45:29 PM',
'Monday, August 2, 2010 1:45:01 PM',
'Monday, May 3, 2010 1:45:00 PM'
],[
'Monday, May 3, 2010 1:45:00 PM',
'Saturday, July 3, 2010 1:45:29 PM',
'Saturday, July 3, 2010 1:45:30 PM',
'Monday, August 2, 2010 1:45:01 PM'
], '');
wrapTest(
[
'2/15/2009 1:45 PM',
'1/15/2009 1:45 PM',
'2/15/2009 1:45 AM'
],[
'1/15/2009 1:45 PM',
'2/15/2009 1:45 AM',
'2/15/2009 1:45 PM'
], '');
wrapTest(
[
'2010-06-15T13:45:30',
'2009-06-15T13:45:30',
'2009-06-15T01:45:30.2',
'2009-01-15T01:45:30'
],[
'2009-01-15T01:45:30',
'2009-06-15T01:45:30.2',
'2009-06-15T13:45:30',
'2010-06-15T13:45:30'
], 'ISO8601 Dates');
wrapTest(
[
'2010-06-15 13:45:30',
'2009-06-15 13:45:30',
'2009-01-15 01:45:30'
],[
'2009-01-15 01:45:30',
'2009-06-15 13:45:30',
'2010-06-15 13:45:30'
], 'ISO8601-ish YYYY-MM-DDThh:mm:ss - which does not parse into a Date instance');
wrapTest(
[
'Mon, 15 Jun 2009 20:45:30 GMT',
'Mon, 15 Jun 2009 20:45:30 PDT',
'Mon, 15 Jun 2009 20:45:30 EST',
],[
'Mon, 15 Jun 2009 20:45:30 GMT',
'Mon, 15 Jun 2009 20:45:30 EST',
'Mon, 15 Jun 2009 20:45:30 PDT'
], 'RFC1123 testing different timezones');
wrapTest(
[
'1245098730000',
'14330728000',
'1245098728000'
],[
'14330728000',
'1245098728000',
'1245098730000'
], 'unix epoch, Date.getTime()');
});
test('version number strings', function () {
wrapTest(
['1.0.2','1.0.1','1.0.0','1.0.9'],
['1.0.0','1.0.1','1.0.2','1.0.9'],
'close version numbers');
wrapTest(
['1.0.03','1.0.003','1.0.002','1.0.0001'],
['1.0.0001','1.0.002','1.0.003','1.0.03'],
'multi-digit branch release');
wrapTest(
['1.1beta','1.1.2alpha3','1.0.2alpha3','1.0.2alpha1','1.0.1alpha4','2.1.2','2.1.1'],
['1.0.1alpha4','1.0.2alpha1','1.0.2alpha3','1.1.2alpha3','1.1beta','2.1.1','2.1.2'],
'close version numbers');
wrapTest(
['myrelease-1.1.3','myrelease-1.2.3','myrelease-1.1.4','myrelease-1.1.1','myrelease-1.0.5'],
['myrelease-1.0.5','myrelease-1.1.1','myrelease-1.1.3','myrelease-1.1.4','myrelease-1.2.3'],
'string first');
});
test('numerics', function () {
wrapTest(
['10',9,2,'1','4'],
['1',2,'4',9,'10'],
'string vs number');
wrapTest(
['0001','002','001'],
['0001','001','002'],
'0 left-padded numbers');
wrapTest(
[2,1,'1','0001','002','02','001'],
['0001','001','002','02',1,'1',2],
'0 left-padded numbers and regular numbers');
wrapTest(
['10.0401',10.022,10.042,'10.021999'],
['10.021999',10.022,'10.0401',10.042],
'decimal string vs decimal, different precision');
wrapTest(
['10.04',10.02,10.03,'10.01'],
['10.01',10.02,10.03,'10.04'],
'decimal string vs decimal, same precision');
wrapTest(
['10.04f','10.039F','10.038d','10.037D'],
['10.037D','10.038d','10.039F','10.04f'],
'float/decimal with \'F\' or \'D\' notation');
wrapTest(
['10.004Z','10.039T','10.038ooo','10.037g'],
['10.004Z','10.037g','10.038ooo','10.039T'],
'not foat/decimal notation');
wrapTest(
['1.528535047e5','1.528535047e7','1.52e15','1.528535047e3','1.59e-3'],
['1.59e-3','1.528535047e3','1.528535047e5','1.528535047e7','1.52e15'],
'scientific notation');
wrapTest(
['-1','-2','4','-3','0','-5'],
['-5','-3','-2','-1','0','4'],
'negative numbers as strings');
wrapTest(
[-1,'-2',4,-3,'0','-5'],
['-5',-3,'-2',-1,'0',4],
'negative numbers as strings - mixed input type, string + numeric');
wrapTest(
[-2.01,-2.1,4.144,4.1,-2.001,-5],
[-5,-2.1,-2.01,-2.001,4.1,4.144],
'negative floats - all numeric');
});
test('IP addresses', function () {
wrapTest(
[
'192.168.0.100',
'192.168.0.1',
'192.168.1.1',
'192.168.0.250',
'192.168.1.123',
'10.0.0.2',
'10.0.0.1'
],
[
'10.0.0.1',
'10.0.0.2',
'192.168.0.1',
'192.168.0.100',
'192.168.0.250',
'192.168.1.1',
'192.168.1.123'
]);
});
test('filenames', function () {
wrapTest(
['img12.png','img10.png','img2.png','img1.png'],
['img1.png','img2.png','img10.png','img12.png'],
'simple image filenames');
wrapTest(
['car.mov','01alpha.sgi','001alpha.sgi','my.string_41299.tif','organic2.0001.sgi'],
['001alpha.sgi','01alpha.sgi','car.mov','my.string_41299.tif','organic2.0001.sgi'],
'complex filenames');
wrapTest([
'./system/kernel/js/01_ui.core.js',
'./system/kernel/js/00_jquery-1.3.2.js',
'./system/kernel/js/02_my.desktop.js'
],[
'./system/kernel/js/00_jquery-1.3.2.js',
'./system/kernel/js/01_ui.core.js',
'./system/kernel/js/02_my.desktop.js'
], 'unix filenames');
});
test('space(s) as first character(s)', function () {
wrapTest(
['alpha',' 1',' 3',' 2',0],
[0,' 1',' 2',' 3','alpha']);
});
test('empty strings and space character', function () {
wrapTest(
['10023','999','',2,5.663,5.6629],
['',2,5.6629,5.663,'999','10023']);
wrapTest(
[0,'0',''],
[0,'0','']);
});
test('hex', function () {
wrapTest(
[ '0xA','0x9','0x99' ],
[ '0x9','0xA','0x99'],
'real hex numbers');
wrapTest(
[ '0xZZ','0xVVV','0xVEV','0xUU' ],
[ '0xUU','0xVEV','0xVVV','0xZZ' ],'fake hex numbers');
});
test('unicode', function () {
wrapTest(
[ '\u0044', '\u0055', '\u0054', '\u0043' ],
[ '\u0043', '\u0044', '\u0054', '\u0055' ],
'basic latin');
});
test('sparse array sort', function () {
var sarray = [3, 2]
sarrayOutput = [1, 2, 3];
sarray[10] = 1;
for (var i=0; i < 8; i++)
sarrayOutput.push(undefined);
wrapTest(sarray, sarrayOutput,'simple sparse array');
});
test('case insensitive support', function () {
naturalSort.insensitive = true;
wrapTest(
['A', 'b', 'C', 'd', 'E', 'f'],
['A', 'b', 'C', 'd', 'E', 'f'],
'case sensitive pre-sorted array');
wrapTest(
['A', 'C', 'E', 'b', 'd', 'f'],
['A', 'b', 'C', 'd', 'E', 'f'],
'case sensitive un-sorted array');
naturalSort.insensitive = false;
wrapTest(
['A', 'C', 'E', 'b', 'd', 'f'],
['A', 'C', 'E', 'b', 'd', 'f'],
'case sensitive pre-sorted array');
wrapTest(
['A', 'b', 'C', 'd', 'E', 'f'],
['A', 'C', 'E', 'b', 'd', 'f'],
'case sensitive un-sorted array');
});
test('contributed tests', function () {
wrapTest(
['T78','U17','U10','U12','U14','745','U7','01','485','S16','S2','S22','1081','S25','1055','779','776','771','44','4','87','1091','42','480','952','951','756','1000','824','770','666','633','619','1','991','77H','PIER-7','47','29','9','77L','433'],
['01','1','4','9','29','42','44','47','77H','77L','87','433','480','485','619','633','666','745','756','770','771','776','779','824','951','952','991','1000','1055','1081','1091','PIER-7','S2','S16','S22','S25','T78','U7','U10','U12','U14','U17'],
'contributed by Bob Zeiner');
wrapTest(
[
'FSI stop, Position: 5',
'Mail Group stop, Position: 5',
'Mail Group stop, Position: 5',
'FSI stop, Position: 6',
'FSI stop, Position: 6',
'Newsstand stop, Position: 4',
'Newsstand stop, Position: 4',
'FSI stop, Position: 5'
],[
'FSI stop, Position: 5',
'FSI stop, Position: 5',
'FSI stop, Position: 6',
'FSI stop, Position: 6',
'Mail Group stop, Position: 5',
'Mail Group stop, Position: 5',
'Newsstand stop, Position: 4',
'Newsstand stop, Position: 4'
],'contributed by Scott');
wrapTest(
[2, 10, 1, 'azd', undefined, 'asd'],
[1, 2, 10, 'asd', 'azd', undefined],
'issue #2 - undefined support - jarvinen pekka');
wrapTest(
[undefined, undefined, undefined, 1, undefined],
[1, undefined, undefined, undefined],
'issue #2 - undefined support - jarvinen pekka');
wrapTest(
['-1', '-2', '4', '-3', '0', '-5'],
['-5', '-3', '-2', '-1', '0', '4'],
'issue #3 - invalid numeric string sorting - guilermo.dev');
naturalSort.insensitive = true;
wrapTest(
['9','11','22','99','A','aaaa','bbbb','Aaaa','aAaa','aa','AA','Aa','aA','BB','bB','aaA','AaA','aaa'],
['9', '11', '22', '99', 'A', 'aa', 'AA', 'Aa', 'aA', 'aaA', 'AaA', 'aaa', 'aaaa', 'Aaaa', 'aAaa', 'BB', 'bB', 'bbbb'],
'issue #5 - invalid sort order - Howie Schecter');
naturalSort.insensitive = false;
wrapTest(
['9','11','22','99','A','aaaa','bbbb','Aaaa','aAaa','aa','AA','Aa','aA','BB','bB','aaA','AaA','aaa'],
['9', '11', '22', '99', 'A', 'AA', 'Aa', 'AaA', 'Aaaa', 'BB', 'aA', 'aAaa', 'aa', 'aaA', 'aaa', 'aaaa', 'bB', 'bbbb'],
'issue #5 - invalid sort order - Howie Schecter');
wrapTest(
['5D','1A','2D','33A','5E','33K','33D','5S','2C','5C','5F','1D','2M'],
['1A','1D','2C','2D','2M','5C','5D','5E','5F','5S','33A','33D','33K'],
'alphanumeric - number first');
});
});
function wrapTest(origArray, sortArray, message) {
deepEqual($.extend([], origArray).sort(naturalSort), sortArray, (message ? message + ' - ' : '') + QUnit.jsDump.parse(origArray));
}
</script>
</head>
<body>
<h1 id='qunit-header'>js-naturalsort test suite</h1>
<h2 id='qunit-banner'></h2>
<h2 id='qunit-userAgent'></h2>
<ol id='qunit-tests' />
</body>
</html>