qtil
advanced-security/qtil-javascript 0.0.3
Search

Predicate truncate

Gets str or a truncated version of str with explanation appended if its length exceeds maxLength.

For example, the truncation of "long_string" for maxLength = 5 and explanation " ..." is "long_ ...".

Import path

import semmle.javascript.Util
string truncate(string str, int maxLength, string explanation)