"use strict"; const Promise = require("bluebird"); const memoizee = require("memoizee"); const smartctl = require("../../../packages/exec-smartctl"); const All = require("../../../packages/graphql-interface/symbols/all"); module.exports = function () { let scanOnce = memoizee(smartctl.scan); return function (paths) { return Promise.try(() => { return scanOnce(); }).then((devices) => { return paths.map((path) => { if (path === All) { return devices; } else { return devices.find((device) => device.path === path); } }); }); }; };