Your IP : 3.138.116.124


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/parambag/src/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/parambag/src/parambag.js

export class ParamBag
{
	constructor(params = {})
	{
		if (!!params && typeof params === 'object')
		{
			this.params = new Map(Object.entries(params));
		}
		else
		{
			this.params = new Map();
		}
	}

	static create(params = {})
	{
		return new ParamBag(params);
	}

	getParam(key: string, defaultValue = null)
	{
		if (this.params.has(key))
		{
			return this.params.get(key);
		}

		return defaultValue;
	}

	setParam(key, value)
	{
		this.params.set(key, value);
	}

	clear()
	{
		this.params.clear();
	}
}