Skip to content

Commit

Permalink
refactor(block): remove lodash/clone dependency
Browse files Browse the repository at this point in the history
We can use object destructuring to shallow clone a JavaScript object.
  • Loading branch information
aloisklink committed Mar 6, 2024
1 parent 821076b commit e989fa7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/mermaid/src/diagrams/block/blockDB.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import clone from 'lodash-es/clone.js';
import * as configApi from '../../config.js';
import type { DiagramDB } from '../../diagram-api/types.js';
import { log } from '../../logger.js';
Expand Down Expand Up @@ -140,8 +139,10 @@ const populateBlockDatabase = (_blockList: Block[] | Block[][], parent: Block):
// log.debug('abc95 space', block);
const w = block.width || 1;
for (let j = 0; j < w; j++) {
const newBlock = clone(block);
newBlock.id = newBlock.id + '-' + j;
const newBlock = {
...block,
id: block.id + '-' + j,
};
blockDatabase[newBlock.id] = newBlock;
children.push(newBlock);
}
Expand Down

0 comments on commit e989fa7

Please sign in to comment.