Server IP : 173.249.157.85 / Your IP : 3.14.86.75 Web Server : Apache System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 User : econtech ( 1005) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/econtech/public_html/public/back/assets/vendors/general/sweetalert2/src/utils/ |
Upload File : |
export const consolePrefix = 'SweetAlert2:' /** * Filter the unique values into a new array * @param arr */ export const uniqueArray = (arr) => { const result = [] for (let i = 0; i < arr.length; i++) { if (result.indexOf(arr[i]) === -1) { result.push(arr[i]) } } return result } /** * Returns the array ob object values (Object.values isn't supported in IE11) * @param obj */ export const objectValues = (obj) => Object.keys(obj).map(key => obj[key]) /** * Convert NodeList to Array * @param nodeList */ export const toArray = (nodeList) => Array.prototype.slice.call(nodeList) /** * Converts `inputOptions` into an array of `[value, label]`s * @param inputOptions */ export const formatInputOptions = (inputOptions) => { const result = [] if (typeof Map !== 'undefined' && inputOptions instanceof Map) { inputOptions.forEach((value, key) => { result.push([key, value]) }) } else { Object.keys(inputOptions).forEach(key => { result.push([key, inputOptions[key]]) }) } return result } /** * Standardise console warnings * @param message */ export const warn = (message) => { console.warn(`${consolePrefix} ${message}`) } /** * Standardise console errors * @param message */ export const error = (message) => { console.error(`${consolePrefix} ${message}`) } /** * Private global state for `warnOnce` * @type {Array} * @private */ const previousWarnOnceMessages = [] /** * Show a console warning, but only if it hasn't already been shown * @param message */ export const warnOnce = (message) => { if (!previousWarnOnceMessages.includes(message)) { previousWarnOnceMessages.push(message) warn(message) } } /** * Show a one-time console warning about deprecated params/methods */ export const warnAboutDepreation = (deprecatedParam, useInstead) => { warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release. Please use "${useInstead}" instead.`) } /** * If `arg` is a function, call it (with no arguments or context) and return the result. * Otherwise, just pass the value through * @param arg */ export const callIfFunction = (arg) => typeof arg === 'function' ? arg() : arg export const isPromise = (arg) => arg && Promise.resolve(arg) === arg