Skip to content

Additional Operations #1

Description

@chongkong

Currently supported operations are

  1. String interpolation
  2. Scope injection using <
  3. String filtering using |
  4. Fallback from undefined using ??

Although combinations of above operations can structure many of the configuration, there is some limitations to achieve everything. This issue is a small proposal for future improvements of operations

List Operation

Merging two lists

{
  "plus": "{{ first + second }}",
  "colons": "{{ first::second }}",
  "array_unpack": ["*{{ first }}", "*{{ second }}" ]
}

Mapping injection with list of scope (really required?)

{
  "scopes": [
    { "name": "foo" },
    { "name": "bar" },
    { "name": "cor" },
    { "name": "giz" }
  ]
}

{
  "greeting": "hello, {{ name }}",
  "greetings": "{{ greeting << scopes }}",
  "greetings2": [
    "{% for scope in scopes %}",
    "{{ greeting < scope }}",
    "{% end for %}"
  ]
}

Unique filter

{
   "duplicated": [1, 1, 2, 3, 3, 3],
   "unqiue" : "{{ duplicated | unique }}"
}

Dictionary

Merging two dictionary (really required?)

{
  "plus": "{{ first + second }}",
  "unpack": [
    "**{{ this_is_weird }}",
    "**{{ looks_like_an_array }}"
  ]
}

Integer Operation

Simple integer operation

{
   "one": 1,
   "two": "{{ one + 1 }}",
   "three": "{{ one * 3 }}",
   "four": "{{ two * two }}",
   "five": "{{ 10 / two }}"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions