[chore] Reformat callback
This commit is contained in:
parent
7a598a439a
commit
8333f44e2b
|
@ -849,25 +849,25 @@ function sortArrayObjectCallback(args, value) {
|
||||||
if (typeof value == 'string') {
|
if (typeof value == 'string') {
|
||||||
try {
|
try {
|
||||||
parsedValue = JSON.parse(value);
|
parsedValue = JSON.parse(value);
|
||||||
} catch {
|
} catch {
|
||||||
// return the original input if it was invalid
|
// return the original input if it was invalid
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsedValue = value
|
parsedValue = value;
|
||||||
}
|
}
|
||||||
if (Array.isArray(parsedValue)) {
|
if (Array.isArray(parsedValue)) {
|
||||||
// always sort lists by value
|
// always sort lists by value
|
||||||
parsedValue.sort(customSortComparitor)
|
parsedValue.sort(customSortComparitor);
|
||||||
} else if (typeof parsedValue == 'object') {
|
} else if (typeof parsedValue == 'object') {
|
||||||
let keysort = args.keysort;
|
let keysort = args.keysort;
|
||||||
if (isFalseBoolean(keysort)) {
|
if (isFalseBoolean(keysort)) {
|
||||||
parsedValue = Object.keys(parsedValue).sort(function(a,b){return customSortComparitor(parsedValue[a], parsedValue[b])});
|
parsedValue = Object.keys(parsedValue).sort(function (a, b) { return customSortComparitor(parsedValue[a], parsedValue[b]); });
|
||||||
} else {
|
} else {
|
||||||
parsedValue = Object.keys(parsedValue).sort(customSortComparitor);
|
parsedValue = Object.keys(parsedValue).sort(customSortComparitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JSON.stringify(parsedValue);
|
return JSON.stringify(parsedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue