| 105 | |
| 106 | // Extract shards from the text field |
| 107 | const getText = textAnchor => { |
| 108 | if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) { |
| 109 | return ''; |
| 110 | } |
| 111 | |
| 112 | // First shard in document doesn't have startIndex property |
| 113 | const startIndex = textAnchor.textSegments[0].startIndex || 0; |
| 114 | const endIndex = textAnchor.textSegments[0].endIndex; |
| 115 | |
| 116 | return text.substring(startIndex, endIndex); |
| 117 | }; |
| 118 | |
| 119 | // Read the text recognition output from the processor |
| 120 | console.log('The document contains the following paragraphs:'); |
no outgoing calls
no test coverage detected