npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reclare

v0.0.4

Published

Declarative state and logic management for modern Javascript applications

Downloads

18

Readme

What is Reclare ?

Reclare is a lightweight library to manage the application state alongside business logic, without compromising from the predictability of the state. It is inspired by Redux and the Elm architecture and includes many of the familiar concepts.

Key Features

  • Manage state and logic together
  • Predictable, immutable state management
  • Handle requests / side effects
  • Built-in way to modularise your code
  • For all frameworks - offical middleware for React
  • Simple to create and use custom middlewares
  • Easy to install, minimal configuration
  • Easy-to-grasp concepts

Basic Example

View on JSFiddle

Below is an example of what declarations would look like in the context of a simple counter implementation with one simple rule: the counter cannot go below zero:

{
  on: 'increment',
  reducer: ({ state }) => ({ ...state, counter: state.counter + 1 })
  reaction: ({ state }) => console.log(`Incremented to ${state.counter}`)
},
{
  on: 'decrement',
  situation: ({ state }) => state.counter > 0,
  reducer: ({ state }) => ({ ...state, counter: state.counter - 1 }),
  reaction: ({ state }) => console.log(`Decremented to ${state.counter}`)
},
{
  on: 'decrement',
  situation: ({ state }) => state.counter <= 0,
  reaction: () => alert('Counter already at zero')
}

Upon the broadcast of increment, the first declaration will be invoked. It will increment the counter and log the updated number. decrement event hits two declarations. First one only invokes when the counter is greater than zero and decrements the counter. Second one invokes when counter is zero, and alerts the error message.

Broadcasting these events would look something like this:

<Button value="+" onClick={() => broadcast('increment')} />
<Button value="-" onClick={() => broadcast('decrement')} />

Documentation

The documentation is still under construction, it still has some missing parts. My apologies for that. I will try to complete it as soon as possible.

Click here for the documentation

Feedback

What do you think about Reclare? Do you have any ideas? I would love to hear them, and kind of feedback would be much appreciated. You can email me or contact me some other way.

Contribution

The contribution guideline for Reclare is not ready at the time being, but if you love this project and want to help, please contact me.