@clayui/shared
Version:
ClayShared component
22 lines (21 loc) • 496 B
JavaScript
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
export function getLocatorValue(_ref) {
let {
item,
locator
} = _ref;
let value;
if (typeof item === 'number' || typeof item === 'string') {
return item.toString();
} else if (typeof item === 'object' && locator) {
if (typeof locator == 'function') {
value = locator(item);
} else {
value = item[locator];
}
}
return value;
}