const isVariant = e.match(VARIANT_TESTER); const matchingFirstHanzi = isVariant?.[2]; const matchingSecondHanzi = isVariant?.[4]; // knotty read: // const needToShow // = !isVariant || (matchingFirstHanzi !== hanzi && matchingSecondHanzi !== hanzi); // De-Morgan'd, easy to read: // const needToHide = isVariant && (matchingFirstHanzi === hanzi || matchingSecondHanzi === hanzi); const needToHide = isVariant && [matchingFirstHanzi, matchingSecondHanzi].includes(hanzi); const needToShow = !needToHide;
Saturday, June 11, 2022
Multiple nots is knotty to read
Simplifying multiple nots:
Subscribe to:
Posts (Atom)