libjq-go
libjq-go copied to clipboard
Define jq libs as strings
jq can find all *.jq files in the directory specified by WithLibPath and then methods from these libraries can be used in the program. It will be useful if such libraries can be defined from strings.
libText := `
def camel:
gsub("-(?<a>[a-z])"; .a|ascii_upcase);
`
Jq().WithLibrary("methods", libText).Program(`include "methods"; .foo | camel`).Run()