import { UnavailabilityError } from "expo-modules-core"; import RNNSFWDetector from "./RNNSFWDetector"; import { DetectionResult } from "./NSFWDetector.types"; import { validateArguments } from "./validators"; // @needsAudit /** * Detects whether an image is NSFW or not. * @param uri URI of the file to analyze. Should be on the local file system or a base64 data URI. * @param threshold Value when an image is considered NSFW. Range is 0.0 to 1.0. Defaults to 0.9. * @return Promise which fulfils with [`DetectionResult`](#detectionresult) object. */ export async function detectAsync( uri: string, threshold: number = 0.9 ): Promise { if (!RNNSFWDetector.detectAsync) { throw new UnavailabilityError("RNNSFWDetector", "detectAsync"); } validateArguments(uri, threshold); return await RNNSFWDetector.detectAsync(uri, threshold); } export * from "./NSFWDetector.types";