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

minux

v0.1.0

Published

A simple library for flux architecture

Downloads

7

Readme

Minux

A simple library for flux architecture

Example

var assert = require('assert');
var minux = require('./index');


minux().set({
	a: 1,
	b: 2,
	c: {
		d: [1, 2, 3, 4, 5],
		e: {
			f: {
				g: 2
			}
		}
	}
});

assert(minux().get('a') === 1);
assert(minux().get('c.d[0]') === 1);
assert(minux('c.d').get('[0]') === 1);
assert(minux('c.e').get('f.g') === 2);

minux().set({ a: 2 });

assert(minux().get('a') === 2);
assert(minux().get('b') === 2);

minux('a').set(2);
assert(minux().get('a') === 2);

minux('a').set({
	a1: 1,
	a2: {
		a21: 1
	}
});

assert(minux().get('a.a1') === 1);
assert(minux().get('a.a2.a21') === 1);

minux('a').set('a2.a21', 3);
assert(minux().get('a.a2.a21') === 3);

minux('a.a2.a21').set(5);
assert(minux().get('a.a2.a21') === 5);

minux('a.a2').set({ a22: 6 });

assert(minux().get('a.a2.a21') === 5);
assert(minux().get('a.a2.a22') === 6);

minux('a.a2').set('a22', {a221: 6});
minux('a').set('a2.a22', {a222: 'a222'});

assert(minux().get('a.a2.a22.a221') === 6);
assert(minux().get('a.a2.a22.a222') === 'a222');

minux('a.a2.a22').replace(2);
assert(minux().get('a.a2.a22.a222') === undefined);
assert(minux().get('a.a2.a22') === 2);

console.log('-----Test notify------');
minux('a.a2.a21').on(function() {
	console.log('Value of a.a2.a21 changed to: ', JSON.stringify(minux('a.a2.a21').value()));
})

minux('a.a2').on(function() {
	console.log('Value of a.a2 changed to: ', JSON.stringify(minux('a.a2').value()));
});

minux('a').on(function() {
	console.log('Value of a changed to: ', JSON.stringify(minux('a').value()));
});

console.log('> a.a2.a23 = 1');
minux().set('a.a2', {
	a23: 1
});
console.log('\n\n');

console.log('> a.a2.a21.a211 = 1');
minux().set('a.a2.a21', {
	a211: 1
});
console.log('\n\n');

console.log('GOOD JOB!')

API

minux(path: string)

Where path is a string like foo.bar or foo.bar[0][1] or [0][1].foo['bar'].

The path also can be an array: ['foo', 'bar', 0]

The function will return a minux object

minuxObject.value()

return the value in store get by path(*)

minuxObject.get(path)

Where path is a string like foo.bar or foo.bar[0][1] or [0][1].foo['bar'].

The path also can be an array: ['foo', 'bar', 0]

return the value in object get by path

minuxObject.set(path, value)

Where path is a string like foo.bar or foo.bar[0][1] or [0][1].foo['bar'].

The path also can be an array: ['foo', 'bar', 0]

The function will shallow merge value into current value. The function will trigger to interested events

minuxObject.replace(path, value)

Where path is a string like foo.bar or foo.bar[0][1] or [0][1].foo['bar'].

The path also can be an array: ['foo', 'bar', 0]

The function will change current value to new value. The function will trigger to interested events

minuxObject.on(function)

Add an event to listen

minuxObject.off(function)

Remove an event to listen

Installation

With npm do:

npm install minux

License

MIT