js-to-json-logic
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -258,14 +258,8 @@ const { parse } = require('@babel/parser') | ||
try { | ||
return processNode(parse(code, { strictMode: true })) | ||
return processNode(parse(code, { strictMode: true, errorRecovery: true })) | ||
} catch (e) { | ||
return processError({ | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 0 | ||
} | ||
start: e.loc, | ||
end: e.loc | ||
} | ||
@@ -272,0 +266,0 @@ }, `Could not parse code. ${e.message}`) |
{ | ||
"name": "js-to-json-logic", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Generate JSON Logic objects using JavaScript syntax.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -62,3 +62,3 @@ # JS to JSONLogic | ||
| Numeric Literals | full | `1`, `2.04`, `-10292.64`, `0b01011010`, `0xFF00FF`, etc. | | ||
| Object Expressions / Literals | full | `{ a: [1, false, 'string'], b: false, d: 'hello' }` | | ||
| Object Expressions / Literals | full | `({ a: [1, false, 'string'], b: false, d: 'hello' })` | | ||
| Array Expressions | full | `[1, 2, 3]` | | ||
@@ -65,0 +65,0 @@ | Spread Operator in Arrays | full | `[1, 2, ...myArr]` | |
@@ -303,5 +303,6 @@ /* eslint-disable no-template-curly-in-string */ | ||
it('throw an error when syntax is invalid', function () { | ||
testError('99999eeee999e9e9e9', 'Could not parse code. Invalid number (1:0)') | ||
testError('1 / function', 'Could not parse code. Unexpected token, expected "(" (1:12)') | ||
testError('99999eeee999e9e9e9', 'Could not parse code. Identifier directly after number (1:6)') | ||
testError('#great', "Could not parse code. Unexpected character '#' (1:1)") | ||
}) | ||
}) |
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
24560
535