Code coverage report for lib/infer/augments.js

Statements: 100% (9 / 9)      Branches: 100% (6 / 6)      Functions: 100% (2 / 2)      Lines: 100% (9 / 9)      Ignored: none     

All files » lib/infer/ » augments.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31    25                   25 64 139 3     136   136 2           136      
'use strict';
 
var shouldSkipInference = require('./should_skip_inference'),
  finders = require('./finders');
 
/**
 * Infers an `augments` tag from an ES6 class declaration
 *
 * @name inferKind
 * @param {Object} comment parsed comment
 * @returns {Object} comment with kind inferred
 */
module.exports = function () {
  return shouldSkipInference(function inferAugments(comment) {
    if (comment.augments) {
      return comment;
    }
 
    var node = finders.findClass(comment.context.ast);
 
    if (node && node.superClass) {
      comment.augments = [{
        title: 'augments',
        name: node.superClass.name
      }];
    }
 
    return comment;
  });
};