lodash._compareascending
Advanced tools
Comparing version 2.3.0 to 2.4.0
35
index.js
/** | ||
* Lo-Dash 2.3.0 (Custom Build) <http://lodash.com/> | ||
* Lo-Dash 2.4.0 (Custom Build) <http://lodash.com/> | ||
* Build: `lodash modularize modern exports="npm" -o ./npm/` | ||
@@ -21,18 +21,25 @@ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> | ||
var ac = a.criteria, | ||
bc = b.criteria; | ||
bc = b.criteria, | ||
index = -1, | ||
length = ac.length; | ||
// ensure a stable sort in V8 and other engines | ||
// http://code.google.com/p/v8/issues/detail?id=90 | ||
if (ac !== bc) { | ||
if (ac > bc || typeof ac == 'undefined') { | ||
return 1; | ||
while (++index < length) { | ||
var value = ac[index], | ||
other = bc[index]; | ||
if (value !== other) { | ||
if (value > other || typeof value == 'undefined') { | ||
return 1; | ||
} | ||
if (value < other || typeof other == 'undefined') { | ||
return -1; | ||
} | ||
} | ||
if (ac < bc || typeof bc == 'undefined') { | ||
return -1; | ||
} | ||
} | ||
// The JS engine embedded in Adobe applications like InDesign has a buggy | ||
// `Array#sort` implementation that causes it, under certain circumstances, | ||
// to return the same value for `a` and `b`. | ||
// See https://github.com/jashkenas/underscore/pull/1247 | ||
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications | ||
// that causes it, under certain circumstances, to return the same value for | ||
// `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247 | ||
// | ||
// This also ensures a stable sort in V8 and other engines. | ||
// See http://code.google.com/p/v8/issues/detail?id=90 | ||
return a.index - b.index; | ||
@@ -39,0 +46,0 @@ } |
{ | ||
"name": "lodash._compareascending", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "The internal Lo-Dash function `compareAscending` as a Node.js module generated by lodash-cli.", | ||
@@ -16,2 +16,2 @@ "homepage": "http://lodash.com/custom-builds", | ||
"repository": { "type": "git", "url": "https://github.com/lodash/lodash-cli.git" } | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash._compareascending v2.3.0 | ||
# lodash._compareascending v2.4.0 | ||
@@ -3,0 +3,0 @@ The internal [Lo-Dash](http://lodash.com/) function `compareAscending` as a [Node.js](http://nodejs.org/) module generated by [lodash-cli](https://npmjs.org/package/lodash-cli). |
4657
43