Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Filter by containerType #36

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.36",
"version": "0.0.37",
"author": "Regula Forensics, Inc.",
"name": "@regulaforensics/document-reader-recipes",
"description": "Document Reader Recipes",
Expand Down
12 changes: 8 additions & 4 deletions src/recipes/image/document-images/get-document-images.recipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import { RDocumentImage, RDocumentImagePage } from './models'
* Get document images
* @param {ProcessResponse} input
* @param {eGraphicFieldType[]|undefined} fieldTypes
* @param {eResultType[]|undefined} containerTypes
* @returns {Promise<RDocumentImage[]>}
*/
export const getDocumentImages = async (
input: ProcessResponse,
fieldTypes?: eGraphicFieldType[]
fieldTypes?: eGraphicFieldType[],
containerTypes?: eResultType[]
): Promise<RDocumentImage[]> => {
const result: RDocumentImage[] = []

Expand All @@ -41,7 +43,7 @@ export const getDocumentImages = async (

const { lightIndex, pageIndex, value, containerType } = page

if (containerType !== eResultType.DOCUMENT_IMAGE) {
if (containerTypes && !containerTypes.includes(containerType)) {
continue
}

Expand Down Expand Up @@ -79,11 +81,13 @@ export const getDocumentImages = async (
* Get document images (synchronous version - without image dimensions)
* @param {ProcessResponse} input
* @param {eGraphicFieldType[]|undefined} fieldTypes
* @param {eResultType[]|undefined} containerTypes
* @returns {Promise<RDocumentImage[]>}
*/
export const getDocumentImagesSync = (
input: ProcessResponse,
fieldTypes?: eGraphicFieldType[]
fieldTypes?: eGraphicFieldType[],
containerTypes?: eResultType[]
): RDocumentImage[] => {
const result: RDocumentImage[] = []

Expand All @@ -104,7 +108,7 @@ export const getDocumentImagesSync = (

const { lightIndex, pageIndex, value, containerType } = page

if (containerType !== eResultType.DOCUMENT_IMAGE) {
if (containerTypes && !containerTypes.includes(containerType)) {
continue
}

Expand Down