Page MenuHomeSealhub

float.ts
No OneTemporary

float.ts

import { Field } from "../../../main";
/** Stores a floating point number. DOes not take params. Does not allow range filtering. @todo: add range filtering */
export default class Float extends Field {
typeName = "float";
async isProperValue(_: any, input: number) {
const test = parseFloat(input.toString());
if (test === null || isNaN(test) || isNaN(input) === true) {
return Field.invalid(
`Value '${input}' is not a float number format.`
);
} else {
return Field.valid();
}
}
async encode(_: any, value: number | string) {
if (value === null) {
return null;
}
const parsed_float = parseFloat(value.toString());
return parsed_float;
}
}

File Metadata

Mime Type
text/x-java
Expires
Sun, Jul 13, 04:52 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
821786
Default Alt Text
float.ts (678 B)

Event Timeline