Skip to content

nativeCall

The nativeCall function allows calling specific whitelisted native JavaScript methods on strings or getting property counts for objects.

{input | nativeCall:methodName}
  • input (string or object): The value to operate on
  • methodName (string): The whitelisted method to call
  • toUpperCase - Convert string to uppercase
  • toLowerCase - Convert string to lowercase
  • trim - Remove whitespace from both ends
  • replace - Replace text in string (Note: requires additional parameters in actual implementation)
  • getPropertyCount - Returns the number of properties in an object
  • The result of the method call
  • Throws error if method is not whitelisted or doesn’t exist for the input type
{"hello world" | nativeCall:"toUpperCase"}
// Returns: "HELLO WORLD"
{"HELLO WORLD" | nativeCall:"toLowerCase"}
// Returns: "hello world"
{" spaced text " | nativeCall:"trim"}
// Returns: "spaced text"
{{"name": "John", "age": 30, "city": "NYC"} | nativeCall:"getPropertyCount"}
// Returns: 3
{vulnerability.title | nativeCall:"toUpperCase"}
// Returns vulnerability title in uppercase
{"text" | nativeCall:"substring"}
// Throws: Error - Method substring is not allowed
{123 | nativeCall:"toUpperCase"}
// Throws: Error - Method toUpperCase does not exist for the input type
  • Text formatting in reports
  • Case conversion for standardization
  • Cleaning user input data
  • Counting properties for statistics
  • Data normalization in templates

This function uses a whitelist to prevent arbitrary code execution. Only the listed methods are allowed.