UNPKG

@microblink/blinkid-react-native

Version:

A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).

20 lines (17 loc) 546 B
import { StringResult } from './types'; export class BlinkIdUtilities { /** * Helper method for handling different string types, * based on the document information source. */ static handleStringType<T>(raw: any): T | undefined { if (typeof raw === 'string') { return raw as T; } // Heuristically assume it's a StringResult if it's an object and matches expected shape if (typeof raw === 'object' && raw !== null && 'value' in raw) { return new StringResult(raw) as T; } return undefined; } }