SonarJS linter helper functions
    Preparing search index...

    Function flattenArgs

    • Takes array of arguments. Keeps following variable definitions and unpacking arrays as long as possible. Returns flattened array with all collected nodes.

      A usage example should clarify why this might be useful. According to ExpressJs app.use spec, the arguments can be:

      • A middleware function.
      • A series of middleware functions (separated by commas).
      • An array of middleware functions.
      • A combination of all of the above.

      This means that methods like app.use accept variable arguments, but also arrays, or combinations thereof. This methods helps to flatten out such complicated composed argument lists.

      Parameters

      • context: RuleContext
      • args: Node[]

      Returns Node[]