src/helpers/util.js
/*
Estimate the approximate width x height with error buffer
*/
Estimate the approximate width x height with error buffer
Estimate the approximate width x height with error buffer
function approximateDimensions(dimensions, requiredDimensions, errorAllowed) {
	return new Promise((resolve) => {
		let approxMinWidth = errorAllowed / 100 * requiredDimensions.width - requiredDimensions.width 
		let approxMinHeight = errorAllowed / 100 * requiredDimensions.height - requiredDimensions.height
		let approxMaxWidth = errorAllowed / 100 * requiredDimensions.width + requiredDimensions.width 
		let approxMaxHeight = errorAllowed / 100 * requiredDimensions.height + requiredDimensions.height
		resolve({ widthError: dimensions.width < approxMaxWidth && dimensions.width > approxMinWidth , heightError: dimensions.height < approxMaxHeight && dimensions.height > approxMinHeight })
	})
}
function approximateDimensions ( dimensions , requiredDimensions , errorAllowed ) { return new Promise ( ( resolve ) => { let approxMinWidth = errorAllowed / 100 * requiredDimensions . width - requiredDimensions . width let approxMinHeight = errorAllowed / 100 * requiredDimensions . height - requiredDimensions . height let approxMaxWidth = errorAllowed / 100 * requiredDimensions . width + requiredDimensions . width let approxMaxHeight = errorAllowed / 100 * requiredDimensions . height + requiredDimensions . height resolve ( { widthError : dimensions . width < approxMaxWidth && dimensions . width > approxMinWidth , heightError : dimensions . height < approxMaxHeight && dimensions . height > approxMinHeight } ) } ) }
Estimate the approximate width x height with error buffer
Estimate the approximate width x height with error buffer