jamsesso / json-logic-java

A pure Java implementation of JsonLogic without using the Nashorn JS engine
MIT License
99 stars 50 forks source link

Contains and startsWith #24

Closed mattpal closed 2 years ago

mattpal commented 2 years ago

Hi - for a project I'm working on it looks like we might need two additional operations:

starts_with (kind of like "in", but at beginning) contains (the opposite of "missing")

  1. Is there an existing way to do those?
  2. If not, would you accept a PR to add them?
jamsesso commented 2 years ago

@mattpal you can add custom operations to your JsonLogic object using the addOperation method:

jsonLogic.addOperation("greet", (args) -> "Hello, " + args[0] + "!");