- onenote.git
- src
- electron
- lib
- natural-compare-document.js
This file ( 809B ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
module.exports = ({ byProperty }) => {
return (a, b) => {
if (byProperty !== undefined) {
a = a[byProperty]
b = b[byProperty]
}
const regexTemplate = /(\d+)|(\D+)/g;
const ax = [], bx = [];
a.replace(regexTemplate, function (_, $1, $2) {
ax.push([$1 || Infinity, $2 || ""])
});
b.replace(regexTemplate, function (_, $1, $2) {
bx.push([$1 || Infinity, $2 || ""])
});
while (ax.length && bx.length) {
const an = ax.shift();
const bn = bx.shift();
const nn = (parseFloat(an[0]) - parseFloat(bn[0])) || an[1].localeCompare(bn[1]);
if (nn) {
return nn;
}
}
return ax.length - bx.length;
}
}