+
+export const validFileName = (value: string) => {
+ return [
+ disallowLeadingWhitespaces,
+ disallowTrailingWhitespaces
+ ].find(aRule => value.match(aRule) !== null)
+ ? `Leading/trailing whitespaces not allowed on '${value}'`
+ : undefined;
+};
+
+export const validFilePath = (filePath: string) => {
+ const errors = filePath.split('/').map(pathPart => {
+ if (pathPart === "") { return "Empty dir name not allowed"; }
+ return validNameAllowSlash(pathPart) || validFileName(pathPart);
+ });
+ return errors.filter(e => e !== undefined)[0];
+};
\ No newline at end of file