Skip to content

Bars Specification 0.1.0 — Transforms

This suite defines 56 built-in transforms across 5 categories. Each links to its normative page below.

String

  • append — Concatenates a value onto the end of the input.
  • contains — Reports whether the input contains a value.
  • downcase — Lowercases the input.
  • escape — HTML-encodes reserved characters.
  • escape_once — HTML-encodes reserved characters without double-escaping existing entities.
  • lstrip — Trims leading whitespace.
  • prepend — Concatenates a value onto the start of the input.
  • remove — Removes every occurrence of a value.
  • remove_first — Removes only the first occurrence of a value.
  • remove_last — Removes only the last occurrence of a value.
  • replace — Replaces every occurrence of a substring.
  • replace_first — Replaces only the first occurrence of a substring.
  • replace_last — Replaces only the last occurrence of a substring.
  • rstrip — Trims trailing whitespace.
  • slice — Extracts a character or substring by offset.
  • split — Splits a string into a list of substrings.
  • strip — Trims leading and trailing whitespace.
  • strip_html — Removes HTML markup.
  • strip_newlines — Removes newline characters.
  • truncate — Shortens a string to a maximum length, appending an ellipsis.
  • upcase — Uppercases the input.
  • url_decode — Reverses form-encoding.
  • url_encode — Form-encodes the input.
  • url_escape — Percent-encodes the input per RFC 3986.
  • url_param_escape — Percent-encodes the input for use as a single query parameter value.

Math

  • abs — Absolute value.
  • at_least — Returns the larger of the input and a minimum.
  • at_most — Returns the smaller of the input and a maximum.
  • ceil — Rounds up to the nearest integer.
  • divided_by — Divides the input by an operand.
  • floor — Rounds down to the nearest integer.
  • minus — Subtracts an operand from the input.
  • modulo — Remainder of dividing the input by an operand.
  • plus — Adds an operand to the input.
  • round — Rounds to a number of decimal places.
  • times — Multiplies the input by an operand.

List

  • compact — Removes null elements from a list.
  • concat — Appends another list's elements.
  • find — Finds the first element matching a predicate.
  • find_index — Finds the index of the first element matching a predicate.
  • first — First element of a list, or first character of a string.
  • has — Reports whether any element matches a predicate.
  • join — Joins list elements into a string.
  • last — Last element of a list, or last character of a string.
  • map — Projects each element to a property value.
  • reject — Filters out elements matching a predicate.
  • reverse — Reverses element order.
  • size — Element count of a list, or character count of a string.
  • sort — Sorts a list.
  • sum — Sums numeric elements.
  • uniq — Removes duplicate elements.
  • where — Filters to elements matching a predicate.

Date/Time

Miscellaneous

  • default — Substitutes a fallback value for null, empty string, or empty list input.