* Type guard to check if a RawFileInput has all UserFile required properties
(file: RawFileInput)
| 638 | * Type guard to check if a RawFileInput has all UserFile required properties |
| 639 | */ |
| 640 | function isCompleteUserFile(file: RawFileInput): file is UserFile { |
| 641 | return ( |
| 642 | typeof file.id === 'string' && |
| 643 | typeof file.name === 'string' && |
| 644 | typeof file.url === 'string' && |
| 645 | typeof file.size === 'number' && |
| 646 | typeof file.type === 'string' && |
| 647 | typeof file.key === 'string' |
| 648 | ) |
| 649 | } |
| 650 | |
| 651 | function isUrlLike(value: string): boolean { |
| 652 | return value.startsWith('http://') || value.startsWith('https://') || value.startsWith('/') |