HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/laravel/node_modules/@petamoriken/float16/src/_util/is.mjs
import {
  ArrayBufferPrototypeGetByteLength,
  ArrayIsArray,
  ArrayIteratorPrototype,
  ArrayIteratorPrototypeNext,
  MathTrunc,
  NativeArrayPrototypeSymbolIterator,
  NativeSharedArrayBuffer,
  NativeTypedArrayPrototypeSymbolIterator,
  NumberIsFinite,
  SharedArrayBufferPrototypeGetByteLength,
  SymbolIterator,
  TypedArrayPrototypeGetSymbolToStringTag,
} from "./primordials.mjs";

/**
 * @param {unknown} value
 * @returns {value is {}}
 */
export function isObject(value) {
  return (
    (value !== null && typeof value === "object") ||
    typeof value === "function"
  );
}

/**
 * @param {unknown} value
 * @returns {value is {}}
 */
export function isObjectLike(value) {
  return value !== null && typeof value === "object";
}

// Inspired by util.types implementation of Node.js
/** @typedef {Uint8Array|Uint8ClampedArray|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array|BigUint64Array|BigInt64Array} TypedArray */

/**
 * @param {unknown} value
 * @returns {value is TypedArray}
 */
export function isNativeTypedArray(value) {
  return TypedArrayPrototypeGetSymbolToStringTag(value) !== undefined;
}

/**
 * @param {unknown} value
 * @returns {value is BigInt64Array|BigUint64Array}
 */
export function isNativeBigIntTypedArray(value) {
  const typedArrayName = TypedArrayPrototypeGetSymbolToStringTag(value);
  return (
    typedArrayName === "BigInt64Array" ||
    typedArrayName === "BigUint64Array"
  );
}

/**
 * @param {unknown} value
 * @returns {value is ArrayBuffer}
 */
function isArrayBuffer(value) {
  try {
    // ArrayBuffers are never arrays
    if (ArrayIsArray(value)) {
      return false;
    }
    ArrayBufferPrototypeGetByteLength(/** @type {any} */ (value));
    return true;
  } catch (e) {
    return false;
  }
}

/**
 * @param {unknown} value
 * @returns {value is SharedArrayBuffer}
 */
export function isSharedArrayBuffer(value) {
  if (NativeSharedArrayBuffer === null) {
    return false;
  }

  try {
    SharedArrayBufferPrototypeGetByteLength(/** @type {any} */ (value));
    return true;
  } catch (e) {
    return false;
  }
}

/**
 * @param {unknown} value
 * @returns {value is ArrayBuffer|SharedArrayBuffer}
 */
export function isAnyArrayBuffer(value) {
  return isArrayBuffer(value) || isSharedArrayBuffer(value);
}

/**
 * @param {unknown} value
 * @returns {value is unknown[]}
 */
export function isOrdinaryArray(value) {
  if (!ArrayIsArray(value)) {
    return false;
  }

  // Verify that there are no changes in ArrayIterator
  return (
    value[SymbolIterator] === NativeArrayPrototypeSymbolIterator &&
    ArrayIteratorPrototype.next === ArrayIteratorPrototypeNext
  );
}

/**
 * @param {unknown} value
 * @returns {value is TypedArray}
 */
export function isOrdinaryNativeTypedArray(value) {
  if (!isNativeTypedArray(value)) {
    return false;
  }

  // Verify that there are no changes in ArrayIterator
  return (
    value[SymbolIterator] === NativeTypedArrayPrototypeSymbolIterator &&
    ArrayIteratorPrototype.next === ArrayIteratorPrototypeNext
  );
}

/**
 * @param {unknown} value
 * @returns {value is string}
 */
export function isCanonicalIntegerIndexString(value) {
  if (typeof value !== "string") {
    return false;
  }

  const number = +value;
  if (value !== number + "") {
    return false;
  }

  if (!NumberIsFinite(number)) {
    return false;
  }

  return number === MathTrunc(number);
}