CodeQL library for JavaScript/TypeScript
codeql/javascript-all 2.2.1-dev (changelog, source)
Search

Member predicate Make::Container::getExtension

Gets the extension of this container, that is, the suffix of its base name after the last dot character, if any.

In particular,

  • if the name does not include a dot, there is no extension, so this predicate has no result;
  • if the name ends in a dot, the extension is the empty string;
  • if the name contains multiple dots, the extension follows the last dot.

Here are some examples of absolute paths and the corresponding extensions (surrounded with quotes to avoid ambiguity):

Absolute pathExtension
"/tmp/tst.txt""txt"
"/tmp/.classpath""classpath"
"/bin/bash"not defined
"/tmp/tst2."""
"/tmp/x.tar.gz""gz"
string getExtension()