Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sam-ecs

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sam-ecs - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

3

dist/Entity.js

@@ -51,2 +51,3 @@ "use strict";

this._components[component.name] = component.state;
this._manager._addToComponentList(component.name, this.hash());
}

@@ -95,2 +96,4 @@

delete this._components[name];
this._manager._removeHashFromComponentList(name, this.hash());
}

@@ -97,0 +100,0 @@ }]);

@@ -73,3 +73,3 @@ 'use strict';

if (!action.components) {
throw "'" + action.actionType + "' must specify components to add to the entity!";
throw "'" + action.type + "' must specify components to add to the entity!";
}

@@ -112,3 +112,3 @@ var entity = new Entity(manager);

if (action.hash === undefined) {
throw "'" + action.actionType + "' must specify hash to remove!";
throw "'" + action.type + "' must specify hash to remove!";
}

@@ -253,3 +253,3 @@

}
this._entitiesByComponent[componentName] = this._entitiesByComponent[componentName].add(entity.hash());
this._entitiesByComponent[componentName].add(entity.hash());
}

@@ -302,2 +302,37 @@

/**
* @description - In the case that a component was removed from an entity,
* the entity would call this method of the ECS to ensure that it wasn't
* on the list for that component anymore
* @param {String} componentName - the name of the component that was
* removed from the entity
* @param {String} hash - the hash value of the entity that is to be
* removed
*/
}, {
key: '_removeHashFromComponentList',
value: function _removeHashFromComponentList(componentName, hash) {
if (!(componentName in this._entitiesByComponent)) throw new TypeError("'" + componentName.toString() + "' doesn't have" + " any entities listed!");
this._entitiesByComponent[componentName].delete(hash);
if (this._entitiesByComponent[componentName].size <= 0) {
delete this._entitiesByComponent[componentName];
}
}
/**
* @description - Adds an entity to a component list
* @param {String} componentName - the name of the component
* @param {String} hash - the hash to add to the component set
*/
}, {
key: '_addToComponentList',
value: function _addToComponentList(componentName, hash) {
if (!(componentName in this._entitiesByComponent)) this._entitiesByComponent[componentName] = new Set();
this._entitiesByComponent[componentName].add(hash);
}
/**
* @description - Returns a list of reducer functions by action type

@@ -304,0 +339,0 @@ * @param {String} actionType - type of action the reducer is triggered by

2

package.json
{
"name": "sam-ecs",
"version": "1.1.0",
"version": "1.1.1",
"description": "A specialized entity component system",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc