UNPKG

js2flowchart

Version:

> Why? While I've been working on [Under-the-hood-ReactJS](https://github.com/Bogdan-Lyashenko/Under-the-hood-ReactJS) I spent enormous amount of time on creating schemes. Each change in code or flowchart affects all entire scheme instantly, forcing you t

33 lines (27 loc) 984 B
import { TOKEN_TYPES } from 'shared/constants'; import { DefinitionsMap } from 'builder/entryDefinitionsMap'; export const getCustomFunctionDeclaration = () => { const functionDeclaration = DefinitionsMap[TOKEN_TYPES.FUNCTION]; return { ...functionDeclaration, getName: (path) => { let nameConfig = functionDeclaration.getName(path); if (path.parent.type === TOKEN_TYPES.OBJECT_PROPERTY && path.parent.key) { nameConfig = { ...nameConfig, name: path.parent.key.name + ': ' + nameConfig.name }; } return nameConfig; }, ignore: path => (functionDeclaration.ignore && functionDeclaration.ignore(path)) || path.parent.type === TOKEN_TYPES.CALL_EXPRESSION }; }; export const getFunctionsLevel = () => { return { defined: [], custom: [getCustomFunctionDeclaration()] }; };