UNPKG

@clayui/shared

Version:

ClayShared component

27 lines (25 loc) 943 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLocatorValue = getLocatorValue; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /** * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: BSD-3-Clause */ function getLocatorValue(_ref) { var item = _ref.item, locator = _ref.locator; var 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; }