diff options
Diffstat (limited to 'src/js/NextSearch/Sort/SortAscending.js')
-rw-r--r-- | src/js/NextSearch/Sort/SortAscending.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/js/NextSearch/Sort/SortAscending.js b/src/js/NextSearch/Sort/SortAscending.js new file mode 100644 index 0000000..b86d131 --- /dev/null +++ b/src/js/NextSearch/Sort/SortAscending.js @@ -0,0 +1,17 @@ +import AbstractSearchSort from '@js/NextSearch/Sort/AbstractSearchSort'; + +export default class SortAscending extends AbstractSearchSort { + + get TYPE() { + return 'ascending'; + } + + _compareValues(a, b) { + if(a === b) return 0; + if(typeof a === 'string') { + if(b === null) return -1; + return a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}); + } + return a < b ? -1 : 1; + } +}
\ No newline at end of file |