UNPKG

@clayui/shared

Version:

ClayShared component

28 lines (26 loc) 612 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLocatorValue = getLocatorValue; /** * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: BSD-3-Clause */ 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; }