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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

wb-uuids-to-cwl.js 808B

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