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) 713 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ensureConsistency = void 0; const TextInputElement_1 = require("../TextInputElement"); function ensureConsistency(errorMessage) { return (newValue) => { let error = ''; for (let i = 0; i < TextInputElement_1.invalidCharacters.length; i++) { const currentChar = TextInputElement_1.invalidCharacters[i]; if (newValue.indexOf(currentChar) >= 0) { error = errorMessage || 'The input should not contain invalid path characters!'; break; } } return error; }; } exports.ensureConsistency = ensureConsistency;