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

sdf-parser

Package Overview
Dependencies
Maintainers
8
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sdf-parser - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

4

History.md

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

## [4.0.2](https://github.com/cheminfo-js/sdf-parser/compare/v4.0.1...v4.0.2) (2020-06-27)
## [4.0.1](https://github.com/cheminfo-js/sdf-parser/compare/v4.0.0...v4.0.1) (2019-06-12)

@@ -2,0 +6,0 @@

22

package.json
{
"name": "sdf-parser",
"version": "4.0.1",
"version": "4.0.2",
"description": "SDF parser",

@@ -37,17 +37,19 @@ "main": "./src/index.js",

"devDependencies": {
"babel-eslint": "^10.0.1",
"babel-eslint": "^10.1.0",
"callback-stream": "^1.1.0",
"eslint": "^5.16.0",
"eslint-config-cheminfo": "^1.20.1",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jest": "^22.6.4",
"jest": "^24.8.0",
"openchemlib": "^7.1.0"
"eslint": "^7.3.1",
"eslint-config-cheminfo": "^4.0.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
"openchemlib": "^7.2.3",
"prettier": "^2.0.5"
},
"dependencies": {
"pumpify": "^2.0.0",
"pumpify": "^2.0.1",
"split2": "^3.1.1",
"through2": "^3.0.1",
"through2": "^3.0.2",
"through2-filter": "^3.0.0"
}
}

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

forEach = {},
dynamicTyping = true
dynamicTyping = true,
} = options;

@@ -18,3 +18,3 @@

var eol = '\n';
let eol = '\n';
if (options.mixedEOL) {

@@ -25,3 +25,3 @@ sdf = sdf.replace(/\r\n/g, '\n');

// we will find the delimiter in order to be much faster and not use regular expression
var header = sdf.substr(0, 1000);
let header = sdf.substr(0, 1000);
if (header.indexOf('\r\n') > -1) {

@@ -34,20 +34,20 @@ eol = '\r\n';

var sdfParts = sdf.split(new RegExp(`${eol}\\$\\$\\$\\$.*${eol}`));
var molecules = [];
var labels = {};
let sdfParts = sdf.split(new RegExp(`${eol}\\$\\$\\$\\$.*${eol}`));
let molecules = [];
let labels = {};
var start = Date.now();
let start = Date.now();
for (var i = 0; i < sdfParts.length; i++) {
var sdfPart = sdfParts[i];
var parts = sdfPart.split(`${eol}>`);
for (let i = 0; i < sdfParts.length; i++) {
let sdfPart = sdfParts[i];
let parts = sdfPart.split(`${eol}>`);
if (parts.length > 0 && parts[0].length > 5) {
var molecule = {};
var currentLabels = [];
let molecule = {};
let currentLabels = [];
molecule.molfile = parts[0] + eol;
for (var j = 1; j < parts.length; j++) {
var lines = parts[j].split(eol);
var from = lines[0].indexOf('<');
var to = lines[0].indexOf('>');
var label = lines[0].substring(from + 1, to);
for (let j = 1; j < parts.length; j++) {
let lines = parts[j].split(eol);
let from = lines[0].indexOf('<');
let to = lines[0].indexOf('>');
let label = lines[0].substring(from + 1, to);
currentLabels.push(label);

@@ -58,3 +58,3 @@ if (!labels[label]) {

isNumeric: dynamicTyping,
keep: false
keep: false,
};

@@ -71,3 +71,3 @@ if (

if (labels[label].keep) {
for (var k = 1; k < lines.length - 1; k++) {
for (let k = 1; k < lines.length - 1; k++) {
if (molecule[label]) {

@@ -80,3 +80,3 @@ molecule[label] += eol + lines[k];

if (labels[label].modifier) {
var modifiedValue = labels[label].modifier(molecule[label]);
let modifiedValue = labels[label].modifier(molecule[label]);
if (modifiedValue === undefined || modifiedValue === null) {

@@ -101,5 +101,4 @@ delete molecule[label];

// only now we can increase the counter
for (j = 0; j < currentLabels.length; j++) {
var currentLabel = currentLabels[j];
labels[currentLabel].counter++;
for (let j = 0; j < currentLabels.length; j++) {
labels[currentLabels[j]].counter++;
}

@@ -111,10 +110,10 @@ }

// all numeric fields should be converted to numbers
for (label in labels) {
currentLabel = labels[label];
for (let label in labels) {
let currentLabel = labels[label];
if (currentLabel.isNumeric) {
currentLabel.minValue = Infinity;
currentLabel.maxValue = -Infinity;
for (j = 0; j < molecules.length; j++) {
for (let j = 0; j < molecules.length; j++) {
if (molecules[j][label]) {
var value = parseFloat(molecules[j][label]);
let value = parseFloat(molecules[j][label]);
molecules[j][label] = value;

@@ -129,3 +128,3 @@ if (value > currentLabel.maxValue) currentLabel.maxValue = value;

// we check that a label is in all the records
for (var key in labels) {
for (let key in labels) {
if (labels[key].counter === molecules.length) {

@@ -138,5 +137,5 @@ labels[key].always = true;

var statistics = [];
for (key in labels) {
var statistic = labels[key];
let statistics = [];
for (let key in labels) {
let statistic = labels[key];
statistic.label = key;

@@ -150,3 +149,3 @@ statistics.push(statistic);

labels: Object.keys(labels),
statistics: statistics
statistics: statistics,
};

@@ -153,0 +152,0 @@ }

@@ -5,4 +5,4 @@ 'use strict';

const split2 = require('split2');
const through2 = require('through2');
const filter = require('through2-filter');
const through2 = require('through2');

@@ -24,3 +24,3 @@ const parse = require('./parse');

callback();
})
}),
);

@@ -46,3 +46,3 @@ }

}
})
}),
);

@@ -53,3 +53,3 @@ }

entries,
molecules
molecules,
};
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