What is the syntax to import and use jsonLogic within Svelte?
Asked
Active
Viewed 108 times
1 Answers
0
Using jsonLogic in Svelte requires no modifications to the jsonLogic javascript, simply import and use like so:
import jsonLogic from './logic.js'; // where logic.js is saved locally in your Svelte public folder
let objJL = jsonLogic; // assign the jsonLogic instance to a Svelte component variable (I simply named mine objJL)
objJL.apply({"==" : [1,1] }); // try out jsonLogic (this is a true condition)
Here it is in action using the Svelte REPL: https://svelte.dev/repl/a208faeafa4a4615bb5100015d4b1f91

w. Patrick Gale
- 1,643
- 13
- 22