UNPKG

@jameslnewell/buildkite-pipelines

Version:
19 lines 889 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findPlugins = findPlugins; exports.findFirstPlugin = findFirstPlugin; const lib_1 = require("../lib"); function findPlugins(stepOrPlugins, predicate, _options = {}) { // if we have a step, get the plugins from the step, otherwise get the plugins from the iterable const stepsArray = Array.from(stepOrPlugins instanceof lib_1.CommandStep ? stepOrPlugins.getPlugins() : stepOrPlugins); // filter the steps based on the predicate const filteredPluginsArray = stepsArray.filter((plugin, index, plugins) => predicate(plugin, index, plugins)); return filteredPluginsArray; } function findFirstPlugin(stepOrPlugins, predicate, options = {}) { const plugins = findPlugins(stepOrPlugins, predicate, options); return plugins[0]; } //# sourceMappingURL=findPlugins.js.map