JSFiddle - React, Tailwind, and code Playground

JavaScript

async function isImageBitmapOptionSupported(feature) {
  try {
    await self.createImageBitmap(new ImageData(1,1), { get [feature]() { throw 1 } });
  } catch (e) {
    if (e === 1) {
      return true;
    }
  }
  return false;
}
//isImageBitmapOptionSupported("imageOrientation").then(isSupported => ...);

async function canonizeImageBitmapOptions(dict, throwFailedKey) {
  const canonized = {};
  
  for (const k in dict) {
  	const supported = await isImageBitmapOptionSupported(k);
    if (supported) {
    	canonized[k] = dict[k];
    } else if (throwFailedKey) {
    	throw k;
    }
  }
  
  return canonized;
}

(async function() {
	const example = {
  	imageOrientation: 'flipY',
    foo: 3,
  };
  try {
    const canonized = await canonizeImageBitmapOptions(example, true);
    console.log(canonized);
  } catch (k) {
  	console.log('Bad key:', k);
  }
})();