Skip to content

Warkanlock/MuteState

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MuteState Twitter Node.js CI

A lightweight framework to manipulate state using a queue based structure

How to use it

//Add initial values
Mute.mutate(4);
Mute.mutate(1);
Mute.mutate(2);
Mute.mutate(3);

//Fetch latest or using a step-based latest
console.log(Mute.latest()); // OUTPUT: { lastest: 4 }
console.log(Mute.latestN(1)); // OUTPUT:  { last: 1 }

//You can add objects and manipulate it inside the queue
Mute.mutate({ a: 3 });

//0 is always the latest element added
console.log(Mute.get(0)); // OUTPUT: { value : { a: 3 }}

//And you can fetch all objects instead of just one
console.log(Mute.getAll()); // OUTPUT: { value: [ { a: 3 }, 3, 2, 1, 4 ] }

Demo

Codesandbox Demo

About

A lightweight framework to manipulate state using a queue based structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published