New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sideswipeloi

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sideswipeloi

### Usage

latest
npmnpm
Version
0.8.3
Version published
Maintainers
1
Created
Source

State manager for js application

Usage

import { createInstance, createAction, createAsync } from "sideswipeloi"

export const increment = createAction()
export const decrement = createAction()

export const countAsync = createAsync(() => new Promise(res => setTimeout(() => res(10), 2000)))

export const iloading = createInstance(false)
  .add(countAsync.pending, () => true)
  .reset(countAsync.done)
  .reset(countAsync.fail)

export const icount = createInstance(0)
  .add(increment, state => state + 1)
  .add(decrement, state => state - 1)
  .add(countAsync.done, (_, value) => value)

icount.subscribe(console.log)
iloading.subscribe(console.log)

increment()
// {state: 1, params: undefined}

increment(1)
// {state: 2, params: 1}

decrement()
// {state: 1, params: undefined}
;(async () => {
  await countAsync()
  // {state: 10, params: 10}
})()

FAQs

Package last updated on 14 Oct 2020

Did you know?

Socket

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.

Install

Related posts