UNPKG

@try-at-software/input-elements

Version:

A package providing different input elements that are extensible and easily configurable for your custom needs.

19 lines (18 loc) 736 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.restrictValidPath = exports.invalidCharacters = void 0; exports.invalidCharacters = ['<', '>', ':', '"', '/', '\\', '|', '?', '*']; function restrictValidPath(errorMessage) { return (newValue) => { let error = ''; for (let i = 0; i < exports.invalidCharacters.length; i++) { const currentChar = exports.invalidCharacters[i]; if (newValue.indexOf(currentChar) >= 0) { error = errorMessage || 'The input should not contain invalid path characters!'; break; } } return error; }; } exports.restrictValidPath = restrictValidPath;