@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
27 lines (23 loc) • 650 B
JavaScript
var isApple = require('./is-apple.cjs');
const MODIFIERS = {
alt: () => "altKey",
ctrl: () => "ctrlKey",
meta: () => "metaKey",
mod: () => isApple.isApple() ? "metaKey" : "ctrlKey",
shift: () => "shiftKey"
};
function isKey(event, key, modifiers = {}) {
if (event.key !== key) {
return false;
}
const explicitModifiers = Object.entries(modifiers).filter(
([, value]) => typeof value === "boolean"
);
return explicitModifiers.every(([modifier, value]) => {
const property = MODIFIERS[modifier]();
return event[property] === value;
});
}
exports.isKey = isKey;
//# sourceMappingURL=is-key.cjs.map
;