mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Tiny style correction in uniqueId and compareMultiple
This commit is contained in:
@@ -22,9 +22,9 @@ function compareMultiple(object, other, orders) {
|
|||||||
const ordersLength = orders.length
|
const ordersLength = orders.length
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var order = index < ordersLength ? orders[index] : null
|
const order = index < ordersLength ? orders[index] : null
|
||||||
var cmpFn = (order && typeof order === 'function') ? order: compareAscending
|
const cmpFn = (order && typeof order === 'function') ? order: compareAscending
|
||||||
var result = cmpFn(objCriteria[index], othCriteria[index])
|
const result = cmpFn(objCriteria[index], othCriteria[index])
|
||||||
if (result) {
|
if (result) {
|
||||||
if (order && typeof order !== 'function') {
|
if (order && typeof order !== 'function') {
|
||||||
return result * (order == 'desc' ? -1 : 1)
|
return result * (order == 'desc' ? -1 : 1)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Used to generate unique IDs. */
|
/** Used to generate unique IDs. */
|
||||||
let idCounter = {}
|
const idCounter = {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
||||||
@@ -18,12 +18,12 @@ let idCounter = {}
|
|||||||
* // => '105'
|
* // => '105'
|
||||||
*/
|
*/
|
||||||
function uniqueId(prefix='$lodash$') {
|
function uniqueId(prefix='$lodash$') {
|
||||||
if(!idCounter[prefix]){
|
if (!idCounter[prefix]) {
|
||||||
idCounter[prefix] = 0
|
idCounter[prefix] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const id =++idCounter[prefix]
|
const id =++idCounter[prefix]
|
||||||
if(prefix === '$lodash$') {
|
if (prefix === '$lodash$') {
|
||||||
return `${id}`
|
return `${id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user