Your IP : 3.129.24.240


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/entity-selector/src/common/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/entity-selector/src/common/encode-url.js

const regexp = /^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$/;

const isDataUri = (str: string): boolean => {
	return typeof(str) === 'string' ? str.match(regexp) : false;
};

export default function encodeUrl(url: string): string
{
	if (isDataUri(url))
	{
		return url;
	}

	return encodeURI(url);
}