@carbon/ibm-products
Version:
Carbon for IBM Products
20 lines (16 loc) • 453 B
JavaScript
/**
* Copyright IBM Corp. 2020, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
;
const checkForHoldingKey = (event, key) => {
// possible key inputs: altKey,ctrlKey,metaKey,shiftKey
if (key == 'cmd') {
return event.metaKey || event.ctrlKey;
} else {
return event[key];
}
};
exports.checkForHoldingKey = checkForHoldingKey;