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

sdf-parser

Package Overview
Dependencies
Maintainers
4
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 6.0.0 to 6.0.1

src/iterator.browser.js

2

lib/index.js

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

* Parse a SDF file
* @param {string|ArrayBuffer|Uint8Array} sdf SDF file to parse
* @param {NodeJS.ReadableStream} readStream SDF file to parse
* @param {object} [options={}]

@@ -200,0 +200,0 @@ * @param {Function} [options.filter] Callback allowing to filter the molecules

{
"name": "sdf-parser",
"version": "6.0.0",
"version": "6.0.1",
"description": "SDF parser",

@@ -11,5 +11,8 @@ "main": "lib/index.js",

],
"browser": {
"./src/iterator.js": "./src/iterator.browser.js"
},
"sideEffects": false,
"scripts": {
"build": "npm run compile && cheminfo-build --root SDFParser",
"build": "cheminfo-build --entry src/index.js --root SDFParser",
"compile": "rollup -c",

@@ -25,5 +28,2 @@ "eslint": "eslint src",

},
"browser": {
"./src/stream.js": "./src/stream.browser.js"
},
"repository": {

@@ -49,9 +49,10 @@ "type": "git",

"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@types/jest": "^29.1.2",
"babel-eslint": "^10.1.0",
"callback-stream": "^1.1.0",
"cheminfo-build": "^1.1.11",
"eslint": "^8.22.0",
"eslint": "^8.25.0",
"eslint-config-cheminfo": "^8.0.2",
"filelist-utils": "^0.6.0",
"jest": "^28.1.3",
"filelist-utils": "^1.0.1",
"jest": "^29.2.0",
"openchemlib": "^8.0.1",

@@ -58,0 +59,0 @@ "prettier": "^2.7.1"

@@ -1,6 +0,6 @@

import { createReadStream } from 'fs';
import { createReadStream, ReadStream } from 'fs';
import { join } from 'path';
import { createGunzip } from 'zlib';
import { fileListFromPath } from 'filelist-utils';
import { fileCollectionFromPath } from 'filelist-utils';

@@ -10,12 +10,14 @@ import { iterator } from '../iterator';

test('iterator', async () => {
const fileList = (await fileListFromPath(join(__dirname, '.'))).filter(
(file) => file.name === 'test.sdf',
);
const files = (
await fileCollectionFromPath(join(__dirname, '.'))
).files.filter((file) => file.name === 'test.sdf');
const results = [];
for await (const entry of iterator(fileList[0].stream())) {
results.push(entry);
}
expect(results).toHaveLength(128);
expect(results[0]).toMatchInlineSnapshot(`
Object {
if (parseInt(process.versions.node) >= 18) {
for await (const entry of iterator(ReadStream.fromWeb(files[0].stream()))) {
results.push(entry);
}
expect(results).toHaveLength(128);
expect(results[0]).toMatchInlineSnapshot(`
{
"CLogP": 2.7,

@@ -65,2 +67,3 @@ "Code": 100380824,

`);
}
});

@@ -77,3 +80,3 @@

expect(results[0]).toMatchInlineSnapshot(`
Object {
{
"CLogP": 2.7,

@@ -124,1 +127,61 @@ "Code": 100380824,

});
test('iterator on fileCollection stream', async () => {
const file = (await fileCollectionFromPath(join(__dirname, '.'))).filter(
(file) => file.size === 32233,
).files[0];
const results = [];
if (parseInt(process.versions.node) >= 18) {
for await (const entry of iterator(ReadStream.fromWeb(file.stream()))) {
results.push(entry);
}
expect(results).toHaveLength(128);
expect(results[0]).toMatchInlineSnapshot(`
{
"CLogP": 2.7,
"Code": 100380824,
"Number of H-Acceptors": 3,
"Number of H-Donors": 1,
"Number of Rotatable bonds": 1,
"molfile": "
-ISIS- 04231216572D
15 16 0 0 0 0 0 0 0 0999 V2000
2.4792 1.7000 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
2.4292 0.3500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4042 1.1208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2167 2.1833 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.1542 -0.0000 0.0000 S 0 0 0 0 0 0 0 0 0 0 0 0
-0.9208 1.1208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3.4792 -0.4500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.8792 3.4458 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-1.6000 -0.0292 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.9625 -1.1792 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.6208 -2.3292 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.9125 -3.4375 0.0000 Br 0 0 0 0 0 0 0 0 0 0 0 0
-3.5958 -1.1792 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.9208 -0.0292 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.0333 -2.3292 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2 1 1 0 0 0 0
3 4 1 0 0 0 0
4 1 1 0 0 0 0
5 2 1 0 0 0 0
6 3 2 0 0 0 0
7 2 2 0 0 0 0
8 4 2 0 0 0 0
9 6 1 0 0 0 0
10 9 2 0 0 0 0
11 10 1 0 0 0 0
12 11 1 0 0 0 0
13 14 2 0 0 0 0
14 9 1 0 0 0 0
15 13 1 0 0 0 0
3 5 1 0 0 0 0
15 11 2 0 0 0 0
M END
",
}
`);
}
});

@@ -6,3 +6,3 @@ import { createInterface } from 'readline';

* Parse a SDF file
* @param {string|ArrayBuffer|Uint8Array} sdf SDF file to parse
* @param {NodeJS.ReadableStream} readStream SDF file to parse
* @param {object} [options={}]

@@ -9,0 +9,0 @@ * @param {Function} [options.filter] Callback allowing to filter the molecules

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