IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
622B

  1. function wbUuidsToCwl(obj) {
  2. if (obj instanceof Array) {
  3. const res = [];
  4. for (let k in obj) {
  5. res[k] = uuidsToCwl(obj[k]);
  6. }
  7. return res;
  8. }
  9. if (typeof(obj) === 'string' &&
  10. (/^[0-9a-z]{5}-[0-9a-z]{5}-[0-9a-z]{15}/.exec(obj) ||
  11. /^[0-9a-f]{32}\+[0-9]+/.exec(obj))) {
  12. const isDirectory = obj.endsWith('/');
  13. return {
  14. 'class': (isDirectory ? 'Directory' : 'File'),
  15. 'location': 'keep:' + (isDirectory ? obj.substr(0, obj.length - 1) : obj)
  16. };
  17. }
  18. throw Error('Expected Arvados path or array of paths');
  19. }
  20. export default wbUuidsToCwl;