mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
feat: migrate to esm
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* sort function for two strings
|
||||
*/
|
||||
export function stringSort(a = '', b = ''): number {
|
||||
export function stringSort(a = "", b = ""): number {
|
||||
if (a < b) return -1;
|
||||
if (a > b) return 1;
|
||||
return 0;
|
||||
@@ -25,10 +25,12 @@ export function stringSort(a = '', b = ''): number {
|
||||
/**
|
||||
* sort function for two strings that allows for a custom transform
|
||||
*/
|
||||
export function stringSortBy<T>(map: (item: T) => string | undefined): (a: T, b: T) => number {
|
||||
export function stringSortBy<T>(
|
||||
map: (item: T) => string | undefined
|
||||
): (a: T, b: T) => number {
|
||||
return (a: T, b: T): number => {
|
||||
const aValue = map(a) || '';
|
||||
const bValue = map(b) || '';
|
||||
const aValue = map(a) || "";
|
||||
const bValue = map(b) || "";
|
||||
if (aValue < bValue) return -1;
|
||||
if (aValue > bValue) return 1;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user