|
12345678910111213141516171819202122232425 |
- 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;
|