UNPKG

@zohodesk/dot

Version:

In this Library, we Provide Some Basic Components to Build Your Application

58 lines (46 loc) 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatPhoneUrl = formatPhoneUrl; exports.getFullName = getFullName; exports.shallowDiff = shallowDiff; exports.stopBubbling = stopBubbling; function stopBubbling(event) { event.preventDefault(); event.stopPropagation && event.stopPropagation(); event.nativeEvent && event.nativeEvent.stopImmediatePropagation && event.nativeEvent.stopImmediatePropagation(); } function getFullName() { var firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var lastName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var fullName = ''; if (firstName !== null && firstName !== '') { fullName = firstName; } if (lastName !== null && lastName !== '') { fullName = "".concat(fullName).concat(lastName); } return fullName; } function shallowDiff() { var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var i in a) { if (!(i in b)) { return true; } } for (var _i in b) { if (a[_i] !== b[_i]) { return true; } } return false; } function formatPhoneUrl(phone) { if (/^[0-9]{1,10}$/.test(phone)) { return phone.length == 10 ? "(".concat(phone.slice(0, 3), ") ").concat(phone.slice(3, 6), "-").concat(phone.slice(6, 10)) : phone; } return phone; }