Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/js/main/core/src/lib/extension/internal/
Upload File :
Current File : /var/www/homesaver/www/bitrix/js/main/core/src/lib/extension/internal/convert-path.js

import Type from '../../type';

export default function convertPath(path: string): Array<string>
{
	if (Type.isStringFilled(path))
	{
		return path
			.split('.')
			.reduce((acc, item) => {
				item
					.split(/\[['"]?(.+?)['"]?\]/g)
					.forEach((key) => {
						if (Type.isStringFilled(key))
						{
							acc.push(key);
						}
					});

				return acc;
			}, []);
	}

	return [];
}