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

bitecs

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitecs - npm Package Compare versions

Comparing version 0.2.28 to 0.2.29

index.d.ts

46

dist/index.es.js

@@ -114,7 +114,4 @@ const TYPES_ENUM = {

store[$storeFlattened].forEach(ta => {
ta[eid] = 0;
if (ArrayBuffer.isView(ta)) ta[eid] = 0;else ta[eid].fill(0);
});
Object.keys(store[$storeSubarrays]).forEach(key => {
store[$storeSubarrays][key][eid].fill(0);
});
};

@@ -173,3 +170,3 @@

const isArrayType = x => Array.isArray(x) && typeof x[0] === 'object' && x[0].hasOwnProperty('type') && x[0].hasOwnProperty('length');
const isArrayType = x => Array.isArray(x) && typeof x[0] === 'string' && typeof x[1] === 'number';

@@ -220,6 +217,4 @@ const createStore = (schema, size = 1000000) => {

} else if (isArrayType(a[k])) {
const {
type,
length
} = a[k][0];
const type = a[k][0];
const length = a[k][1];
a[k] = createArrayStore(metadata, type, length);

@@ -229,5 +224,5 @@

metadata[$storeFlattened].push(a[k]);
metadata[$storeFlattened].push(a[k]); // Object.freeze(a[k])
} else if (a[k] instanceof Object) {
a[k] = Object.keys(a[k]).reduce(recursiveTransform, a[k]);
a[k] = Object.keys(a[k]).reduce(recursiveTransform, a[k]); // Object.freeze(a[k])
}

@@ -240,4 +235,5 @@

stores[$store][$storeBase] = () => stores[$store];
stores[$store][$storeBase] = () => stores[$store]; // Object.freeze(stores[$store])
return stores[$store];

@@ -366,3 +362,9 @@ }

return p[$storeFlattened];
if (Object.getOwnPropertySymbols(p).includes($storeFlattened)) {
return p[$storeFlattened];
}
if (Object.getOwnPropertySymbols(p).includes($storeBase)) {
return p;
}
}).reduce((a, v) => a.concat(v), []);

@@ -386,2 +388,5 @@ }

});
}
if (Object.getOwnPropertySymbols(ents).includes($componentMap)) {
ents = ents[$entityArray];

@@ -535,3 +540,4 @@ }

const $queryComponents = Symbol('queryComponents');
const NONE$1 = 2 ** 32;
const NONE$1 = 2 ** 32; // TODO: add ability to have multiple hooks by wrapping last hook in a function that calls this hook and last hook(s)
const enterQuery = (world, query, fn) => {

@@ -627,5 +633,9 @@ if (!world[$queryMap].has(query)) registerQuery(world, query);

const queryHooks = q => {
while (q.entered.length) q.enter(q.entered.shift());
while (q.entered.length) if (q.enter) {
q.enter(q.entered.shift());
} else q.entered.shift();
while (q.exited.length) q.exit(q.exited.shift());
while (q.exited.length) if (q.exit) {
q.exit(q.exited.shift());
} else q.exited.shift();
};

@@ -688,3 +698,3 @@

q.indices[eid] = q.entities.length - 1;
if (q.enter) q.entered.push(eid);
q.entered.push(eid);
};

@@ -721,3 +731,3 @@

world[$dirtyQueries].add(q);
if (q.exit) q.exited.push(eid);
q.exited.push(eid);
};

@@ -724,0 +734,0 @@

@@ -118,7 +118,4 @@ 'use strict';

store[$storeFlattened].forEach(ta => {
ta[eid] = 0;
if (ArrayBuffer.isView(ta)) ta[eid] = 0;else ta[eid].fill(0);
});
Object.keys(store[$storeSubarrays]).forEach(key => {
store[$storeSubarrays][key][eid].fill(0);
});
};

@@ -177,3 +174,3 @@

const isArrayType = x => Array.isArray(x) && typeof x[0] === 'object' && x[0].hasOwnProperty('type') && x[0].hasOwnProperty('length');
const isArrayType = x => Array.isArray(x) && typeof x[0] === 'string' && typeof x[1] === 'number';

@@ -224,6 +221,4 @@ const createStore = (schema, size = 1000000) => {

} else if (isArrayType(a[k])) {
const {
type,
length
} = a[k][0];
const type = a[k][0];
const length = a[k][1];
a[k] = createArrayStore(metadata, type, length);

@@ -233,5 +228,5 @@

metadata[$storeFlattened].push(a[k]);
metadata[$storeFlattened].push(a[k]); // Object.freeze(a[k])
} else if (a[k] instanceof Object) {
a[k] = Object.keys(a[k]).reduce(recursiveTransform, a[k]);
a[k] = Object.keys(a[k]).reduce(recursiveTransform, a[k]); // Object.freeze(a[k])
}

@@ -244,4 +239,5 @@

stores[$store][$storeBase] = () => stores[$store];
stores[$store][$storeBase] = () => stores[$store]; // Object.freeze(stores[$store])
return stores[$store];

@@ -370,3 +366,9 @@ }

return p[$storeFlattened];
if (Object.getOwnPropertySymbols(p).includes($storeFlattened)) {
return p[$storeFlattened];
}
if (Object.getOwnPropertySymbols(p).includes($storeBase)) {
return p;
}
}).reduce((a, v) => a.concat(v), []);

@@ -390,2 +392,5 @@ }

});
}
if (Object.getOwnPropertySymbols(ents).includes($componentMap)) {
ents = ents[$entityArray];

@@ -539,3 +544,4 @@ }

const $queryComponents = Symbol('queryComponents');
const NONE$1 = 2 ** 32;
const NONE$1 = 2 ** 32; // TODO: add ability to have multiple hooks by wrapping last hook in a function that calls this hook and last hook(s)
const enterQuery = (world, query, fn) => {

@@ -631,5 +637,9 @@ if (!world[$queryMap].has(query)) registerQuery(world, query);

const queryHooks = q => {
while (q.entered.length) q.enter(q.entered.shift());
while (q.entered.length) if (q.enter) {
q.enter(q.entered.shift());
} else q.entered.shift();
while (q.exited.length) q.exit(q.exited.shift());
while (q.exited.length) if (q.exit) {
q.exit(q.exited.shift());
} else q.exited.shift();
};

@@ -692,3 +702,3 @@

q.indices[eid] = q.entities.length - 1;
if (q.enter) q.entered.push(eid);
q.entered.push(eid);
};

@@ -725,3 +735,3 @@

world[$dirtyQueries].add(q);
if (q.exit) q.exited.push(eid);
q.exited.push(eid);
};

@@ -728,0 +738,0 @@

{
"name": "bitecs",
"version": "0.2.28",
"version": "0.2.29",
"description": "Tiny, data-driven, high performance ECS library written in Javascript",

@@ -33,4 +33,6 @@ "license": "MPL-2.0",

"devDependencies": {
"@babel/core": "^7.13.16",
"@babel/preset-env": "^7.12.1",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-babel": "^5.3.0",
"babel": "^6.23.0",
"dmd-readable": "SupremeTechnopriest/dmd-readable",

@@ -40,3 +42,4 @@ "globby": "^11.0.1",

"mocha": "^8.3.2",
"rollup": "^2.32.1"
"rollup": "^2.32.1",
"rollup-plugin-copy": "^3.4.0"
},

@@ -43,0 +46,0 @@ "babel": {

@@ -11,3 +11,3 @@ # ๐Ÿ‘พ bitECS ๐Ÿ‘พ

| ๐Ÿ”ฎ Simple, declarative API | ๐Ÿ”ฅ Blazing fast iteration |
| ๐Ÿ” Powerful & performant queries | ๐Ÿ’พ Swift serialization |
| ๐Ÿ” Powerful & performant queries | ๐Ÿ’พ Serialization included |
| ๐Ÿƒ Zero dependencies | ๐ŸŒ Node or browser |

@@ -110,2 +110,7 @@ | ๐Ÿค `~5kb` gzipped | ๐Ÿท TypeScript support |

Array types are defined as such:
```js
const List = defineComponent({ values: [f32, 6] }) // [type, length]
```
Add components to an entity in a world:

@@ -174,8 +179,7 @@ ```js

While not required, it is greatly encouraged that you keep all component data mutations inside of systems, and all system-dependent state on the world or a named system function.
While not required, it is greatly encouraged that you keep all component data mutations inside of systems.
Define a system that moves entity positions based on their velocity:
```js
const movementSystem = defineSystem(function MovementSystem (world) {
this.systemStateStuff = 'if a system is a named function you can use "this" to store system-specific state. it will also show the name in the JS profiler.'
const movementSystem = defineSystem((world) => {
const ents = movementQuery(world)

@@ -253,4 +257,4 @@ for (let i = 0; i < ents.length; i++) {

```js
const serializePositions = createSerializer([Position, Velocity.x])
const deserializePositions = createDeserializer([Position, Velocity.x])
const serializeMovement = createSerializer([Position, Velocity.x, Velocity.y])
const deserializeMovement = createDeserializer([Position, Velocity.x, Velocity.y])
```

@@ -278,2 +282,2 @@

console.log(packet.byteLength) // => 13
```
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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