Type class specification for actions.
Index
Ecosystem
Project | Description |
---|---|
Hoe | An action emitter library for the DOM. |
Update Function Types | Utilities for doing more complex operations based on Action and some State |
Match Action | Switch-case for Actions |
Action Component | A library to create components with Action and State |
Specification
- An
Action
consists of two properties viz.type
andvalue
. action.type
is of typestring
ornumber
.action.value
is of typeany
. It could also be of typeAction
- The object is an immutable and should never be updated.
Action Type
An action is an object which contains two properties — type
and value
.
API
action
A utility that helps in creating a new object of action type. The function is curried by default and provides type guarantee.
action'click', action'click' // curried version
isAction
A utility function that detects if the object is of Action
type.
isAction // returns falseisActionaction'WWW', null // returns true
Nil
A default action that represents nothingness.
List
A utility function that creates an Action
from a list of Action[]
.
isList
A utility function that checks if the action is of list type
isListlist //true
isNil
A utility function that checks if the action is of Nil
isNilNil // trueisNil // trueisNil // false