public class JsExprUtils extends Object
Important: This class may only be used in implementing plugins (e.g. functions, directives).
| Modifier and Type | Method and Description |
|---|---|
static JsExpr |
concatJsExprs(List<? extends JsExpr> jsExprs)
Builds one JS expression that computes the concatenation of the given JS expressions.
|
static boolean |
isStringLiteral(JsExpr jsExpr) |
static JsExpr |
maybeWrapAsSanitizedContent(SanitizedContent.ContentKind contentKind,
JsExpr jsExpr)
Deprecated.
This method is not safe to use without a security review, please migrate away from
it.
|
static JsExpr |
toString(JsExpr expr) |
public static JsExpr concatJsExprs(List<? extends JsExpr> jsExprs)
The resulting expression is not guaranteed to be a string if the operands do not produce strings when combined with the plus operator; e.g. 2+2 might be 4 instead of '22'.
jsExprs - The JS expressions to concatentate.public static boolean isStringLiteral(JsExpr jsExpr)
@Deprecated public static JsExpr maybeWrapAsSanitizedContent(@Nullable SanitizedContent.ContentKind contentKind, JsExpr jsExpr)
contentKind - The kind of sanitized content.jsExpr - The expression to wrap.