Float.unwrap

This commit is contained in:
Tony Garnock-Jones 2021-01-29 16:06:00 +01:00
parent 1743756097
commit 95c04bd5d5
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "preserves",
"version": "0.5.1",
"version": "0.5.2",
"description": "Experimental data serialization format",
"homepage": "https://gitlab.com/preserves/preserves",
"license": "Apache-2.0",

View File

@ -94,6 +94,10 @@ export abstract class Float {
static isSingle = (x: any): x is Single => Float.isFloat(x, 'Single');
static isDouble = (x: any): x is Double => Float.isFloat(x, 'Double');
static unwrap(f: number | Float): number {
return typeof f === 'number' ? f : f.value;
}
}
export class Single extends Float implements Preservable<never> {