Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
source = {
uri: response.uri,
isStatic: true
};
} else {
source = {
uri: response
.uri
.replace('file://', ''),
isStatic: true
};
}
this.setState({imgSource: source});
RNTesseractOcr
.startOcr(response.path, "LANG_ENGLISH")
.then((result) => {
const regex = /\d+.?\d*$/; //regex matching decimal value at end of line
let newResult = result;
console.log(newResult);
return newResult
.replace(/[|'"]+/g, '')
.split('\n')
.map(line => {
line = line.trim(); //trim whitespace
let index = line.search(regex); //returns index of beginning of match
return [
line
.substring(0, index)
source = {
uri: response.uri,
isStatic: true
};
} else {
source = {
uri: response
.uri
.replace('file://', ''),
isStatic: true
};
}
this.setState({imgSource: source});
RNTesseractOcr
.startOcr(response.path, "LANG_ENGLISH")
.then((result) => {
this.setState({ocrResult: result});
console.log("OCR Result: ", result);
})
.catch((err) => {
console.log("OCR Error: ", err);
})
.done();
}
});
}
}
else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
}
else {
var source;
if (Platform.OS === 'android') {
source = {uri: response.uri, isStatic: true};
} else {
source = {uri: response.uri.replace('file://', ''), isStatic: true};
}
this.setState({ imgSource: source });
RNTesseractOcr.startOcr(response.path, "LANG_ENGLISH")
.then((result) => {
this.setState({ ocrResult: result });
console.log("OCR Result: ", result);
})
.catch((err) => {
console.log("OCR Error: ", err);
})
.done();
}
});
}