mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
Fixed linting issues
This commit is contained in:
parent
f1659af5e4
commit
8dde732514
1 changed files with 3 additions and 18 deletions
|
@ -30,26 +30,13 @@ class OCR extends Operation {
|
||||||
this.infoURL = "https://en.wikipedia.org/wiki/Optical_character_recognition";
|
this.infoURL = "https://en.wikipedia.org/wiki/Optical_character_recognition";
|
||||||
this.inputType = "ArrayBuffer";
|
this.inputType = "ArrayBuffer";
|
||||||
this.outputType = "string";
|
this.outputType = "string";
|
||||||
this.args = [
|
this.args = [];
|
||||||
/* Example arguments. See the project wiki for full details.
|
|
||||||
{
|
|
||||||
name: "First arg",
|
|
||||||
type: "string",
|
|
||||||
value: "Don't Panic"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Second arg",
|
|
||||||
type: "number",
|
|
||||||
value: 42
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ArrayBuffer} input
|
* @param {ArrayBuffer} input
|
||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {Object}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
async run(input, args) {
|
async run(input, args) {
|
||||||
if (!isImage(input)) {
|
if (!isImage(input)) {
|
||||||
|
@ -72,11 +59,9 @@ class OCR extends Operation {
|
||||||
|
|
||||||
const result = await worker.recognize(image)
|
const result = await worker.recognize(image)
|
||||||
.progress(progress => {
|
.progress(progress => {
|
||||||
if (isWorkerEnvironment()) self.sendStatusMessage(`${progress.status} - ${parseFloat(progress.progress).toFixed(2)}%`);
|
if (isWorkerEnvironment()) self.sendStatusMessage(`${progress.status} - ${(parseFloat(progress.progress)*100).toFixed(2)}%`);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
return result.text;
|
return result.text;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new OperationError(`Error performing OCR on image. (${err})`);
|
throw new OperationError(`Error performing OCR on image. (${err})`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue