PHP 8.2.30
Preview: utils.js Size: 935 B
/home/byroehnu/.trash/node_modules11/i18next-http-backend/lib/utils.js

const arr = []
const each = arr.forEach
const slice = arr.slice

export function defaults (obj) {
  each.call(slice.call(arguments, 1), (source) => {
    if (source) {
      for (const prop in source) {
        if (obj[prop] === undefined) obj[prop] = source[prop]
      }
    }
  })
  return obj
}

export function hasXMLHttpRequest () {
  return (typeof XMLHttpRequest === 'function' || typeof XMLHttpRequest === 'object')
}

/**
 * Determine whether the given `maybePromise` is a Promise.
 *
 * @param {*} maybePromise
 *
 * @returns {Boolean}
 */
function isPromise (maybePromise) {
  return !!maybePromise && typeof maybePromise.then === 'function'
}

/**
 * Convert any value to a Promise than will resolve to this value.
 *
 * @param {*} maybePromise
 *
 * @returns {Promise}
 */
export function makePromise (maybePromise) {
  if (isPromise(maybePromise)) {
    return maybePromise
  }

  return Promise.resolve(maybePromise)
}

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
475 B lrw-r--r-- 2026-02-28 00:27:00
Edit Download
6.00 KB lrw-r--r-- 2026-02-28 00:28:02
Edit Download
5.74 KB lrw-r--r-- 2026-02-28 00:28:14
Edit Download
935 B lrw-r--r-- 2026-02-28 00:28:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).