Skip to content

Constructor funcs for untyped values #3

@mozey

Description

@mozey

Create constructor funcs for untyped values, e.g. for ft.Bool

func BoolFromAny(val any) Bool {
  // Use type switch with logic similar to Bool.UnmarshalJSON
  // https://go.dev/tour/methods/16
}

Consider the logic for strings in Bool.UnmarshalJSON, it follows the definition for truthy described here, that is: "all values are truthy unless they are defined as falsy". The values for falsy in this packge do not correspond to JavaScript. Add "no", "disabled", and "off" as additional falsy values?

Also consider checkbox inputs: "a checkbox's value is only included in the submitted data if the checkbox is currently checked. If it is, then the value of the checkbox's value attribute is reported as the input's value, or on if no value is set"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions