all files / dist/definitions/file/ ReExportDefinition.js

90.24% Statements 37/41
77.78% Branches 7/9
75% Functions 9/12
94.44% Lines 34/36
2 branches Ignored     
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50    12× 12× 12×                            
"use strict";
var __extends = (this && this.__extends)/* istanbul ignore next */ || function (d, b) {
    for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var factories_1 = require("./../../factories");
var utils_1 = require("./../../utils");
var base_1 = require("./../base");
var ReExportDefinition = (function (_super) {
    __extends(ReExportDefinition, _super);
    function ReExportDefinition() {
        _super.apply(this, arguments);
        this.starExports = [];
        this.namedExports = [];
    }
    ReExportDefinition.prototype.getExports = function () {
        var exports = [];
        var handleDefinition = function (definition) {
            if (exports.indexOf(definition) === -1) {
                exports.push(definition);
            }
        };
        this.starExports.forEach(function (e) { return e.definitions.forEach(handleDefinition); });
        this.namedExports.forEach(function (e) { return e.definitions.forEach(handleDefinition); });
        return exports;
    };
    ReExportDefinition.prototype.addNamedExport = function (structure) {
        var def = new factories_1.StructureFactory().getNamedImportPart(structure);
        this.namedExports.push(def);
        return def;
    };
    ReExportDefinition.prototype.getNamedExport = function (searchFunction) {
        return utils_1.DefinitionUtils.getDefinitionFromListByFunc(this.namedExports, searchFunction);
    };
    ReExportDefinition.prototype.getStarExport = function (searchFunction) {
        return utils_1.DefinitionUtils.getDefinitionFromListByFunc(this.starExports, searchFunction);
    };
    ReExportDefinition.prototype.write = function (writeOptions) {
        var writer = factories_1.MainFactory.createWriter(writeOptions);
        var exportWriter = factories_1.MainFactory.createWriteFactory(writer).getReExportWriter();
        exportWriter.write(this);
        return writer.toString();
    };
    return ReExportDefinition;
}(base_1.BaseDefinition));
exports.ReExportDefinition = ReExportDefinition;
 
//# sourceMappingURL=ReExportDefinition.js.map