Skip to content

Builtin helpers

ProJor installs a bunch of helpers that you can use in your templates.

Case helpers

  • camelCase - converts a string to camelCase
    • {{camelCase "Hello World"}} -> helloWorld
  • pascalCase - converts a string to PascalCase
    • {{pascalCase "Hello World"}} -> HelloWorld
  • snakeCase - converts a string to snake_case
    • {{snakeCase "Hello World"}} -> hello_world
  • kebabCase - converts a string to kebab-case
    • {{kebabCase "Hello World"}} -> hello-world
  • constantCase - converts a string to CONSTANT_CASE
    • {{upperCase "Hello World"}} -> HELLO_WORLD
  • dotCase - converts a string to dot.case
    • {{dotCase "Hello World"}} -> hello.world
  • pathCase - converts a string to path/case
    • {{pathCase "Hello World"}} -> hello/world
  • lowerCase - converts a string to lower case
    • {{lowerCase "Hello World"}} -> hello world
  • upperCase - converts a string to UPPER CASE
    • {{upperCase "Hello World"}} -> HELLO WORLD

Boolean helpers

  • boolAnd - ands multiple boolean values
    • {{#if (boolAnd flagOne flagTwo flagThree)}}Something{{/if}}
  • boolOr - ors multiple boolean values
    • {{#if (boolOr flagOne flagTwo flagThree)}}Something{{/if}}
  • boolNot - negates a boolean value
    • {{#if (boolNot flag)}}Something{{/if}}

String helpers

  • startsWith - checks if a string starts with another string
    • {{#if (startsWith string "Hello")}}Something{{/if}}
  • endsWith - checks if a string ends with another string
    • {{#if (endsWith string "World")}}Something{{/if}}
  • contains - checks if a string contains another string
    • {{#if (contains string "Hello")}}Something{{/if}}
  • matches - checks if a string matches a regular expression
    • {{#if (matches string "Hello")}}Something{{/if}}
  • equals - checks if the two values are equal
    • {{#if (equals valueOne valueTwo)}}Something{{/if}}