Integrado en rootly

find

  • find: arg1, 'arg2'

    • arg1. String

    • arg2. String

JS
// Pretending object is the following object [{"id": "apple"}, {"id": "banana"}]
{{ object | find: 'id', 'banana' }}
// Output
// {"id": "banana"}

get

  • get: 'arg'

    • arg. String
JS
// Pretending object is the following object {"id": "id", "incident": {"title": "Something is on fire!"}}
{{ object | get: 'incident.title' }}
// Output
// Something is on fire!

smart_date

JS
{{ 'now' | smart\_date: 'tomorrow' }}
// Output
// 2023-06-29 12:00:00 -0700

slice

  • slice: '\*arg'

    • arg. String

    • … Tantos argumentos como necesites

JS
// Pretending object is the following object {"key": "hello", "value": "world", "foo": "bar"}

{{ object | slice: 'key' }}

// Output
// {"key": "hello"}

{{ object | slice: 'key', 'foo' }}

// Output
// {"key": "hello", "foo": "bar"}

flatten

  • flatten
JS
// Pretending object is the following object \["1", "2", \["3"\]\]
{{ object | flatten }}
// Output
// \["1","2","3"\]

to_values

  • to\_values: 'key'

    • keyes opcional
JS
// Pretending object is the following object {"key": "hello", "value": "world"}
{{ object | to\_values }}

// Output
// \[{"value":"world"}\]

{{ object | to\_values: 'key' }}

// Output
// \[{"value":"hello"}\]

to_json

  • to\_json
JS
// Pretending object is the following object [{"key": "hello", "value": "world"}]
{{ object | to_json }}
// Output
// [{"key":"hello","value":"world"}]

to_iso8601

  • to\_iso8601
JS
// Pretending object is the following datetime
{{ object | to_iso8601 }}
// Output
// 2023-06-29T12:00:00-07:00

distance_of_time_in_words

  • distance\_of\_time\_in\_words: 'arg', 'precise'

    • arg. String (opcional)

    • precise. String (opcional)

JS
{{ 3720 | distance_of_time_in_words }}
// Output
// about 1 hour
{{ 3720 | distance_of_time_in_words: 0, 'precise' }}
// Output
// 1 hour and 2 minutes
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020' }}
// Output
// about 1 month
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020', 'precise' }}
// Output
// 4 weeks and 2 days

distance_of_time_in_words_to_now

  • distance\_of\_time\_in\_words\_to\_now: 'precise'

    • precise. String (opcional)
JS
{{ 'May 1, 2020' | distance_of_time_in_words_to_now }}
// Output
// over 2 years
{{ 'May 1, 2020' | distance_of_time_in_words_to_now: 'precise' }}
// Output
// 2 years and 7 months

in_time_zone

  • in\_time\_zone: 'time\_zone'

JS
{{ now | in\_time\_zone: 'Europe/London' | date: '%Y-%m-%d %H:%M %Z' }}

VerZonas horariaspara valores disponibles

to_table

  • to\_table: 'table\_type', 'title', 'time\_zone', 'format'

    • table\_typees eventos o elementos_de_acción

    • time\_zone. Cualquier zona horaria listada enZonas horarias

    • formatpuede ser ascii, markdown, html, atlassian_markdown

JS
{{ incident.events | to\_table: 'events', 'Hello world', 'America/Los\_Angeles', 'markdown' }}

regex_replace

Reemplazo global

  • regex\_replace: 'regex', 'replacement'

    • regexpuna expresión regular de ruby

    • replacementuna expresión regular de ruby

JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz baz

regex_replace_first

Reemplazo de primera coincidencia

  • regex\_replace\_first: 'regex', 'replacement'

    • regexp una expresión regular de ruby

    • replacement una expresión regular de ruby

JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz 456

regex_remove

Eliminación de coincidencia global

  • regex\_remove: 'regex'

    • regexp una expresión regular de ruby
JS
{{ 'foo bar 123 456' | regex_remove: '\d+' }}
// Output
// foo bar

regex_remove_first

Eliminación de primera coincidencia

  • regex\_remove\_first: 'regex'

    • regexp una expresión regular de ruby
JS
{{ 'foo bar 123 456' | regex_remove_first: '\d+' }}
// Output
// foo bar  456

dasherize

  • dasherize
JS
{{ 'hello_world' | dasherize }}
// Output
// hello-world

parameterize

  • parameterize

    • separator (por defecto a ’-‘)
JS
{{ 'Hello World' | parameterize }}
// Output
// hello-world
{{ 'Hello World' | parameterize: '_' }}
// Output
// hello_world

camelize

  • camelize
JS
{{ 'hello world' | camelize }}
// Output
// Hello world

titleize

  • titleize
JS
{{ 'hello world' | titleize }}
// Output
// Hello World

singularize

  • singularize
JS
{{ 'cars' | singularize }}
// Output
// car

pluralize

  • pluralize
JS
{{ 'car' | pluralize }}
// Output
// cars

humanize

  • humanize
JS
{{ '0' | humanize }}
// Output
// No
{{ '1' | humanize }}
// Output
// Yes
{{ 'incident_management' | humanize }}
// Output
// Incident Management

shuffle

  • shuffle
JS
{{ '123456789' | shuffle }}
// Output
// 973426581

Incorporado en Liquid

shortener

  • shortener
JS
{{ 'https://rootly.com/account/incidents/123456' | shortener }}
// Output
// https://root.ly/1234