sdf-parser
Advanced tools
Comparing version 4.0.2 to 5.0.0
{ | ||
"name": "sdf-parser", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"description": "SDF parser", | ||
"main": "./src/index.js", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"eslint": "eslint src __tests__", | ||
"build": "npm run compile && cheminfo-build --root SDFParser", | ||
"compile": "rollup -c", | ||
"eslint": "eslint src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepack": "npm run compile", | ||
"prettier": "prettier --check src", | ||
"prettier-write": "prettier --write src", | ||
"test": "npm run test-coverage && npm run eslint", | ||
@@ -21,3 +28,3 @@ "test-coverage": "jest --coverage", | ||
"type": "git", | ||
"url": "https://github.com/cheminfo-js/sdf-parser.git" | ||
"url": "https://github.com/cheminfo/sdf-parser.git" | ||
}, | ||
@@ -29,2 +36,3 @@ "keywords": [ | ||
"v2000", | ||
"v3000", | ||
"mdl" | ||
@@ -35,23 +43,22 @@ ], | ||
"bugs": { | ||
"url": "https://github.com/cheminfo-js/sdf-parser/issues" | ||
"url": "https://github.com/cheminfo/sdf-parser/issues" | ||
}, | ||
"homepage": "https://github.com/cheminfo-js/sdf-parser", | ||
"homepage": "https://github.com/cheminfo/sdf-parser", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.15.4", | ||
"babel-eslint": "^10.1.0", | ||
"callback-stream": "^1.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" | ||
"cheminfo-build": "^1.1.11", | ||
"eslint": "^7.32.0", | ||
"eslint-config-cheminfo": "^6.0.1", | ||
"jest": "^27.2.5", | ||
"openchemlib": "^7.4.3", | ||
"prettier": "^2.4.1" | ||
}, | ||
"dependencies": { | ||
"pumpify": "^2.0.1", | ||
"split2": "^3.1.1", | ||
"through2": "^3.0.2", | ||
"split2": "^3.2.2", | ||
"through2": "^4.0.2", | ||
"through2-filter": "^3.0.0" | ||
} | ||
} |
@@ -20,3 +20,3 @@ # sdf-parser | ||
var parse = require('sdf-parser'); | ||
var { parse } = require('sdf-parser'); | ||
@@ -48,12 +48,12 @@ var fs = require('fs'); | ||
modifiers: { | ||
CLogP: function(field) { | ||
CLogP: function (field) { | ||
return { | ||
low: field * 1 - 0.2, | ||
high: field * 1 + 0.2 | ||
high: field * 1 + 0.2, | ||
}; | ||
} | ||
}, | ||
}, | ||
filter: function(entry) { | ||
filter: (entry) => { | ||
return entry.CLogP && entry.CLogP.low > 4; | ||
} | ||
}, | ||
}); | ||
@@ -103,5 +103,5 @@ ``` | ||
[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 | ||
[travis-image]: https://img.shields.io/travis/cheminfo/sdf-parser/master.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/cheminfo/sdf-parser | ||
[download-image]: https://img.shields.io/npm/dm/sdf-parser.svg?style=flat-square | ||
[download-url]: https://www.npmjs.com/package/sdf-parser |
@@ -1,7 +0,2 @@ | ||
'use strict'; | ||
const parse = require('./parse'); | ||
const stream = require('./stream'); | ||
module.exports = parse; | ||
parse.stream = stream; | ||
export * from './parse'; | ||
export * from './stream'; |
@@ -1,4 +0,4 @@ | ||
'use strict'; | ||
import { getEntriesBoundaries } from './getEntriesBoundaries'; | ||
function parse(sdf, options = {}) { | ||
export function parse(sdf, options = {}) { | ||
const { | ||
@@ -31,3 +31,3 @@ include, | ||
let sdfParts = sdf.split(new RegExp(`${eol}\\$\\$\\$\\$.*${eol}`)); | ||
let entriesBoundaries = getEntriesBoundaries(sdf, `${eol}$$$$`, eol); | ||
let molecules = []; | ||
@@ -38,4 +38,4 @@ let labels = {}; | ||
for (let i = 0; i < sdfParts.length; i++) { | ||
let sdfPart = sdfParts[i]; | ||
for (let i = 0; i < entriesBoundaries.length; i++) { | ||
let sdfPart = sdf.substring(...entriesBoundaries[i]); | ||
let parts = sdfPart.split(`${eol}>`); | ||
@@ -63,4 +63,8 @@ if (parts.length > 0 && parts[0].length > 5) { | ||
labels[label].keep = true; | ||
if (modifiers[label]) labels[label].modifier = modifiers[label]; | ||
if (forEach[label]) labels[label].forEach = forEach[label]; | ||
if (modifiers[label]) { | ||
labels[label].modifier = modifiers[label]; | ||
} | ||
if (forEach[label]) { | ||
labels[label].forEach = forEach[label]; | ||
} | ||
} | ||
@@ -114,4 +118,8 @@ } | ||
molecules[j][label] = value; | ||
if (value > currentLabel.maxValue) currentLabel.maxValue = value; | ||
if (value < currentLabel.minValue) currentLabel.minValue = value; | ||
if (value > currentLabel.maxValue) { | ||
currentLabel.maxValue = value; | ||
} | ||
if (value < currentLabel.minValue) { | ||
currentLabel.minValue = value; | ||
} | ||
} | ||
@@ -145,3 +153,1 @@ } | ||
} | ||
module.exports = parse; |
@@ -1,3 +0,3 @@ | ||
'use strict'; | ||
const empty = {}; | ||
module.exports = {}; | ||
export default empty; |
@@ -1,10 +0,8 @@ | ||
'use strict'; | ||
import pipeline from 'pumpify'; | ||
import split2 from 'split2'; | ||
import through2 from 'through2'; | ||
import filter from 'through2-filter'; | ||
const pipeline = require('pumpify'); | ||
const split2 = require('split2'); | ||
const through2 = require('through2'); | ||
const filter = require('through2-filter'); | ||
import { parse } from './parse'; | ||
const parse = require('./parse'); | ||
const filterStream = filter.bind(null, { objectMode: true }); | ||
@@ -15,7 +13,7 @@ function filterCb(chunk) { | ||
function entries() { | ||
export function entries() { | ||
return pipeline.obj( | ||
split2(/\r?\n\${4}.*\r?\n/), | ||
filterStream(filterCb), | ||
through2({ objectMode: true }, function (value, encoding, callback) { | ||
through2({ objectMode: true }, function process(value, encoding, callback) { | ||
const eol = value.includes('\r\n') ? '\r\n' : '\n'; | ||
@@ -28,6 +26,6 @@ this.push(`${value + eol}$$$$${eol}`); | ||
function molecules(options) { | ||
export function molecules(options) { | ||
return pipeline.obj( | ||
entries(), | ||
through2({ objectMode: true }, function (value, encoding, callback) { | ||
through2({ objectMode: true }, function process(value, encoding, callback) { | ||
try { | ||
@@ -49,6 +47,1 @@ const parsed = parse(value, options); | ||
} | ||
module.exports = { | ||
entries, | ||
molecules, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
355284
9
18
659
6
- Removedthrough2@3.0.2(transitive)
Updatedsplit2@^3.2.2
Updatedthrough2@^4.0.2