sdf-parser 4.0.2 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/lib/index.js +239 -0
- package/package.json +25 -16
- package/src/__tests__/__snapshots__/getEntriesBoundaries.test.js.snap +10 -0
- package/src/__tests__/checkOptions.test.js +57 -0
- package/src/__tests__/checkUndefined.test.js +24 -0
- package/src/__tests__/getEntriesBoundaries.test.js +33 -0
- package/src/__tests__/index.test.js +76 -0
- package/src/__tests__/notWellFormatted.test.js +14 -0
- package/src/__tests__/stream.test.js +98 -0
- package/src/__tests__/test.sdf +8707 -0
- package/src/__tests__/test1.sdf +38 -0
- package/src/__tests__/test2.sdf +498 -0
- package/src/__tests__/test4.sdf +37 -0
- package/src/getEntriesBoundaries.js +21 -0
- package/src/index.js +2 -7
- package/src/parse.js +31 -13
- package/src/stream.browser.js +2 -2
- package/src/stream.js +10 -16
- package/History.md +0 -100
package/src/stream.browser.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
const empty = {};
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default empty;
|
package/src/stream.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import pipeline from 'pumpify';
|
|
2
|
+
import split2 from 'split2';
|
|
3
|
+
import through2 from 'through2';
|
|
4
|
+
import filter from 'through2-filter';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
const split2 = require('split2');
|
|
5
|
-
const through2 = require('through2');
|
|
6
|
-
const filter = require('through2-filter');
|
|
7
|
-
|
|
8
|
-
const parse = require('./parse');
|
|
6
|
+
import { parse } from './parse';
|
|
9
7
|
|
|
10
8
|
const filterStream = filter.bind(null, { objectMode: true });
|
|
9
|
+
|
|
11
10
|
function filterCb(chunk) {
|
|
12
11
|
return chunk.length > 1 && chunk.trim().length > 1;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
function entries() {
|
|
14
|
+
export function entries() {
|
|
16
15
|
return pipeline.obj(
|
|
17
16
|
split2(/\r?\n\${4}.*\r?\n/),
|
|
18
17
|
filterStream(filterCb),
|
|
19
|
-
through2({ objectMode: true }, function (value, encoding, callback) {
|
|
18
|
+
through2({ objectMode: true }, function process(value, encoding, callback) {
|
|
20
19
|
const eol = value.includes('\r\n') ? '\r\n' : '\n';
|
|
21
20
|
this.push(`${value + eol}$$$$${eol}`);
|
|
22
21
|
callback();
|
|
@@ -24,10 +23,10 @@ function entries() {
|
|
|
24
23
|
);
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
function molecules(options) {
|
|
26
|
+
export function molecules(options) {
|
|
28
27
|
return pipeline.obj(
|
|
29
28
|
entries(),
|
|
30
|
-
through2({ objectMode: true }, function (value, encoding, callback) {
|
|
29
|
+
through2({ objectMode: true }, function process(value, encoding, callback) {
|
|
31
30
|
try {
|
|
32
31
|
const parsed = parse(value, options);
|
|
33
32
|
if (parsed.molecules.length === 1) {
|
|
@@ -44,8 +43,3 @@ function molecules(options) {
|
|
|
44
43
|
}),
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
module.exports = {
|
|
49
|
-
entries,
|
|
50
|
-
molecules,
|
|
51
|
-
};
|
package/History.md
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
## [4.0.2](https://github.com/cheminfo-js/sdf-parser/compare/v4.0.1...v4.0.2) (2020-06-27)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## [4.0.1](https://github.com/cheminfo-js/sdf-parser/compare/v4.0.0...v4.0.1) (2019-06-12)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* back to pumpify ([387c3eb](https://github.com/cheminfo-js/sdf-parser/commit/387c3eb))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [4.0.0](https://github.com/cheminfo-js/sdf-parser/compare/v3.1.0...v4.0.0) (2019-06-12)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Bug Fixes
|
|
18
|
-
|
|
19
|
-
* use pumpify instead of multipipe ([aed47fd](https://github.com/cheminfo-js/sdf-parser/commit/aed47fd))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### chore
|
|
23
|
-
|
|
24
|
-
* remove bower.json ([2cc05c5](https://github.com/cheminfo-js/sdf-parser/commit/2cc05c5))
|
|
25
|
-
* remove dist directory ([eba83f7](https://github.com/cheminfo-js/sdf-parser/commit/eba83f7))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Features
|
|
29
|
-
|
|
30
|
-
* add support for stream async iteration ([f41105e](https://github.com/cheminfo-js/sdf-parser/commit/f41105e))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### BREAKING CHANGES
|
|
34
|
-
|
|
35
|
-
* The "dist" directory is no longer built and published.
|
|
36
|
-
* Bower is no longer supported.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# [3.1.0](https://github.com/cheminfo-js/sdf-parser/compare/v3.0.1...v3.1.0) (2018-01-26)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## [3.0.1](https://github.com/cheminfo-js/sdf-parser/compare/v3.0.0...v3.0.1) (2018-01-06)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# [3.0.0](https://github.com/cheminfo-js/sdf-parser/compare/v2.3.1...v3.0.0) (2018-01-05)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
* add stream functions ([ac7ed88](https://github.com/cheminfo-js/sdf-parser/commit/ac7ed88))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## [2.3.1](https://github.com/cheminfo-js/sdf-parser/compare/v2.3.0...v2.3.1) (2017-07-04)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# [2.3.0](https://github.com/cheminfo-js/sdf-parser/compare/v2.2.2...v2.3.0) (2017-07-04)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## [2.2.2](https://github.com/cheminfo-js/sdf-parser/compare/v2.2.1...v2.2.2) (2016-06-23)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## [2.2.1](https://github.com/cheminfo-js/sdf-parser/compare/v2.2.0...v2.2.1) (2016-06-07)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [2.2.0](https://github.com/cheminfo-js/sdf-parser/compare/v2.1.1...v2.2.0) (2016-06-07)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## [2.1.1](https://github.com/cheminfo-js/sdf-parser/compare/v2.1.0...v2.1.1) (2016-06-06)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [2.1.0](https://github.com/cheminfo-js/sdf-parser/compare/v2.0.1...v2.1.0) (2016-06-06)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
## [2.0.1](https://github.com/cheminfo-js/sdf-parser/compare/v2.0.0...v2.0.1) (2016-05-21)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# [2.0.0](https://github.com/cheminfo-js/sdf-parser/compare/v1.0.1...v2.0.0) (2016-05-21)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## [1.0.1](https://github.com/cheminfo-js/sdf-parser/compare/v1.0.0...v1.0.1) (2015-06-10)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
# 1.0.0 (2015-02-13)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|