CodeQL library for JavaScript
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 javascript
string truncate(string str, int maxLength, string explanation)