CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.8.14 (changelog, source)
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)