Module

FPO.Util

General utility functions.

#prependIf

prependIf :: forall a. Boolean -> a -> Array a -> Array a

Prepends an element to an array if the condition is true.

#isPrefixOf

isPrefixOf :: forall a. Eq a => Array a -> Array a -> Boolean

#isRealPrefixOf

isRealPrefixOf :: forall a. Eq a => Array a -> Array a -> Boolean

Checks if the first array is a proper prefix of the second array, that is, the first array is non-empty and not equal to the second array.

#singletonIf

singletonIf :: forall a. Boolean -> a -> Array a

Creates a singleton array if the condition is true, otherwise an empty array.

#handleKeyDown

handleKeyDown :: forall action. action -> action -> action -> KeyboardEvent -> action

Handles key down events for modals. In general, "Enter" confirms the action, "Escape" cancels it, and any other key does nothing.

#handleKeyDownEscape

handleKeyDownEscape :: forall action. action -> action -> KeyboardEvent -> action

Similar to 'handleKeyDown', but without the confirm action. That is, this keydown handler can be used to cancel a modal with "Escape".

#focusRef

focusRef :: forall state action slots output m. MonadEffect m => RefLabel -> HalogenM state action slots output m Unit

Focuses the given reference label, if it exists.

#isValidEmailStrict

isValidEmailStrict :: String -> Boolean

Stricter email validation that requires a proper domain with TLD. This validates that the email has:

  • A local part (before @)
  • A domain name (after @)
  • A top-level domain (at least 2 characters after the last dot)

Modules