Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce each-bind from Catmandu #296

Open
TobiasNx opened this issue Apr 13, 2023 · 1 comment
Open

Introduce each-bind from Catmandu #296

TobiasNx opened this issue Apr 13, 2023 · 1 comment

Comments

@TobiasNx
Copy link
Collaborator

each(path: JSONPath, var: NAME)
Execute all the fixes in the context of
every element in the JSONPath hash

do each(path: demo, var: t)
copy_field(t.value, titles.$append)
end

In OERSI I had the scenario: that I had to do this:

uniq("creator[]")
uniq("contributor[]")
uniq("sourceOrganization[]")
uniq("inLanguage[]")
uniq("learningResourceType[]")
uniq("keywords[]")
uniq("about[]")
uniq("teaches[]")
uniq("assesses[]")
uniq("competencyRequired[]")
uniq("educationalLevel[]")
uniq("encoding[]")
uniq("publisher[]")
uniq("isPartOf[]")

With do each I could do:

do each(path: ".", "var":"$i")
  if is_array(".")
    uniq(".")
  end
end
@blackwinter
Copy link
Member

Use case also depends on #191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants