Refactor preprocessors module

This commit is contained in:
Surma
2018-08-01 12:32:29 +01:00
parent dce4fc70ac
commit c550fe9283
7 changed files with 63 additions and 70 deletions

View File

@@ -145,3 +145,17 @@ export async function sniffMimeType(blob: Blob): Promise<string> {
export function createImageBitmapPolyfill(blob: Blob): Promise<ImageBitmap> {
return createImageBitmap(blob);
}
/**
* @param field An HTMLInputElement, but the casting is done here to tidy up onChange.
*/
export function inputFieldValueAsNumber(field: any): number {
return Number((field as HTMLInputElement).value);
}
/**
* @param field An HTMLInputElement, but the casting is done here to tidy up onChange.
*/
export function inputFieldCheckedAsNumber(field: any): number {
return Number((field as HTMLInputElement).checked);
}