flux-entity, a tiny utility library for the entity pattern
npmjs.com/package/flux-entityPosted Oct 24, 2019, 4:42 AM UTC
33
Posted Oct 24, 2019, 4:42 AM UTC
I'm curious why this is preferable to a map/dictionary:
var enties = {};
entities[id] = {blah:blah}
There is no simple way to loop over a dictionary. You have to use Object.values/keys/entries. And object key order is not guaranteed in JavaScript, sometimes leading to subtle bugs when wanting consistent ordering.
[deleted]
Author here!
After working with the flux entity pattern for a while, I've identified some reusable logic that felt like it would be helpful to extract into a small independent library.
Any and all constructive feedback is greatly appreciated.