forked from FoundKeyGang/FoundKey
backend: remove unused prelude modules
Much of these modules are no longer used in the backend. They seem to be from before the code was organized in packages.
This commit is contained in:
parent
c65559872b
commit
683b0cfa82
4 changed files with 0 additions and 56 deletions
|
@ -1,3 +0,0 @@
|
||||||
export function gcd(a: number, b: number): number {
|
|
||||||
return b === 0 ? a : gcd(b, a % b);
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
export interface IMaybe<T> {
|
|
||||||
isJust(): this is IJust<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IJust<T> extends IMaybe<T> {
|
|
||||||
get(): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function just<T>(value: T): IJust<T> {
|
|
||||||
return {
|
|
||||||
isJust: () => true,
|
|
||||||
get: () => value,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function nothing<T>(): IMaybe<T> {
|
|
||||||
return {
|
|
||||||
isJust: () => false,
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
export function concat(xs: string[]): string {
|
|
||||||
return xs.join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function capitalize(s: string): string {
|
|
||||||
return toUpperCase(s.charAt(0)) + toLowerCase(s.slice(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function toUpperCase(s: string): string {
|
|
||||||
return s.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function toLowerCase(s: string): string {
|
|
||||||
return s.toLowerCase();
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
import * as assert from 'assert';
|
|
||||||
import { just, nothing } from '../../src/prelude/maybe.js';
|
|
||||||
|
|
||||||
describe('just', () => {
|
|
||||||
it('has a value', () => {
|
|
||||||
assert.deepStrictEqual(just(3).isJust(), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has the inverse called get', () => {
|
|
||||||
assert.deepStrictEqual(just(3).get(), 3);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('nothing', () => {
|
|
||||||
it('has no value', () => {
|
|
||||||
assert.deepStrictEqual(nothing().isJust(), false);
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in a new issue