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

xy-parser

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xy-parser - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

bower.json
{
"name": "xy-parser",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parse a text-file and convert it to an array of XY points",

@@ -5,0 +5,0 @@ "keywords": [

{
"name": "xy-parser",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parse a text-file and convert it to an array of XY points",

@@ -26,18 +26,10 @@ "keywords": [

"test": "mocha --require should --reporter mocha-better-spec-reporter --recursive",
"build": "gulp build"
"build": "cheminfo build"
},
"devDependencies": {
"browserify": "^8.1.3",
"del": "^1.1.1",
"gulp": "^3.8.11",
"gulp-header": "^1.2.2",
"gulp-rename": "^1.2.0",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.1.0",
"mocha": "latest",
"mocha-better-spec-reporter": "latest",
"should": "latest",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.0.0"
"cheminfo-tools": "^1.0.2",
"mocha": "^2.2.5",
"mocha-better-spec-reporter": "^2.1.1",
"should": "^7.0.2"
}
}

@@ -11,4 +11,13 @@ # XY text file parser

## Example of use:
```
var result=XYParser.parse(realValue, {normalize: true})
```
## Options
* normalize : will set the maximal value to 1
* arrayType :
* 'xxyy' [[x1,x2,x3,...],[y1,y2,y2,...]]
* 'xyxy' [[x1,y1],[x2,y2],[x3,y3], ...]] (default)

@@ -15,0 +24,0 @@ ## License

@@ -8,3 +8,15 @@ 'use strict';

var maxY = Number.MIN_VALUE;
var result = [];
var counter=0;
var xxyy= (options.arrayType==='xxyy') ? true : false;
if (xxyy) {
var result = [
new Array(lines.length),
new Array(lines.length)
];
} else {
var result = new Array(lines.length);
}
for (var i = 0; i < lines.length; i++) {

@@ -19,3 +31,8 @@ var line = lines[i];

if (y > maxY) maxY = y;
result.push([x, y]);
if (xxyy) {
result[0][counter]=x;
result[1][counter++]=y;
} else {
result[counter++]=[x, y];
}
}

@@ -25,7 +42,20 @@ }

if (xxyy) {
result[0].length=counter;
result[1].length=counter;
} else {
result.length=counter;
}
if (options.normalize) {
maxY /= 100;
for (var i = 0; i < result.length; i++) {
result[i][1] /= maxY;
if (xxyy) {
for (var i = 0; i < counter; i++) {
result[1][i] /= maxY;
}
} else {
for (var i = 0; i < counter; i++) {
result[i][1] /= maxY;
}
}
}

@@ -35,1 +65,3 @@

};

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