UNPKG

commodo-fields-float

Version:

A simple float field, used with the Commodo "withFields" higher order function.

12 lines (9 loc) 394 B
import { createField } from "@commodo/fields"; import withFieldDataTypeValidation from "@commodo/fields/fields/withFieldDataTypeValidation"; function float({ list, ...rest } = {}) { return withFieldDataTypeValidation( value => typeof value === "number" && value > -Infinity && value < Infinity )(createField({ ...rest, list, type: "float" })); } export { float };