(textAnchor, text)
| 111 | |
| 112 | // Extract shards from the text field |
| 113 | const getText = (textAnchor, text) => { |
| 114 | if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) { |
| 115 | return ''; |
| 116 | } |
| 117 | |
| 118 | // First shard in document doesn't have startIndex property |
| 119 | const startIndex = textAnchor.textSegments[0].startIndex || 0; |
| 120 | const endIndex = textAnchor.textSegments[0].endIndex; |
| 121 | |
| 122 | return text.substring(startIndex, endIndex); |
| 123 | }; |
| 124 | |
| 125 | // [END documentai_process_form_document] |
| 126 | await processDocument(); |
no outgoing calls
no test coverage detected