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

mzmjs

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mzmjs - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

10

History.md

@@ -0,1 +1,11 @@

<a name="0.2.0"></a>
# [0.2.0](https://github.com/cheminfo-js/mzMLjs/compare/v0.1.2...v0.2.0) (2017-07-03)
### Features
* **mzData:** handle empty data tag ([9f7b8d7](https://github.com/cheminfo-js/mzMLjs/commit/9f7b8d7))
<a name="0.1.1"></a>

@@ -2,0 +12,0 @@ ## [0.1.1](https://github.com/cheminfo-js/mzMLjs/compare/v0.1.0...v0.1.1) (2017-07-03)

20

lib/index.js

@@ -28,3 +28,3 @@ 'use strict';

* @param {ArrayBuffer} data - ArrayBuffer or any Typed Array (including Node.js' Buffer from v4) with the data
* @return {{times: Array<number>, series: { ms:Array<Array<number>>}}}
* @return {{times: Array<number>, series: { ms: { data:Array<Array<number>>}}}}
*/

@@ -66,8 +66,11 @@ function mzData(data) {

case 'data':
if (binaryData.serie === 'mz') {
binaryData = node.attributes;
binaryData.serie = 'mz';
} else if (binaryData.serie === 'int') {
binaryData = node.attributes;
binaryData.serie = 'int';
if (node.isSelfClosing) {
if (binaryData.serie === 'mz') {
mz.push([]);
} else if (binaryData.serie === 'int') {
int.push([]);
}
binaryData = {};
} else if (binaryData.serie) {
binaryData.precision = node.attributes.precision;
}

@@ -96,3 +99,4 @@ break;

result.series.ms = mergeSeries(mz, int);
result.series.ms = {};
result.series.ms.data = mergeSeries(mz, int);
return result;

@@ -99,0 +103,0 @@ }

4

package.json
{
"name": "mzmjs",
"version": "0.1.2",
"version": "0.2.0",
"description": "Read and explore mzML files",

@@ -18,3 +18,3 @@ "main": "lib/index.js",

"testonly": "jest",
"build": "cheminfo build"
"build": "rollup -c && cheminfo build"
},

@@ -21,0 +21,0 @@ "repository": {

import {mzData} from '..';
import {readFileSync} from 'fs';
const pathFiles = __dirname + '/../../testFiles/';
const pathFiles = __dirname + '/../../testFiles/mzData/';

@@ -10,6 +10,16 @@ describe('mzData', () => {

expect(response.times).toEqual([5.8905, 5.944667]);
expect(response.series.ms.length).toBe(2);
expect(response.series.ms[0][0].length).toBe(1313);
expect(response.series.ms[1][0].length).toBe(43);
expect(response.series.ms.data.length).toBe(2);
expect(response.series.ms.data[0][0].length).toBe(1313);
expect(response.series.ms.data[1][0].length).toBe(43);
});
it('read real file', () => {
const data = readFileSync(pathFiles + '3-28-5.mzdata.xml');
var response = mzData(data);
expect(response.times.length).toBe(3029);
expect(response.series.ms.data.length).toBe(3029);
expect(response.series.ms.data[0][0].length).toBe(62);
expect(response.series.ms.data[1][0].length).toBe(1);
expect(response.series.ms.data[2][0].length).toBe(0);
});
});

@@ -7,3 +7,3 @@ import {parser} from 'sax';

* @param {ArrayBuffer} data - ArrayBuffer or any Typed Array (including Node.js' Buffer from v4) with the data
* @return {{times: Array<number>, series: { ms:Array<Array<number>>}}}
* @return {{times: Array<number>, series: { ms: { data:Array<Array<number>>}}}}
*/

@@ -45,8 +45,11 @@ export function mzData(data) {

case 'data':
if (binaryData.serie === 'mz') {
binaryData = node.attributes;
binaryData.serie = 'mz';
} else if (binaryData.serie === 'int') {
binaryData = node.attributes;
binaryData.serie = 'int';
if (node.isSelfClosing) {
if (binaryData.serie === 'mz') {
mz.push([]);
} else if (binaryData.serie === 'int') {
int.push([]);
}
binaryData = {};
} else if (binaryData.serie) {
binaryData.precision = node.attributes.precision;
}

@@ -75,4 +78,5 @@ break;

result.series.ms = mergeSeries(mz, int);
result.series.ms = {};
result.series.ms.data = mergeSeries(mz, int);
return result;
}
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