{"size": 1179, "ext": "js", "max_stars_repo_path": "lib/core/pipes/pipes-context-creator.js", "max_stars_repo_name": "Obighbyd/nesk", "max_stars_repo_stars_event_min_datetime": "2018-04-02T11:00:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-28T02:34:42.000Z", "max_issues_repo_path": "lib/core/pipes/pipes-context-creator.js", "max_issues_repo_name": "Obighbyd/nesk", "max_issues_repo_issues_event_min_datetime": "2018-11-20T11:17:53.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-22T03:05:11.000Z", "max_forks_repo_path": "lib/core/pipes/pipes-context-creator.js", "max_forks_repo_name": "Obighbyd/nesk", "max_forks_repo_forks_event_min_datetime": "2018-08-09T09:31:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-28T02:34:44.000Z"}
{"max_stars_count": 30, "max_issues_count": 1, "max_forks_count": 4, "avg_line_length": 35.7272727273, "max_line_length": 96, "alphanum_fraction": 0.6590330789}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
const iterare_1 = require("iterare");
const constants_1 = require("@neskjs/common/constants");
const shared_utils_1 = require("@neskjs/common/utils/shared.utils");
const context_creator_1 = require("./../helpers/context-creator");
class PipesContextCreator extends context_creator_1.ContextCreator {
    constructor(config) {
        super();
        this.config = config;
    }
    create(instance, callback) {
        return this.createContext(instance, callback, constants_1.PIPES_METADATA);
    }
    createConcreteContext(metadata) {
        if (shared_utils_1.isUndefined(metadata) || shared_utils_1.isEmpty(metadata)) {
            return [];
        }
        return iterare_1.default(metadata)
            .filter(pipe => pipe && pipe.transform && shared_utils_1.isFunction(pipe.transform))
            .map(pipe => pipe.transform.bind(pipe))
            .toArray();
    }
    getGlobalMetadata() {
        if (!this.config) {
            return [];
        }
        return this.config.getGlobalPipes();
    }
}
exports.PipesContextCreator = PipesContextCreator;
