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.

22 lines
813B

  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 wbInputSpecInfo(inputSpec) {
  8. const isFile = (inputSpec.type === 'File' || inputSpec.type === 'File[]' ||
  9. (inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('File') !== -1));
  10. const isDirectory = (inputSpec.type === 'Directory' || inputSpec.type === 'Directory[]' ||
  11. (inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('Directory') !== -1));
  12. const isArray = (inputSpec.type === 'File[]' || inputSpec.type === 'Directory[]' ||
  13. inputSpec.type.type === 'array');
  14. return { isFile, isDirectory, isArray };
  15. }
  16. export default wbInputSpecInfo;