|
123456789101112131415161718192021 |
- //
- // Copyright (C) Stanislaw Adaszewski, 2020
- // Contact: s.adaszewski@gmail.com
- // Website: https://adared.ch/wba
- // License: GNU Affero General Public License, Version 3
- //
-
- function wbInputSpecInfo(inputSpec) {
- const isFile = (inputSpec.type === 'File' || inputSpec.type === 'File[]' ||
- (inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('File') !== -1));
-
- const isDirectory = (inputSpec.type === 'Directory' || inputSpec.type === 'Directory[]' ||
- (inputSpec.type.type === 'array' && [].concat(inputSpec.type.items).indexOf('Directory') !== -1));
-
- const isArray = (inputSpec.type === 'File[]' || inputSpec.type === 'Directory[]' ||
- inputSpec.type.type === 'array');
-
- return { isFile, isDirectory, isArray };
- }
-
- export default wbInputSpecInfo;
|