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

ento

v0.0.1

Published

Simple, stateful, observable objects in JavaScript.

Downloads

5

Readme

ento.js

Simple, stateful, observable objects in JavaScript. Yet another model library, but this one aims to make the API experience as close to plain JavaScript objects as possible.

var User = Ento()
  .attr('id', Number)
  .attr('firstName')
  .attr('lastName');

me = new User({ firstName: 'John', lastName: 'Coltrane' });

me.firstName = 'Jacques';
me.first_name;

m.on('change', function (attrs) { ... });
  • Plain attributes: ECMAScript getters and setters are used to listen for updates in attributes. No need for methods like .get() and .set().

  • Change tracking: Listen for changes in instances via .on('change').

  • Custom sync: No persistence is built in (AJAX, SQL, etc). Implement it however you need it.

  • Model states: Keeps track of your model's state if it's fetching, or got an error. This is useful when used with data-binding view libraries.

  • Browser or Node.js: Reuse the same business code in your client-side libs and your server-side libs.

"Ento" is the Esperanto transation of the word "entity."

Status

API overview

Computed properties: you can define properties that are derived from other properties.

var Person = Ento()
  .attr('firstName')
  .attr('lastName')
  .attr('fullName', ['firstName', 'lastName'], function () {
    return [this.firstName, this.lastName].join(' ');
  });

var me = new User({ firstName: "Miles", lastName: "Davis" });

me.fullName;
=> "Miles Davis"

Plugins, and instance methods: create methods via use().

var Car = Ento()
  .use(Ento.persistence) // plugins
  .use(Ento.validation)
  .use({
    start: function () { ... },
    drive: function () { ... }
  });

var civic = new Car();
civic.start();

See the documentation for even more features.

What's it like?

  • It's like Ember.Object, except decoupled from any MVC library.
  • It's like Backbone.Model, but less emphasis on collections.
  • It's like Spine.Model, but with change tracking.
  • It's like Modella, but with collections. (You should probably try Modella, actually.)
  • It's like all of the above, with simpler syntax, and a use-only-what-you-need approach.

Acknowledgements

Contains code from Backbone.js.

Backbone's MIT license goes here