15. Miscellaneous operations

Miscellaneous operations group is intended to perform a different data manipulations.

Let's say we have the following JavaScript file:
sentence = 'My name is ${myName}';

emptyArray = [];

fruits = ['Mango', 'Banana', 'Mango', 'Annona', 'Grape'];

The following table explains each operation and shows examples related to the JavaScript file above:

Operation Explanation Example Result
!E Converts empty strings, empty arrays and empty objects to undefined value.
${emptyArray!E}
undefined
!CL Clones JavaScript array or object instance.
It can be useful for complex nexl expressions where you are temporary modifying array or object and you need to keep an original array or object instance.
See Operations separator section which explains how to perform such operations in a single expression.
${fruits!CL}
["Mango","Banana","Mango","Annona","Grape"]
!U We have a sentence JavaScript variable which contains a ${myName} internal expression to substitute. If we try to evaluate a ${sentence} expression and myName variable is not declared/not provided, nexl will throw error because it cannot substitute an undefined value into the string.

To avoid such situation we can apply a !U operation.
This operation instructs nexl to evaluate a ${sentence!U} expression to undefined value if the sentence string contains at least one expression which is evaluated to undefined.
${sentence!U}
undefined

Watch a demo