import * as resemble from './resemble' ; import { CompareOptions } from '../methods/images.interfaces' ; import { CompareData } from './compare.interfaces' ; export default async function compareImages ( image1 , image2 , options ) { return new Promise ( ( resolve , reject ) => { let { imageToCompare1 , imageToCompare2 } = options . scaleToSameSize && image1 . length > image2 . length ? { imageToCompare1 : image2 , imageToCompare2 : image1 } : { imageToCompare1 : image1 , imageToCompare2 : image2 } ; resemble . compare ( imageToCompare1 , imageToCompare2 , options , ( err , data ) => { if ( err ) { reject ( err ) ; } else { resolve ( data ) ; } } ) ; } ) ; }