Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
identifyLanguage(text, options = {}) {
validateOptionalNativeDependencyExists(
'ml_natural_language_language_id_model',
'ML Kit Language Identification',
!!this.native.identifyLanguage,
);
validateIdentifyLanguageArgs(text, options, 'identifyLanguage');
return this.native.identifyLanguage(text.slice(0, 200), options);
}
identifyPossibleLanguages(text, options = {}) {
validateOptionalNativeDependencyExists(
'ml_natural_language_language_id_model',
'ML Kit Language Identification',
!!this.native.identifyPossibleLanguages,
);
validateIdentifyLanguageArgs(text, options, 'identifyPossibleLanguages');
return this.native.identifyPossibleLanguages(
text.slice(0, 200),
Object.assign({}, options, { multipleLanguages: true }),
);
}
cloudImageLabelerProcessImage(localImageFilePath, cloudImageLabelerOptions) {
validateOptionalNativeDependencyExists(
'ml_vision_image_label_model',
'ML Kit Vision Image Labeler',
!!this.native.imageLabelerProcessImage,
);
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().cloudImageLabelerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionCloudImageLabelerOptions(cloudImageLabelerOptions);
} catch (e) {
throw new Error(`firebase.vision().cloudImageLabelerProcessImage(_, *) ${e.message}.`);
imageLabelerProcessImage(localImageFilePath, imageLabelerOptions) {
validateOptionalNativeDependencyExists(
'ml_vision_image_label_model',
'ML Kit Vision Image Labeler',
!!this.native.imageLabelerProcessImage,
);
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().imageLabelerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionImageLabelerOptions(imageLabelerOptions);
} catch (e) {
throw new Error(`firebase.vision().imageLabelerProcessImage(_, *) ${e.message}.`);
faceDetectorProcessImage(localImageFilePath, faceDetectorOptions) {
validateOptionalNativeDependencyExists(
'ml_vision_face_model',
'ML Kit Vision Face Detector',
!!this.native.faceDetectorProcessImage,
);
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().faceDetectorProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionFaceDetectorOptions(faceDetectorOptions);
} catch (e) {
throw new Error(