Skip to content

Commit

Permalink
chore: replaces lodash/flatten with native .flat
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Jul 11, 2024
1 parent fb26b94 commit 4cae5a3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dist/bundle/index.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/cjs/parse/parserHelpers.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"use strict";
/*
* Helper functions for the parsers. These used to be in the parsers
* themselves, often duplicated. This module is a mixed bag thing now
* with generic things (=> replace with lodash?) and specific things
* (split into different modules?) mixed - and is only a first step
* in refactoring the parser code a bit.
*
* themselves, often duplicated.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMetaInfo = exports.checkForUndeclaredEntities = exports.EntityNotDefinedError = exports.isMscGenKeyword = exports.entityExists = exports.flattenBoolean = exports.nameValue2Option = void 0;
Expand Down
5 changes: 2 additions & 3 deletions dist/cjs/render/graphics/markermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMarkerDefs = exports.getAttributes = void 0;
var flatten_1 = __importDefault(require("lodash/flatten"));
var normalizekind_1 = __importDefault(require("../astmassage/normalizekind"));
var KINDS = {
"->": {
Expand Down Expand Up @@ -243,14 +242,14 @@ function extractKindColorCombis(pAST) {
.map(toColorCombiObject);
}
function getMarkerDefs(pId, pAST) {
return (0, flatten_1.default)(extractKindColorCombis(pAST).map(function (pCombi) {
return extractKindColorCombis(pAST).map(function (pCombi) {
return MARKERPATHS[pCombi.kind].variants.map(function (pVariant) { return ({
name: "".concat(pId + pCombi.kind + pVariant.name, "-").concat(pCombi.color),
path: pVariant.path,
color: pCombi.color,
type: pCombi.kind,
}); });
}));
}).flat(Infinity);
}
exports.getMarkerDefs = getMarkerDefs;
/*
Expand Down
6 changes: 1 addition & 5 deletions dist/es2015/parse/parserHelpers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/*
* Helper functions for the parsers. These used to be in the parsers
* themselves, often duplicated. This module is a mixed bag thing now
* with generic things (=> replace with lodash?) and specific things
* (split into different modules?) mixed - and is only a first step
* in refactoring the parser code a bit.
*
* themselves, often duplicated.
*/
export function nameValue2Option(pName, pValue) {
const lOption = {};
Expand Down
5 changes: 2 additions & 3 deletions dist/es2015/render/graphics/markermanager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import flatten from "lodash/flatten";
import normalizekind from "../astmassage/normalizekind";
const KINDS = {
"->": {
Expand Down Expand Up @@ -236,12 +235,12 @@ function extractKindColorCombis(pAST) {
.map(toColorCombiObject);
}
export function getMarkerDefs(pId, pAST) {
return flatten(extractKindColorCombis(pAST).map((pCombi) => MARKERPATHS[pCombi.kind].variants.map((pVariant) => ({
return extractKindColorCombis(pAST).map((pCombi) => MARKERPATHS[pCombi.kind].variants.map((pVariant) => ({
name: `${pId + pCombi.kind + pVariant.name}-${pCombi.color}`,
path: pVariant.path,
color: pCombi.color,
type: pCombi.kind,
}))));
}))).flat(Infinity);
}
/*
This file is part of mscgen_js.
Expand Down
6 changes: 1 addition & 5 deletions src/parse/parserHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/*
* Helper functions for the parsers. These used to be in the parsers
* themselves, often duplicated. This module is a mixed bag thing now
* with generic things (=> replace with lodash?) and specific things
* (split into different modules?) mixed - and is only a first step
* in refactoring the parser code a bit.
*
* themselves, often duplicated.
*/

export function nameValue2Option(pName, pValue) {
Expand Down
7 changes: 2 additions & 5 deletions src/render/graphics/markermanager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import flatten from "lodash/flatten";
import { IFlatSequenceChart } from "../astmassage/flatten";
import normalizekind from "../astmassage/normalizekind";

Expand Down Expand Up @@ -255,16 +254,14 @@ function extractKindColorCombis(pAST: IFlatSequenceChart) {
}

export function getMarkerDefs(pId: string, pAST: IFlatSequenceChart) {
return flatten(
extractKindColorCombis(pAST).map((pCombi) =>
return extractKindColorCombis(pAST).map((pCombi) =>
MARKERPATHS[pCombi.kind].variants.map((pVariant) => ({
name: `${pId + pCombi.kind + pVariant.name}-${pCombi.color}`,
path: pVariant.path,
color: pCombi.color,
type: pCombi.kind,
}))
)
);
).flat(Infinity);
}
/*
This file is part of mscgen_js.
Expand Down

0 comments on commit 4cae5a3

Please sign in to comment.