mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
Replace regularCmp with cmp.
This commit is contained in:
parent
4ccab28253
commit
691cbce10f
5 changed files with 6 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
const {each, toArray, dom, regularCmp, naturalCmp} = require('../util');
|
||||
const {each, toArray, dom, cmp, naturalCmp} = require('../util');
|
||||
const event = require('../core/event');
|
||||
const resource = require('../core/resource');
|
||||
const allsettings = require('../core/settings');
|
||||
|
@ -43,7 +43,7 @@ const cmpFn = (prop, reverse, ignorecase, natural) => {
|
|||
}
|
||||
}
|
||||
|
||||
res = natural ? naturalCmp(val1, val2) : regularCmp(val1, val2);
|
||||
res = natural ? naturalCmp(val1, val2) : cmp(val1, val2);
|
||||
return reverse ? -res : res;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {each, dom, regularCmp, naturalCmp} = require('../util');
|
||||
const {each, dom, cmp, naturalCmp} = require('../util');
|
||||
const event = require('../core/event');
|
||||
const location = require('../core/location');
|
||||
const resource = require('../core/resource');
|
||||
|
@ -66,7 +66,7 @@ const cmpItems = (item1, item2) => {
|
|||
val2 = val2.toLowerCase();
|
||||
}
|
||||
|
||||
return settings.naturalSort ? naturalCmp(val1, val2) : regularCmp(val1, val2);
|
||||
return settings.naturalSort ? naturalCmp(val1, val2) : cmp(val1, val2);
|
||||
};
|
||||
|
||||
const update = item => {
|
||||
|
|
|
@ -48,9 +48,8 @@ const isElDocWin = x => isElement(x) || isDocument(x) || isWindow(x);
|
|||
const addListener = (el, type, fn) => el.addEventListener(type, fn);
|
||||
const removeListener = (el, type, fn) => el.removeEventListener(type, fn);
|
||||
|
||||
const reReady = /^(i|c|loade)/;
|
||||
const onReady = fn => {
|
||||
if (reReady.test(doc.readyState)) {
|
||||
if (/^(i|c|loade)/.test(doc.readyState)) {
|
||||
fn();
|
||||
} else {
|
||||
addListener(doc, 'DOMContentLoaded', fn);
|
||||
|
|
|
@ -62,6 +62,7 @@ module.exports = {
|
|||
toArray,
|
||||
difference,
|
||||
intersection,
|
||||
cmp,
|
||||
sortBy,
|
||||
debounce
|
||||
};
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
const regularCmp = (x, y) => x < y ? -1 : x > y ? 1 : 0;
|
||||
|
||||
const escapePattern = sequence => {
|
||||
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
|
||||
};
|
||||
|
@ -19,6 +17,5 @@ const parsePattern = (sequence, advanced) => {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
regularCmp,
|
||||
parsePattern
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue