Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@action-land/core
Advanced tools
Readme
Core library for action.
npm i @action-land/core
Action
consists of two properties viz. type
and value
.action.type
is of type string
or number
.action.value
is of type any
. It could also be of type Action
An action is an object which contains two properties — type
and value
.
interface Action<T> {
type: string
value: T
}
A utility that helps in creating a new object of action type. The function is curried by default and provides type guarantee.
import {action} from '@action-land/core'
action('click', {x: 10, y: 20})
action('click')({x: 10, y: 20}) // curried version
A utility function that detects if the object is of Action
type.
import {isAction} from '@action-land/core'
isAction({}) // returns false
isAction(action('WWW', null)) // returns true
A default action that represents nothingness.
import {Nil} from '@action-land/core'
function logic(a: number) {
if (a > 10) return action('greater', a - 10)
if (a < 10) return action('lesser', 10 - a)
return Nil
}
A utility function that creates an Action
from a list of Action[]
.
import {List} from '@action-land/core'
const list = List(action('A', 1), action('B', 2))
A utility function that checks if the action is of list type
import {isList} from '@action-land/core'
const list = List(action('A', 1), action('B', 2))
isList(list) //true
A utility function that checks if the action is of Nil
import {isNil, Nil} from '@action-land/core'
isNil(Nil) // true
isNil({type: '@@NIL', value: {}}) // true
isNil({type: 'click', value: {}}) // false
FAQs
Typeclass for action
The npm package @action-land/core receives a total of 1,046 weekly downloads. As such, @action-land/core popularity was classified as popular.
We found that @action-land/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.