reorganize directory and file structure
This commit is contained in:
parent
1d826ea8d4
commit
48390b8556
99 changed files with 1155 additions and 1629 deletions
|
|
@ -1,29 +0,0 @@
|
|||
// Total ordering of primitive types
|
||||
|
||||
export const compareNumbers = x => y => {
|
||||
if (typeof(x) !== 'number' || typeof(y) !== 'number') {
|
||||
throw new Error(`was only meant to compare numbers! got ${x} and ${y}`);
|
||||
}
|
||||
return (x < y) ? -1 : (x > y) ? 1 : 0;
|
||||
}
|
||||
|
||||
export const compareStrings = x => y => {
|
||||
if (typeof(x) !== 'string' || typeof(y) !== 'string') {
|
||||
throw new Error(`was only meant to compare strings! got ${x} and ${y}`);
|
||||
}
|
||||
return (x < y) ? -1 : (x > y) ? 1 : 0;
|
||||
}
|
||||
|
||||
export const compareBools = x => y => {
|
||||
if (typeof(x) !== 'boolean' || typeof(y) !== 'boolean') {
|
||||
throw new Error(`was only meant to compare booleans! got ${x} and ${y}`);
|
||||
}
|
||||
return x - y;
|
||||
};
|
||||
|
||||
// The Unit-type has only one instance, which is equal to itself:
|
||||
export const compareUnits = x => y => 0;
|
||||
|
||||
// Note: dirty assumption that every symbol has unique description.
|
||||
// This will be fixed once we move from symbols to real UUIDs.
|
||||
export const compareSymbols = a => b => Number(a !== b) && compareStrings(a.description)(b.description);
|
||||
Loading…
Add table
Add a link
Reference in a new issue