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

eunomia

v0.0.1

Published

DCI for JS

Downloads

11

Readme

DCI project aiming Javascript

Many thanks go to Timothy Farrell for his help defining the spec.

A short description of DCI: Data, Context, Interaction

  • Data: a dumb object passed in and used inside a context
  • Context: an environment where roles are given to data to make turn them into smart objects and interact with each other
  • Interaction: interaction between actors is expressed with code inside the enclosed environment that is the context

For a more complete description please read more at the following links:

Eunomia Terminology

  • Entity: data, an object, an actor wannabe, any object given to a use case that has not yet received a role
  • Actor: Data, an object, with a specific set of roles, that will interact inside a context with other actors
  • Context: a group of one or more use case scenarios where one ore more actors will act
  • Use case: the core of your software, where all the action will happen, the place where actors will interact giving value to your application
  • Role: a set of abilities and attributes to be given to an actor

API

Eunomia exposes two main functions: role and context

eunomia.role(roleSpec, entityInterface)

  • roleSpec is a generic JSON object defining all methods that express the role
  • entityInterface is a, non mandatory, generic JSON object defining the interface that actors will have to comply to, a sort of structural static type specification

Examples:

var roles = {
    waiter: eunomia.role({
        takeOrder: function(order){},
        serve: function(){}
    }),
    manager: eunomia.role({
        createInvoiceFor: function(supplier){
            // code here
            this.createNewExcelSheet();
            // more code here
        }
    }, {
        knowsHowToCount: Boolean,
        createNewExcelSheet: Function
    }),
    customer: eunomia.role({
        orderFood: function(){},
        paysForFood: function(amount){
            // code here
            this.wallet -= amount;
            // more code here
        },
        choosesFood: function(menu){},
        eat: function(food){}
    }, {
        wallet: 1000
    })
};

eunomia.context(roles, useCases)

  • roles is a generic JSON object referring to roles created by eunomia.role
  • useCases is a generic JSON object referring to use cases as functions; these use cases will be invoked using the appropriate actors

Example:

// Using the previous roles object
var restaurant = eunomia.context(roles, {
    takeOrder: function(actors){
        var order = actors.choosesFood(actors.menu);
        actors.waiter.takeOrder(order);
    },
    serveFood: function(actors){
        var food = actors.waiter.serve();
        actors.customer.eat(food);
    }
});

var paul = {firstName: 'Paul'};
var jake = {firstName: 'Jake'};

restaurant.takeOrder({
    customer: paul,
    waiter: jake
});

restaurant.serveFood({
    customer: paul,
    waiter: jake
});

For more examples, please consider taking a look at the unit tests under spec/

For anyone interested, Eunomia is the ancient greek goddess of law and order