New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

b-engine-node-map-generator

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b-engine-node-map-generator - npm Package Compare versions

Comparing version 1.0.2 to 5.1.4

19

dist/index.d.ts

@@ -1,7 +0,7 @@

import { TiledConfigLayer } from "b-engine-tiler";
import { INodeMapTemplate } from "node-map";
import { TiledConfigLayer } from 'b-engine-tiler';
import { INodeMapTemplate } from 'node-map';
export declare enum RoadMappingEnum {
VERTICAL = "|",
HORIZONTAL = "-",
CROSSING = "+"
VERTICAL = '|',
HORIZONTAL = '-',
CROSSING = '+',
}

@@ -19,5 +19,8 @@ export declare class NodeMapGenerator {

private normalizeNodes;
processLayer(roadLayer: TiledConfigLayer, roadTypeMapping: {
[x: string]: string;
}): INodeMapTemplate;
processLayer(
roadLayer: TiledConfigLayer,
roadTypeMapping: {
[x: string]: string;
},
): INodeMapTemplate;
}
{
"name": "b-engine-node-map-generator",
"version": "1.0.2",
"version": "5.1.4",
"description": "",

@@ -13,3 +13,3 @@ "main": "dist/index.js",

"dependencies": {
"b-engine-node-map": "1.0.1",
"b-engine-node-map": "^5.1.4",
"b-engine-tiler": "^4.0.0",

@@ -22,5 +22,5 @@ "lodash": "^4.17.15",

"@types/node": "^12.7.2",
"typescript": "^3.5.3"
"typescript": "^3.8.3"
},
"gitHead": "62d46b04ee5419788203638dcfcc75b304ec3ad2"
"gitHead": "44e6dd26b1c068cf9bed40fd58554e23dd1fff15"
}

@@ -1,5 +0,5 @@

import { TiledConfigLayer } from "b-engine-tiler";
import { TiledConfigLayer } from 'b-engine-tiler';
import { chunk } from "lodash";
import { INode, IPath, INodeMapTemplate } from "node-map";
import { chunk } from 'lodash';
import { INode, IPath, INodeMapTemplate } from 'node-map';

@@ -17,5 +17,5 @@ export enum RoadMappingEnum {

private _chunks!: number[][];
private _roadTypeMapping!: {[x: string]: string};
private _roadTypeMapping!: { [x: string]: string };
private findNodeAtPosition (x: number, y: number) {
private findNodeAtPosition(x: number, y: number) {
return this._nodes.find(v => v.location.x === x && v.location.y === y);

@@ -28,6 +28,6 @@ }

private buildNodeList () {
private buildNodeList() {
let nodeIndex = 0;
const nodes: INode[] = [];
let y = 0;

@@ -41,5 +41,6 @@ this._chunks.forEach(v => {

location: {
x, y,
}
});
x,
y,
},
});
}

@@ -62,6 +63,6 @@ x++;

let node: INode | undefined;
while(found === null) {
while (found === null) {
x += directionX;
y += directionY;
if (this._chunks.length > y && this._chunks[y].length > x) {

@@ -74,4 +75,6 @@ const valueAtPosition = this._chunks[y][x];

node = this.findNodeAtPosition(x, y);
} else if (!this.checkRoadTypeMapping(valueAtPosition, RoadMappingEnum.HORIZONTAL)
&& !this.checkRoadTypeMapping(valueAtPosition, RoadMappingEnum.VERTICAL)) {
} else if (
!this.checkRoadTypeMapping(valueAtPosition, RoadMappingEnum.HORIZONTAL) &&
!this.checkRoadTypeMapping(valueAtPosition, RoadMappingEnum.VERTICAL)
) {
found = false;

@@ -84,4 +87,3 @@ }

if (!found || !node)
return null;
if (!found || !node) return null;

@@ -94,8 +96,8 @@ return {

distance: count,
}
};
}
private buildPaths () {
const paths: IPath[] = []
this._nodes.forEach((v) => {
private buildPaths() {
const paths: IPath[] = [];
this._nodes.forEach(v => {
const pathRight = this.navigateChunks(v, 1, 0);

@@ -114,3 +116,3 @@ if (pathRight) paths.push(pathRight);

private normalizeNodes () {
private normalizeNodes() {
return this._nodes.map(v => ({

@@ -121,9 +123,9 @@ ...v,

y: v.location.y * 64,
}
},
}));
}
processLayer(roadLayer: TiledConfigLayer, roadTypeMapping: {[x: string]: string}): INodeMapTemplate {
processLayer(roadLayer: TiledConfigLayer, roadTypeMapping: { [x: string]: string }): INodeMapTemplate {
this._roadTypeMapping = roadTypeMapping;
this._chunks = chunk(roadLayer.data, roadLayer.width);

@@ -135,5 +137,5 @@ this._nodes = this.buildNodeList();

nodes: this.normalizeNodes(),
paths: this._paths
}
paths: this._paths,
};
}
}
}
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"jsx": "react",
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types",
"typings/"
"lib": [
"DOM",
"es2019"
],
"types": ["node"],
"lib": [
"dom",
"es6",
"scripthost",
"es2015.iterable"
]
}
}
},
"include": ["./src"],
}
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