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

js-to-json-logic

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-to-json-logic - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

12

lib/index.js

@@ -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)")
})
})
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