Non-function object should not be called as a function

  • Error
  • High
  • No tags

This rule applies when a non-function object is called like a function. In such a case, an exception is thrown.

It can be applied to the following:

  1. Non-function object, e.g. plain object or primitive value, is called like a function.
  2. Non-constructor object is called with new operator.

Noncompliant Code Example

var f = {};
f(); // CALL_NON_FUNC alarm


This rule was introduced in DeepScan 1.0.0-alpha.

Was this documentation helpful?