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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@luminate_d/ecs

v1.0.4

Published

Object-Oriented EntityComponentSystem

Downloads

2

Readme

EntityComponentSystem

Install using this command:

$ npm install @luminate_d/ecs

Importing in browser

Use script tag to import browser build:

<script src="node_modules/@luminate_d/ecs/build/browser.js"></script>

Use by accessing ECS globals variable:

const ecs = new ECS.EntityComponentSystem();
// ...

Usage example

const ECS = require('@luminate_d/ecs'); // Import library

// Create custom component
class MyComponent extends ECS.Component {
    constructor() {
        this.something = true;
    }
}

// Create custom system
class MySystem extends ECS.System {
    filter(entity) { // filter what entities system will handle
        if(entity.hasComponent(MyComponent)) return true;
        return false;
    }
    
    update(deltaTime, entities) {
        entities.forEach(entity => {
            console.log('Updating entity', entity);
        });
    }
}
const ecs = new ECS.EntityComponentSystem(); // create ecs instance
const system = new MySystem(); // create system instance

ecs.addSystem(system); // add system to ecs

let idCounter = 0;
const entity = new ECS.Entity(idCounter++); // create entity
entity.addComponent(new MyComponent()); // add component to entity
system.addEntity(entity); // add entity to the system

// update system
let lastUpdate = Date.now();
setInterval(() => {
    let delta = lastUpdate - Date.now();
    lastUpdate = Date.now();
    
    ecs.update(delta);
}, 1000 / 60);

Documentation

Entity

entity.id - Id of the entity entity.components - Components attached to the entity

entity.addComponent(component: Component) - Attach component instance to the entity entity.removeComponent(component: Component) - Remove component from entity entity.hasComponent(component: Type<Component>): boolean - Does entity contain this component entity.getComponent(component: Type<Component>): Component - Returns component attached to the entity if it is present

System

system.filter(entity: Entity): boolean - Returns true when system will handle this entity system.update(deltaTime: number, entities: Set<Entity> | Array<Entity>) - Updates each entity

EntityComponentSystem

ecs.entities - Set of entities added to ECS ecs.systems - Set of systems added to ECS

ecs.update(deltaTime: number) - Update each system with only entities they can handle ecs.getEntities(filter: () => boolean): Array<Entity> - Returns filtered entities ecs.addEntity(entity: Entity) - Add entity to the ECS ecs.removeEntity(entity: Entity) - Remove entity from the ECS ecs.getEntity(id: number): Entity | null - Returns entity by id if its present ecs.hasEntity(entity: Entity): boolean - Does ECS contain entity

ecs.addSystem(system: System) - Add system to ECS ecs.removeSystem(system: System) - Remove system from ECS ecs.hasSystem(system: System): boolean - Does ECS contain system ecs.getSystem(system: Type<System>): System | null - Returns system if its present inside ecs