@wordpress/url
Version:
WordPress URL utilities.
28 lines (25 loc) • 674 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isValidAuthority = isValidAuthority;
/**
* Checks for invalid characters within the provided authority.
*
* @param {string} authority A string containing the URL authority.
*
* @example
* ```js
* const isValid = isValidAuthority( 'wordpress.org' ); // true
* const isNotValid = isValidAuthority( 'wordpress#org' ); // false
* ```
*
* @return {boolean} True if the argument contains a valid authority.
*/
function isValidAuthority(authority) {
if (!authority) {
return false;
}
return /^[^\s#?]+$/.test(authority);
}
//# sourceMappingURL=is-valid-authority.js.map