Skip to content

Commit

Permalink
chore!: change addSection header into D3Section
Browse files Browse the repository at this point in the history
  • Loading branch information
Yokozuna59 committed Aug 20, 2023
1 parent 341db13 commit 1ffa9ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions packages/mermaid/src/diagrams/pie/pieDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
clear as commonClear,
} from '../../commonDb.js';
import type { ParseDirectiveDefinition } from '../../diagram-api/types.js';
import type { PieFields, PieDB, Sections } from './pieTypes.js';
import type { PieFields, PieDB, Sections, D3Section } from './pieTypes.js';
import type { RequiredDeep } from 'type-fest';
import type { PieDiagramConfig } from '../../config.type.js';
import DEFAULT_CONFIG from '../../defaultConfig.js';
Expand Down Expand Up @@ -41,8 +41,7 @@ const clear = (): void => {
commonClear();
};

const addSection = (label: string, value: number): void => {
label = sanitizeText(label, commonGetConfig());
const addSection = ({ label, value }: D3Section): void => {
if (sections[label] === undefined) {
sections[label] = value;
log.debug(`added new section: ${label}, with value: ${value}`);
Expand Down
3 changes: 2 additions & 1 deletion packages/mermaid/src/diagrams/pie/pieParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function populateDb(ast: Pie, db: PieDB) {
populateCommonDb(ast, db);
db.setShowData(ast.showData);
ast.sections.map((section: PieSection) => {
db.addSection(section.label, section.value);
const { label, value } = section;
db.addSection({ label, value });
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/diagrams/pie/pieTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface PieDB extends DiagramDB {
getAccDescription: () => string;

// diagram db
addSection: (label: string, value: number) => void;
addSection: ({ label, value }: D3Section) => void;
getSections: () => Sections;
setShowData: (toggle: boolean) => void;
getShowData: () => boolean;
Expand Down

0 comments on commit 1ffa9ca

Please sign in to comment.