UNPKG

@jameslnewell/buildkite-pipelines

Version:
32 lines (31 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: all[name] }); } _export(exports, { findPlugins: function() { return findPlugins; }, findFirstPlugin: function() { return findFirstPlugin; } }); const _lib = 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.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