
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

This package is under development.
Quickly search for entities in the 2D world with a rectangular range query.
npm i search2d
import { EntityPosition, Search2D, SearchableEntity } from "search2d";
type ExampleEntityObject = {
name: string; // Additional field
} & SearchableEntity;
// If you want to use a class, write the following
class ExampleEntityClass implements SearchableEntity {
constructor(
readonly id: string, // Required
readonly position: EntityPosition, // Required
readonly name: string, // Additional field
) {}
}
// Specify field height and width
// Entity's position range: 0 <= y <= height, 0 <= x <= width
const search = new Search2D<ExampleEntityObject>({ height: 100, width: 100 });
const entity: ExampleEntityObject = {
id: "001", // id must be unique
position: new EntityPosition({ x: 10, y: 20 }),
name: "buri",
};
// Register entity to search
search.register(entity);
// Search by query
const result = search.search({
position: {
xFrom: 10,
yFrom: 10,
xTo: 20,
yTo: 20,
},
});
console.log(result);
// {
// entities: [ { id: '001', position: [EntityPosition], name: 'buri' } ]
// }
// Move entity position (Change x, y at the same time, it is faster)
entity.position.set({ x: 15, y: 15 });
// x, y can also be set individually
entity.position.x = 15;
entity.position.y = 15;
// You can deregister entity
search.deregister(entity);
// Deregister all entities before disposing search2D instance to prevent memory leak.
search.deregisterAll();
Search2D is about 10x faster than NaiveSearch. (10k entities)
benchmark code is here
| NaiveSearch | Search2D | |
|---|---|---|
| Registration | 3ms | 17ms |
| Deregistration | 3ms | 9ms |
| Search | 1706ms | 174ms |
// NaiveSearch (https://github.com/buri83/search2d/blob/main/src/naiveSearch.ts)
const entities: T[] = [];
for (const entity of this.entities.values()) {
const isContained =
query.position.xFrom <= entity.position.x &&
entity.position.x <= query.position.xTo &&
query.position.yFrom <= entity.position.y &&
entity.position.y <= query.position.yTo;
if (isContained) {
entities.push(entity);
}
}
FAQs
Quickly search for entities in the 2D world with a rectangular range query.
The npm package search2d receives a total of 0 weekly downloads. As such, search2d popularity was classified as not popular.
We found that search2d demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.