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

emptiness

v1.0.2

Published

Entity level data modeling.

Downloads

17

Readme

Emptiness

An entity level modeling library.

The key concept is to create an entity and entity is like an object in Javascript. In fact it is an object with the value property.

Moreover, entity has a default value (defVal) and validation. Value has to be validated before storing into the entity. Such that behavior can be specified in the validation.

Usage:

var spawn = require('emptiness').spawn,
	en = spawn('entity');	// i.e. enType = spawn('factory name');

var obj = en('something');	// i.e. entity = entityClass.create('something');
assert(obj.value === 'something');

More usage examples can be found under the test folder.

Pre-defined entities:

For all other pre-defined entities, please see the factory folder.

Some other brief concepts:

  • Factory creates class.
  • Class creates entity.
  • Entity is the object which has value property that stores the actual value.

Moreover, there is a helper layer called enType (entity type) between the class and entity.

The fundamental definition of enType is just

enType = entityClass.create.bind(entityClass);

such that we can just type to create an entity.

obj = enType('something');

However, it is better to use typedef.js to create enType.

var typedef = require('emptiness/lib/typedef'),
	entityFactory = require('emptiness/factory/entity'),
	entityClass = entityFactory(),
	en = typedef(entityClass);

For more about enType, please see the lib/typedef.js.

Nevertheless, I would suggest just use spawn for everything.

License:

MIT © 2015 Kei Sing Wong