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

sdf-parser

Package Overview
Dependencies
Maintainers
3
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 1.0.0 to 2.0.0

4

bower.json
{
"name": "sdf-parser",
"version": "1.0.0",
"version": "2.0.0",
"main": [

@@ -8,3 +8,3 @@ "dist/sdf-parser.js",

],
"homepage": "https://github.com/cheminfo/sdf-parser",
"homepage": "https://github.com/cheminfo-js/sdf-parser",
"authors": [

@@ -11,0 +11,0 @@ "Michaël Zasso"

{
"name": "sdf-parser",
"version": "1.0.0",
"version": "2.0.0",
"description": "SDF parser",

@@ -12,10 +12,7 @@ "main": "./src/index.js",

"test": "mocha --require should --reporter mocha-better-spec-reporter --recursive",
"build": "gulp build"
"build": "cheminfo build --root SDFParser"
},
"config": {
"name": "SDFParser"
},
"repository": {
"type": "git",
"url": "https://github.com/cheminfo/sdf-parser.git"
"url": "https://github.com/cheminfo-js/sdf-parser.git"
},

@@ -32,19 +29,11 @@ "keywords": [

"bugs": {
"url": "https://github.com/cheminfo/sdf-parser/issues"
"url": "https://github.com/cheminfo-js/sdf-parser/issues"
},
"homepage": "https://github.com/cheminfo/sdf-parser",
"homepage": "https://github.com/cheminfo-js/sdf-parser",
"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"
}
}

@@ -10,2 +10,24 @@ # sdf-parser

## Use of the pacakge
```bash
npm install sdf-parser
```
In node script:
```js
// allows to parse a file test.sdf that would be present in the same directory
var parse = require('sdf-parser');
var fs = require('fs');
var sdf = fs.readFileSync('./test.sdf', 'utf-8');
var result = parse(sdf);
console.log(result);
```
## Test

@@ -28,8 +50,8 @@

[npm-image]: https://img.shields.io/npm/v/sdf-parser.svg?style=flat-square
[npm-url]: https://npmjs.org/package/sdf-parser
[travis-image]: https://img.shields.io/travis/cheminfo/sdf-parser/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/cheminfo/sdf-parser
[david-image]: https://img.shields.io/david/cheminfo/sdf-parser.svg?style=flat-square
[david-url]: https://david-dm.org/cheminfo/sdf-parser
[npm-url]: https://www.npmjs.com/package/sdf-parser
[travis-image]: https://img.shields.io/travis/cheminfo-js/sdf-parser/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/cheminfo-js/sdf-parser
[david-image]: https://img.shields.io/david/cheminfo-js/sdf-parser.svg?style=flat-square
[david-url]: https://david-dm.org/cheminfo-js/sdf-parser
[download-image]: https://img.shields.io/npm/dm/sdf-parser.svg?style=flat-square
[download-url]: https://npmjs.org/package/sdf-parser
[download-url]: https://www.npmjs.com/package/sdf-parser
'use strict';
// options: an object
function parse(sdf, options) {
function parse(sdf) {
if (typeof sdf !== 'string') {
throw new TypeError('Parameter "sdf" must be a string');
}
// we will find the delimiter in order to be much faster and not use regular expression

@@ -60,14 +61,14 @@ var header = sdf.substr(0, 1000);

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

@@ -80,6 +81,6 @@ }

for (var key in labels) {
if (labels[key].counter==molecules.length) {
labels[key].always=true;
if (labels[key].counter === molecules.length) {
labels[key].always = true;
} else {
labels[key].always=false;
labels[key].always = false;
}

@@ -90,4 +91,4 @@ }

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

@@ -94,0 +95,0 @@ }

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