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

dxf-parser

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dxf-parser - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

.vscode/launch.json

81

dist/dxf-parser.js

@@ -294,3 +294,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.DxfParser = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

if(!this._eof)
throw new Error('Unexpected end of input: EOF group not read before end of file');
throw new Error('Unexpected end of input: EOF group not read before end of file. Ended on code ' + this._data[this._pointer]);
else

@@ -396,3 +396,3 @@ throw new Error('Cannot call \'next\' after EOF group has been read');

//log.setLevel('trace');
// log.setLevel('debug');
//log.setLevel('debug');
//log.setLevel('info');

@@ -1122,4 +1122,3 @@ //log.setLevel('warn');

var parseVertex = function() {
var entity = { type: curr.value },
numberOfVertices = 0;
var entity = { type: curr.value };
curr = scanner.next();

@@ -1213,19 +1212,48 @@ while(curr !== 'EOF') {

var parsePolylinePoints = function(n) {
var parseLWPolylineVertices = function(n) {
if(!n || n <= 0) throw Error('n must be greater than 0 verticies');
var vertices = [], i, vertex;
var vertices = [], i;
var vertexIsStarted = false;
var vertexIsFinished = false;
for(i = 0; i < n; i++) {
vertex = parsePoint();
// check for bulge. Save it with the start point vertex of the bulge
if(curr.code === 42 && curr.value !== 0) {
vertex.bulge = curr.value;
var vertex = {};
while(curr !== 'EOF') {
if(curr.code === 0 || vertexIsFinished) break;
switch(curr.code) {
case 10: // X
if(vertexIsStarted) {
vertexIsFinished = true;
continue;
}
vertex.x = curr.value;
vertexIsStarted = true;
break;
case 20: // Y
vertex.y = curr.value;
break;
case 30: // Z
vertex.z = curr.value;
break;
case 40: // start width
vertex.startWidth = curr.value;
break;
case 41: // end width
vertex.endWidth = curr.value;
break;
case 42: // bulge
if(curr.value != 0) vertex.bulge = curr.value;
break;
default:
//todo: mark unhandled somehow?
curr = scanner.next();
continue;
}
curr = scanner.next();
}
// bulge creates an arc in a polyline
// 0.0 means straight line.
// See https://groups.google.com/forum/#!topic/comp.cad.autocad/9gn8s5O_w6E
vertices.push(vertex);
vertexIsStarted = false;
vertexIsFinished = false;
}

@@ -1417,2 +1445,10 @@ return vertices;

switch(curr.code) {
case 38:
entity.elevation = curr.value;
curr = scanner.next();
break;
case 39:
entity.depth = curr.value;
curr = scanner.next();
break;
case 70: // 1 = Closed shape, 128 = plinegen?, 0 = default

@@ -1427,4 +1463,8 @@ entity.shape = (curr.value === 1);

case 10: // X coordinate of point
entity.vertices = parsePolylinePoints(numberOfVertices);
entity.vertices = parseLWPolylineVertices(numberOfVertices);
break;
case 43:
if(curr.value !== 0) entity.width = curr.value;
curr = scanner.next();
break;
default:

@@ -1445,4 +1485,3 @@ checkCommonEntityProperties(entity);

var parsePOLYLINE = function() {
var entity = { type: curr.value, vertices: [] },
numberOfVertices = 0;
var entity = { type: curr.value, vertices: [] };
curr = scanner.next();

@@ -1510,4 +1549,10 @@ while(curr !== 'EOF') {

case 10: // X coordinate of point
entity.vertices = parsePolylinePoints(2);
entity.vertices.unshift(parsePoint());
break;
case 11:
entity.vertices.push(parsePoint());
break;
case 210:
entity.extrusionDirection = parsePoint();
break;
case 100:

@@ -1514,0 +1559,0 @@ if(curr.value == 'AcDbLine') {

@@ -27,3 +27,3 @@ /**

if(!this._eof)
throw new Error('Unexpected end of input: EOF group not read before end of file');
throw new Error('Unexpected end of input: EOF group not read before end of file. Ended on code ' + this._data[this._pointer]);
else

@@ -30,0 +30,0 @@ throw new Error('Cannot call \'next\' after EOF group has been read');

@@ -7,3 +7,3 @@ var DxfArrayScanner = require('./DxfArrayScanner.js'),

//log.setLevel('trace');
// log.setLevel('debug');
//log.setLevel('debug');
//log.setLevel('info');

@@ -733,4 +733,3 @@ //log.setLevel('warn');

var parseVertex = function() {
var entity = { type: curr.value },
numberOfVertices = 0;
var entity = { type: curr.value };
curr = scanner.next();

@@ -824,19 +823,48 @@ while(curr !== 'EOF') {

var parsePolylinePoints = function(n) {
var parseLWPolylineVertices = function(n) {
if(!n || n <= 0) throw Error('n must be greater than 0 verticies');
var vertices = [], i, vertex;
var vertices = [], i;
var vertexIsStarted = false;
var vertexIsFinished = false;
for(i = 0; i < n; i++) {
vertex = parsePoint();
// check for bulge. Save it with the start point vertex of the bulge
if(curr.code === 42 && curr.value !== 0) {
vertex.bulge = curr.value;
var vertex = {};
while(curr !== 'EOF') {
if(curr.code === 0 || vertexIsFinished) break;
switch(curr.code) {
case 10: // X
if(vertexIsStarted) {
vertexIsFinished = true;
continue;
}
vertex.x = curr.value;
vertexIsStarted = true;
break;
case 20: // Y
vertex.y = curr.value;
break;
case 30: // Z
vertex.z = curr.value;
break;
case 40: // start width
vertex.startWidth = curr.value;
break;
case 41: // end width
vertex.endWidth = curr.value;
break;
case 42: // bulge
if(curr.value != 0) vertex.bulge = curr.value;
break;
default:
//todo: mark unhandled somehow?
curr = scanner.next();
continue;
}
curr = scanner.next();
}
// bulge creates an arc in a polyline
// 0.0 means straight line.
// See https://groups.google.com/forum/#!topic/comp.cad.autocad/9gn8s5O_w6E
vertices.push(vertex);
vertexIsStarted = false;
vertexIsFinished = false;
}

@@ -1028,2 +1056,10 @@ return vertices;

switch(curr.code) {
case 38:
entity.elevation = curr.value;
curr = scanner.next();
break;
case 39:
entity.depth = curr.value;
curr = scanner.next();
break;
case 70: // 1 = Closed shape, 128 = plinegen?, 0 = default

@@ -1038,4 +1074,8 @@ entity.shape = (curr.value === 1);

case 10: // X coordinate of point
entity.vertices = parsePolylinePoints(numberOfVertices);
entity.vertices = parseLWPolylineVertices(numberOfVertices);
break;
case 43:
if(curr.value !== 0) entity.width = curr.value;
curr = scanner.next();
break;
default:

@@ -1056,4 +1096,3 @@ checkCommonEntityProperties(entity);

var parsePOLYLINE = function() {
var entity = { type: curr.value, vertices: [] },
numberOfVertices = 0;
var entity = { type: curr.value, vertices: [] };
curr = scanner.next();

@@ -1121,4 +1160,10 @@ while(curr !== 'EOF') {

case 10: // X coordinate of point
entity.vertices = parsePolylinePoints(2);
entity.vertices.unshift(parsePoint());
break;
case 11:
entity.vertices.push(parsePoint());
break;
case 210:
entity.extrusionDirection = parsePoint();
break;
case 100:

@@ -1125,0 +1170,0 @@ if(curr.value == 'AcDbLine') {

{
"name": "dxf-parser",
"version": "0.4.0",
"version": "0.4.1",
"description": "Parse dxf files into a readable, logical js object.",

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

@@ -52,2 +52,6 @@ // Type definitions for mocha 2.2.5

declare function before(description: string, action: () => void): void;
declare function before(description: string, action: (done: MochaDone) => void): void;
declare function setup(action: () => void): void;

@@ -61,2 +65,6 @@

declare function after(description: string, action: () => void): void;
declare function after(description: string, action: (done: MochaDone) => void): void;
declare function teardown(action: () => void): void;

@@ -70,2 +78,6 @@

declare function beforeEach(description: string, action: () => void): void;
declare function beforeEach(description: string, action: (done: MochaDone) => void): void;
declare function suiteSetup(action: () => void): void;

@@ -79,2 +91,6 @@

declare function afterEach(description: string, action: () => void): void;
declare function afterEach(description: string, action: (done: MochaDone) => void): void;
declare function suiteTeardown(action: () => void): void;

@@ -107,2 +123,8 @@

checkLeaks(): Mocha;
/**
* Function to allow assertion libraries to throw errors directly into mocha.
* This is useful when running tests in a browser because window.onerror will
* only receive the 'message' attribute of the Error.
*/
throwError(error: Error): void;
/** Enables growl support. */

@@ -109,0 +131,0 @@ growl(): Mocha;

Sorry, the diff of this file is too big to display

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