Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "javascript-natural-sort",
"version": "0.7.1",
"description": "Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license",
"main": "naturalSort.js",
"keywords": [
"natural",
"sort",
"javascript",
"array",
"sort",
"sorting"
],
"author": "Jim Palmer (based on chunking idea from Dave Koelle, packaged by @khous of Bill4Time)",
"license": "MIT",
"homepage": "https://github.com/Bill4Time/javascript-natural-sort"
}
9 changes: 8 additions & 1 deletion naturalSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Author: Jim Palmer (based on chunking idea from Dave Koelle)
*/
/*jshint unused:false */
module.exports = function naturalSort (a, b) {
function naturalSort (a, b) {
"use strict";
var re = /(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,
sre = /(^[ ]*|[ ]*$)/g,
Expand Down Expand Up @@ -43,3 +43,10 @@ module.exports = function naturalSort (a, b) {
}
return 0;
};

if(typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = moduleName;
}
exports = moduleName;
}