sdf-parser
Advanced tools
Comparing version 3.0.1 to 3.1.0
{ | ||
"name": "sdf-parser", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "SDF parser", | ||
@@ -38,8 +38,8 @@ "main": "./src/index.js", | ||
"cheminfo-tools": "^1.20.2", | ||
"eslint": "^4.14.0", | ||
"eslint-config-cheminfo": "^1.9.1", | ||
"eslint": "^4.16.0", | ||
"eslint-config-cheminfo": "^1.14.1", | ||
"eslint-plugin-no-only-tests": "^2.0.0", | ||
"jest": "^22.0.4", | ||
"jest": "^22.1.4", | ||
"openchemlib": "^5.5.0", | ||
"should": "^13.2.0" | ||
"should": "^13.2.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "dependencies": { |
@@ -39,3 +39,3 @@ # sdf-parser | ||
* mixedEOL : if set to true will try to deal with mixed End Of Line separator | ||
* dynamicTyping : convert fields containing only number to numbers (default: true) | ||
## Advanced example with filtering and modifiers | ||
@@ -42,0 +42,0 @@ |
'use strict'; | ||
function parse(sdf, options) { | ||
options = options || {}; | ||
var include = options.include; | ||
var exclude = options.exclude; | ||
var filter = options.filter; | ||
var modifiers = options.modifiers || {}; | ||
var forEach = options.forEach || {}; | ||
function parse(sdf, options = {}) { | ||
const { | ||
include, | ||
exclude, | ||
filter, | ||
modifiers = {}, | ||
forEach = {}, | ||
dynamicTyping = true | ||
} = options; | ||
if (typeof sdf !== 'string') { | ||
@@ -50,3 +53,3 @@ throw new TypeError('Parameter "sdf" must be a string'); | ||
counter: 0, | ||
isNumeric: true, | ||
isNumeric: dynamicTyping, | ||
keep: false | ||
@@ -80,3 +83,3 @@ }; | ||
if (labels[label].isNumeric) { | ||
if (!isFinite(molecule[label])) { | ||
if (!isFinite(molecule[label]) || molecule[label].match(/^0[0-9]/)) { | ||
labels[label].isNumeric = false; | ||
@@ -83,0 +86,0 @@ } |
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
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
11472
181
0