UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

25 lines (21 loc) 779 B
'use strict'; /** * Matches exactly one letter (lowercase or uppercase). * @param {string} [type='g'] - The flag for the regular expression (default is 'g'). * @returns {RegExp} The regular expression to match exactly one letter. * @deprecated */ function oneLetter(type = 'g') { return new RegExp('^[a-zA-Z]+$', type); // Matches exactly one letter } /** * Matches one or more letters (lowercase or uppercase). * @param {string} [type='g'] - The flag for the regular expression (default is 'g'). * @returns {RegExp} The regular expression to match one or more letters. * @deprecated */ function multiLetters(type = 'g') { return new RegExp('[a-zA-Z]+', type); // Matches one or more letters } exports.multiLetters = multiLetters; exports.oneLetter = oneLetter;