Skip to content

Add type-checking modifiersΒ #42

@lowlighter

Description

@lowlighter

Scope

model

What do you want to happen?

Additional modifiers for models to make it easy to work with from the JS side.

Scope
Type casting and small transformations

Some ideas:

  • .number: force number conversion
    • .floor/.ceil,.round ? (TBD)
  • .boolean: force boolean conversion
    • using YAML booleans
  • .string: force string conversion
    • .uppercase/.lowercase (TBD)
    • .trim: trim spaces too (dismissed: difficult to implement, confusing when typing spaces before next character)
  • .nullish: treat "" as null
    • possibly <select multiple>, <input checkbox> would be null if empy arrays (dismissed: doesn't add much, easy workaround with .length)

Non-goals
Typing validation: we delegate this to browser native <input type> or to end-user discretion with their own library or custom code

I have searched for existing issues

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions