How to use the @unimodules/react-native-adapter.CodedError function in @unimodules/react-native-adapter

To help you get started, we’ve selected a few @unimodules/react-native-adapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / packages / @unimodules / core / build / deprecate.js View on Github external
const code = codeFromLibrary(library);
    const key = `${code}:${deprecatedAPI}:${replacement}`;
    if (!postedWarnings[key]) {
        postedWarnings[key] = true;
    }
    if (!currentVersion ||
        !versionToRemove ||
        compareVersions(currentVersion, versionToRemove) >= 0) {
        let message = `\`${deprecatedAPI}\` has been removed`;
        if (versionToRemove) {
            message = `${message} as of version "${versionToRemove}"`;
        }
        if (replacement && replacement.length) {
            message = `${message} please migrate to: \`${replacement}\``;
        }
        throw new CodedError(`ERR_DEPRECATED_API`, prependLibrary(library, message));
    }
    let message = `\`${deprecatedAPI}\` has been deprecated`;
    if (replacement && replacement.length) {
        message = `${message} in favor of \`${replacement}\``;
    }
    if (versionToRemove && versionToRemove.length) {
        message = `${message} and will be removed in version "${versionToRemove}"`;
    }
    console.warn(prependLibrary(library, message));
}
function prependLibrary(library, message) {
github expo / expo / packages / @unimodules / core / src / deprecate.ts View on Github external
}

  if (
    !currentVersion ||
    !versionToRemove ||
    compareVersions(currentVersion, versionToRemove) >= 0
  ) {
    let message = `\`${deprecatedAPI}\` has been removed`;
    if (versionToRemove) {
      message = `${message} as of version "${versionToRemove}"`;
    }
    if (replacement && replacement.length) {
      message = `${message} please migrate to: \`${replacement}\``;
    }

    throw new CodedError(`ERR_DEPRECATED_API`, prependLibrary(library, message));
  }

  let message = `\`${deprecatedAPI}\` has been deprecated`;
  if (replacement && replacement.length) {
    message = `${message} in favor of \`${replacement}\``;
  }
  if (versionToRemove && versionToRemove.length) {
    message = `${message} and will be removed in version "${versionToRemove}"`;
  }
  console.warn(prependLibrary(library, message));
}

@unimodules/react-native-adapter

The adapter to use universal modules with the React Native bridge

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular @unimodules/react-native-adapter functions