// // Copyright (C) Stanislaw Adaszewski, 2020 // Contact: s.adaszewski@gmail.com // Website: https://adared.ch/wba // License: GNU Affero General Public License, Version 3 // function wbUuidsToCwl(obj) { if (obj instanceof Array) { const res = []; for (let k in obj) { res[k] = wbUuidsToCwl(obj[k]); } return res; } if (typeof(obj) === 'string' && (/^[0-9a-z]{5}-[0-9a-z]{5}-[0-9a-z]{15}/.exec(obj) || /^[0-9a-f]{32}\+[0-9]+/.exec(obj))) { const isDirectory = obj.endsWith('/'); return { 'class': (isDirectory ? 'Directory' : 'File'), 'location': 'keep:' + (isDirectory ? obj.substr(0, obj.length - 1) : obj) }; } throw Error('Expected Arvados path or array of paths'); } export default wbUuidsToCwl;