Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Note about clearing entity variable keys

...

Code Block
languagejavascript
themeConfluence
a = { "colors" : "many",
      "pi" : [3,1,4,1,5,6,9],
      "foo" : {"bar" : {"10":"I like cheese"}}
    };
c = a.delete(["foo", "bar", "10"])
// c = { "colors" : "many",
//       "pi" : [3,1,4,1,5,6,9],
//       "foo" : {"bar": {}}
// }

Note: When dealing with an entity variable, behavior differs slightly for the top-level keys of a map. Use "clear ent:some_ent{key}" to completely remove the key-value pair from the map. Using delete will result in null being assigned to the key, with the key remaining.

filter()

The filter() operator takes a function as its only argument and returns a map. The new map contains any members of the original map for which the function evaluates to true. The function given as the argument must take two arguments and return a Boolean value. The function is applied to the key and value of each member of the map in turn. The number of elements in the new map will be less than or equal to the length of the original map. For example:

...