Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public mod({ text, options = Object.create(null) }: TextInputParams) {
let modifiers = text.split(/-(?!$)/);
let result = modifiers[modifiers.length - 1];
modifiers = take(modifiers, modifiers.length - 1);
if (result === 'Space') {
result = ' ';
}
const info = getModifierInformation({ modifiers, isMac: this.isMac });
this.fireModifierEvents(info, 'keydown');
this.type({ text: result, options: { ...options, ...info } });
this.fireModifierEvents(info, 'keyup');
return this;
}
export const addItems = (
currentItems: GItem[],
newItems: GItem[],
getItemId: GetItemId,
multiple?: boolean,
) => (multiple ? uniqueBy([...currentItems, ...newItems], getItemId, true) : take(newItems, 1));