Skip to content

Commit

Permalink
remove lodash dash and @types/lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
L4Ph committed Jun 2, 2024
1 parent 3abc223 commit 3f2341f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@types/ajv": "^1.0.0",
"@types/axios": "^0.14.0",
"@types/downloadjs": "^1.4.2",
"@types/lodash": "^4.14.167",
"@types/node": "^14.14.22",
"@types/prop-types": "^15.7.4",
"@types/qs": "^6.9.6",
Expand Down
3 changes: 1 addition & 2 deletions src/components/configure/keycodekey/KeyGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
KeyLabelLangs,
} from '../../../services/labellang/KeyLabelLangs';
import { mods2Number } from '../customkey/Modifiers';
import _ from 'lodash';
import { MOD_LEFT, MOD_RIGHT } from '../../../services/hid/Constraints';

export type Key = {
Expand Down Expand Up @@ -98,7 +97,7 @@ export const genKey = (keymap: IKeymap, lang?: KeyboardLabelLang): Key => {

let newKeymap: IKeymap = keymap;
if (0 < keytop.keywords.length) {
newKeymap = _.cloneDeep(keymap) as IKeymap;
newKeymap = structuredClone(keymap) as IKeymap;
newKeymap.keycodeInfo.keywords = newKeymap.keycodeInfo.keywords.concat(
keytop.keywords
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/configure/macroeditor/MacroEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class MacroEditor extends React.Component<
indexInHold: number,
newKeyDelayPair: KeyDelayPair
) {
const macroKeys: MacroKey[] = lodash.cloneDeep(this.props.macroKeys!);
const macroKeys: MacroKey[] = structuredClone(this.props.macroKeys!);
if (Number.isNaN(indexInHold)) {
// TODO: Set delay.
const tap: Tap = {
Expand All @@ -85,7 +85,7 @@ export default class MacroEditor extends React.Component<
}

private addTapKeys(index: number, newKeyDelayPairs: KeyDelayPair[]) {
const macroKeys: MacroKey[] = lodash.cloneDeep(this.props.macroKeys!);
const macroKeys: MacroKey[] = structuredClone(this.props.macroKeys!);
const taps: Tap[] = newKeyDelayPairs.map((v) => {
// TODO: Set delay.
return { keyDelayPair: v, type: MacroTap };
Expand All @@ -95,7 +95,7 @@ export default class MacroEditor extends React.Component<
}

private popKey() {
const macroKeys: MacroKey[] = lodash.cloneDeep(this.props.macroKeys!);
const macroKeys: MacroKey[] = structuredClone(this.props.macroKeys!);
this.props.updateMacroKeys!(macroKeys.slice(0, -1));
}

Expand Down Expand Up @@ -129,7 +129,7 @@ export default class MacroEditor extends React.Component<
if (fromIndex === toIndex && fromIndexInHold === toIndexInHold) {
return;
}
const macroKeys: MacroKey[] = lodash.cloneDeep(this.props.macroKeys!);
const macroKeys: MacroKey[] = structuredClone(this.props.macroKeys!);
const srcMacroKey: MacroKey = macroKeys[fromIndex];
const dstMacroKey: MacroKey = macroKeys[toIndex];
if (fromIndex === toIndex && isHold(srcMacroKey)) {
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5938,7 +5938,6 @@ __metadata:
"@types/ajv": "npm:^1.0.0"
"@types/axios": "npm:^0.14.0"
"@types/downloadjs": "npm:^1.4.2"
"@types/lodash": "npm:^4.14.167"
"@types/node": "npm:^14.14.22"
"@types/prop-types": "npm:^15.7.4"
"@types/qs": "npm:^6.9.6"
Expand Down

0 comments on commit 3f2341f

Please sign in to comment.