Socket
Socket
Sign inDemoInstall

mermaid

Package Overview
Dependencies
Maintainers
2
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mermaid - npm Package Compare versions

Comparing version 7.1.0 to 7.1.1

dist/mermaid.core.js.map

36

package.json
{
"name": "mermaid",
"version": "7.1.0",
"version": "7.1.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",

@@ -16,6 +16,6 @@ "main": "dist/mermaid.core.js",

"scripts": {
"build": "node -r babel-register ./node_modules/.bin/webpack --progress --colors",
"build": "webpack --progress --colors",
"build:watch": "yarn build --watch",
"release": "yarn build -p --config webpack.config.prod.js",
"upgrade": "yarn upgrade --latest && yarn remove d3 && yarn add d3@3.5.17",
"release": "yarn build -p --config webpack.config.prod.babel.js",
"upgrade": "yarn-upgrade-all && yarn remove d3 && yarn add d3@3.5.17",
"lint": "standard",

@@ -41,7 +41,7 @@ "karma": "node -r babel-register node_modules/.bin/karma start karma.conf.js --single-run",

"d3": "3.5.17",
"dagre-d3-renderer": "^0.4.24",
"dagre-d3-renderer": "^0.4.25",
"dagre-layout": "^0.8.0",
"he": "^1.1.1",
"lodash": "^4.17.4",
"moment": "^2.18.1"
"moment": "^2.20.1"
},

@@ -51,9 +51,8 @@ "devDependencies": {

"babel-loader": "^7.1.2",
"babel-plugin-lodash": "^3.2.11",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-plugin-lodash": "^3.3.2",
"babel-preset-env": "^1.6.1",
"codeclimate-test-reporter": "^0.5.0",
"css-loader": "^0.28.7",
"css-to-string-loader": "^0.1.3",
"extract-text-webpack-plugin": "^3.0.0",
"extract-text-webpack-plugin": "^3.0.2",
"gulp": "^3.9.1",

@@ -64,16 +63,17 @@ "gulp-filelog": "^0.4.1",

"jasmine": "^2.8.0",
"jasmine-es6": "^0.4.1",
"jasmine-es6": "^0.4.3",
"jison": "^0.4.18",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine": "^1.1.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.4",
"less": "^2.7.2",
"karma-webpack": "^2.0.9",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"puppeteer": "^0.10.2",
"puppeteer": "^0.13.0",
"standard": "^10.0.3",
"style-loader": "^0.18.2",
"webpack": "^3.5.6",
"webpack-node-externals": "^1.6.0"
"style-loader": "^0.19.1",
"webpack": "^3.10.0",
"webpack-node-externals": "^1.6.0",
"yarn-upgrade-all": "^0.2.0"
},

@@ -80,0 +80,0 @@ "files": [

@@ -15,9 +15,6 @@ # mermaid

The code below would render the following image
<table>
<tr><th>Code</th><th>Rendered diagram</th></tr>
<tr>
<td>
<pre>
<code>
### Flowchart
```
graph TD;

@@ -28,15 +25,9 @@ A-->B;

C-->D;
</code>
</pre>
</td>
<td>
<p align="center">
<img src='./img/flow.png' alt='Flowchart'>
</p>
</td>
</tr>
<tr>
<td>
<pre>
<code>
```
![Flowchart](./img/flow.png)
### Sequence diagram
```
sequenceDiagram

@@ -49,17 +40,13 @@ participant Alice

end
Note right of John: Rational thoughts &lt;br/>prevail...
Note right of John: Rational thoughts <br/>prevail...
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
</code>
</pre>
</td>
<td>
<img src='./img/sequence.png' alt='Sequence Diagram'>
</td>
</tr>
<tr>
<td>
<pre>
<code>
```
![Sequence diagram](./img/sequence.png)
### Gantt diagram
```
gantt

@@ -74,66 +61,52 @@ dateFormat YYYY-MM-DD

Future task2 : des4, after des3, 5d
</code>
</pre>
</td>
<td>
<img src='./img/gantt.png' alt='Gantt Diagram'>
</td>
</tr>
<tr>
<td>
<pre>
<code>
```
![Gantt diagram](./img/gantt.png)
### Class diagram - :exclamation: experimental
```
classDiagram
Class01 &lt;|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 &lt;--> C2: Cool label
</code>
</pre>
</td>
<td>
<img src='./img/class.png' alt='Class Diagram'>
</td>
</tr>
<tr>
<td>
<pre>
<code>
gitGraph :
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 <--> C2: Cool label
```
![Class diagram](./img/class.png)
### Git graph - :exclamation: experimental
```
gitGraph:
options
{
"key": "value",
"nodeWidth": 150,
"nodeSpacing" : 150
"nodeSpacing": 150,
"nodeRadius": 10
}
end
commit
branch newbranch
checkout newbranch
commit
commit
checkout master
commit
commit
merge newbranch
</code>
</pre>
</td>
<td>
<img src='./img/git.png' alt='Git Graph'>
</td>
</tr>
commit
branch newbranch
checkout newbranch
commit
commit
checkout master
commit
commit
merge newbranch
</table>
```
![Git graph](./img/git.png)
## Installation

@@ -218,3 +191,3 @@

open dist/demo/index.html
open dist/index.html

@@ -221,0 +194,0 @@

import { logger } from '../../logger'
var relations = []
let relations = []
let classes = {}
var classes
classes = {
}
/**

@@ -51,3 +48,3 @@ * Function called by parser when a node definition has been found.

export const addMembers = function (className, MembersArr) {
var theClass = classes[className]
const theClass = classes[className]
if (typeof MembersArr === 'string') {

@@ -54,0 +51,0 @@ if (MembersArr.substr(-1) === ')') {

@@ -12,3 +12,3 @@ /* eslint-env jasmine */

it('should handle relation definitions', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 <|-- Class02\n' +

@@ -23,3 +23,3 @@ 'Class03 *-- Class04\n' +

it('should handle relation definition of different types and directions', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class11 <|.. Class12\n' +

@@ -35,3 +35,3 @@ 'Class13 --> Class14\n' +

it('should handle cardinality and labels', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 "1" *-- "many" Class02 : contains\n' +

@@ -44,3 +44,3 @@ 'Class03 o-- Class04 : aggregation\n' +

it('should handle class definitions', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'class Car\n' +

@@ -55,3 +55,3 @@ 'Driver -- Car : drives >\n' +

it('should handle method statements', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Object <|-- ArrayList\n' +

@@ -65,3 +65,3 @@ 'Object : equals()\n' +

it('should handle parsing of method statements grouped by brackets', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'class Dummy {\n' +

@@ -81,3 +81,3 @@ 'String data\n' +

it('should handle parsing of separators', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'class Foo1 {\n' +

@@ -120,3 +120,3 @@ ' You can use\n' +

it('should handle relation definitions EXTENSION', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 <|-- Class02'

@@ -126,3 +126,3 @@

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -136,3 +136,3 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

it('should handle relation definitions AGGREGATION and dotted line', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 o.. Class02'

@@ -142,3 +142,3 @@

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -152,3 +152,3 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

it('should handle relation definitions COMPOSITION on both sides', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 *--* Class02'

@@ -158,3 +158,3 @@

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -168,3 +168,3 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

it('should handle relation definitions no types', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 -- Class02'

@@ -174,3 +174,3 @@

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -184,3 +184,3 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

it('should handle relation definitions with type only on right side', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 --|> Class02'

@@ -190,3 +190,3 @@

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -201,3 +201,3 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

it('should handle multiple classes and relation definitions', function () {
var str = 'classDiagram\n' +
const str = 'classDiagram\n' +
'Class01 <|-- Class02\n' +

@@ -211,3 +211,3 @@ 'Class03 *-- Class04\n' +

var relations = parser.yy.getRelations()
const relations = parser.yy.getRelations()

@@ -214,0 +214,0 @@ expect(parser.yy.getClass('Class01').id).toBe('Class01')

@@ -11,7 +11,6 @@

var idCache
idCache = {}
const idCache = {}
var classCnt = 0
var conf = {
let classCnt = 0
const conf = {
dividerMargin: 10,

@@ -23,7 +22,6 @@ padding: 5,

// Todo optimize
var getGraphId = function (label) {
var keys = Object.keys(idCache)
const getGraphId = function (label) {
const keys = Object.keys(idCache)
var i
for (i = 0; i < keys.length; i++) {
for (let i = 0; i < keys.length; i++) {
if (idCache[keys[i]].label === label) {

@@ -40,3 +38,3 @@ return keys[i]

*/
var insertMarkers = function (elem) {
const insertMarkers = function (elem) {
elem.append('defs').append('marker')

@@ -127,5 +125,5 @@ .attr('id', 'extensionStart')

var edgeCount = 0
var drawEdge = function (elem, path, relation) {
var getRelationType = function (type) {
let edgeCount = 0
const drawEdge = function (elem, path, relation) {
const getRelationType = function (type) {
switch (type) {

@@ -144,6 +142,6 @@ case classDb.relationType.AGGREGATION:

// The data for our line
var lineData = path.points
const lineData = path.points
// This is the accessor function we talked about above
var lineFunction = d3.svg.line()
const lineFunction = d3.svg.line()
.x(function (d) {

@@ -157,7 +155,7 @@ return d.x

var svgPath = elem.append('path')
const svgPath = elem.append('path')
.attr('d', lineFunction(lineData))
.attr('id', 'edge' + edgeCount)
.attr('class', 'relation')
var url = ''
let url = ''
if (conf.arrowMarkerAbsolute) {

@@ -176,11 +174,11 @@ url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search

var x, y
var l = path.points.length
let x, y
const l = path.points.length
if ((l % 2) !== 0) {
var p1 = path.points[Math.floor(l / 2)]
var p2 = path.points[Math.ceil(l / 2)]
const p1 = path.points[Math.floor(l / 2)]
const p2 = path.points[Math.ceil(l / 2)]
x = (p1.x + p2.x) / 2
y = (p1.y + p2.y) / 2
} else {
var p = path.points[Math.floor(l / 2)]
const p = path.points[Math.floor(l / 2)]
x = p.x

@@ -191,5 +189,5 @@ y = p.y

if (typeof relation.title !== 'undefined') {
var g = elem.append('g')
const g = elem.append('g')
.attr('class', 'classLabel')
var label = g.append('text')
const label = g.append('text')
.attr('class', 'label')

@@ -203,3 +201,3 @@ .attr('x', x)

window.label = label
var bounds = label.node().getBBox()
const bounds = label.node().getBBox()

@@ -217,7 +215,7 @@ g.insert('rect', ':first-child')

var drawClass = function (elem, classDef) {
const drawClass = function (elem, classDef) {
logger.info('Rendering class ' + classDef)
var addTspan = function (textEl, txt, isFirst) {
var tSpan = textEl.append('tspan')
const addTspan = function (textEl, txt, isFirst) {
const tSpan = textEl.append('tspan')
.attr('x', conf.padding)

@@ -230,4 +228,4 @@ .text(txt)

var id = 'classId' + classCnt
var classInfo = {
const id = 'classId' + classCnt
const classInfo = {
id: id,

@@ -239,6 +237,6 @@ label: classDef.id,

var g = elem.append('g')
const g = elem.append('g')
.attr('id', id)
.attr('class', 'classGroup')
var title = g.append('text')
const title = g.append('text')
.attr('x', conf.padding)

@@ -248,5 +246,5 @@ .attr('y', conf.textHeight + conf.padding)

var titleHeight = title.node().getBBox().height
const titleHeight = title.node().getBBox().height
var membersLine = g.append('line') // text label for the x axis
const membersLine = g.append('line') // text label for the x axis
.attr('x1', 0)

@@ -256,3 +254,3 @@ .attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2)

var members = g.append('text') // text label for the x axis
const members = g.append('text') // text label for the x axis
.attr('x', conf.padding)

@@ -263,4 +261,3 @@ .attr('y', titleHeight + (conf.dividerMargin) + conf.textHeight)

var isFirst = true
let isFirst = true
classDef.members.forEach(function (member) {

@@ -271,5 +268,5 @@ addTspan(members, member, isFirst)

var membersBox = members.node().getBBox()
const membersBox = members.node().getBBox()
var methodsLine = g.append('line') // text label for the x axis
const methodsLine = g.append('line') // text label for the x axis
.attr('x1', 0)

@@ -279,3 +276,3 @@ .attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height)

var methods = g.append('text') // text label for the x axis
const methods = g.append('text') // text label for the x axis
.attr('x', conf.padding)

@@ -293,3 +290,3 @@ .attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight)

var classBox = g.node().getBBox()
const classBox = g.node().getBBox()
g.insert('rect', ':first-child')

@@ -313,3 +310,3 @@ .attr('x', 0)

export const setConf = function (cnf) {
var keys = Object.keys(cnf)
const keys = Object.keys(cnf)

@@ -332,7 +329,7 @@ keys.forEach(function (key) {

/// / Fetch the default direction, use TD if none was found
var diagram = d3.select('#' + id)
const diagram = d3.select('#' + id)
insertMarkers(diagram)
// Layout graph, Create a new directed graph
var g = new dagre.graphlib.Graph({
const g = new dagre.graphlib.Graph({
multigraph: true

@@ -351,8 +348,7 @@ })

var classes = classDb.getClasses()
var keys = Object.keys(classes)
var i
for (i = 0; i < keys.length; i++) {
var classDef = classes[keys[i]]
var node = drawClass(diagram, classDef)
const classes = classDb.getClasses()
const keys = Object.keys(classes)
for (let i = 0; i < keys.length; i++) {
const classDef = classes[keys[i]]
const node = drawClass(diagram, classDef)
// Add nodes to the graph. The first argument is the node id. The second is

@@ -365,3 +361,3 @@ // metadata about the node. In this case we're going to add labels to each of

var relations = classDb.getRelations()
const relations = classDb.getRelations()
relations.forEach(function (relation) {

@@ -368,0 +364,0 @@ logger.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation))

@@ -11,11 +11,9 @@ import { parser } from './parser/example'

it('should handle an info definition', function () {
var str = 'info\nsay: hello'
const str = 'info\nsay: hello'
parser.parse(str)
})
it('should handle an showMessage statement definition', function () {
var str = 'info\nshowInfo'
const str = 'info\nshowInfo'
parser.parse(str)
})
})
import { logger } from '../../logger'
var message = ''
var info = false
let message = ''
let info = false

@@ -6,0 +6,0 @@ export const setMessage = function (txt) {

@@ -13,4 +13,3 @@ import db from './exampleDb'

export const draw = function (txt, id, ver) {
var parser
parser = exampleParser.parser
const parser = exampleParser.parser
parser.yy = db

@@ -22,5 +21,5 @@ logger.debug('Renering example diagram')

// Fetch the default direction, use TD if none was found
var svg = d3.select('#' + id)
const svg = d3.select('#' + id)
var g = svg.append('g')
const g = svg.append('g')

@@ -27,0 +26,0 @@ g.append('text') // text label for the x axis

@@ -8,8 +8,7 @@ import graphDb from './graphDb'

var conf = {
const conf = {
}
export const setConf = function (cnf) {
var keys = Object.keys(cnf)
var i
for (i = 0; i < keys.length; i++) {
const keys = Object.keys(cnf)
for (let i = 0; i < keys.length; i++) {
conf[keys[i]] = cnf[keys[i]]

@@ -25,8 +24,7 @@ }

export const addVertices = function (vert, g) {
var keys = Object.keys(vert)
const keys = Object.keys(vert)
var styleFromStyleArr = function (styleStr, arr) {
var i
const styleFromStyleArr = function (styleStr, arr) {
// Create a compound style definition from the style definitions found for the node in the graph definition
for (i = 0; i < arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
if (typeof arr[i] !== 'undefined') {

@@ -42,4 +40,4 @@ styleStr = styleStr + arr[i] + ';'

keys.forEach(function (id) {
var vertice = vert[id]
var verticeText
const vertice = vert[id]
let verticeText

@@ -50,4 +48,3 @@ /**

*/
var classStr = ''
let classStr = ''
if (vertice.classes.length > 0) {

@@ -61,3 +58,3 @@ classStr = vertice.classes.join(' ')

*/
var style = ''
let style = ''
// Create a compound style definition from the style definitions found for the node in the graph definition

@@ -73,3 +70,3 @@ style = styleFromStyleArr(style, vertice.styles)

var labelTypeStr = ''
let labelTypeStr = ''
if (conf.htmlLabels) {

@@ -81,9 +78,8 @@ labelTypeStr = 'html'

} else {
var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text')
const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text')
var rows = verticeText.split(/<br>/)
const rows = verticeText.split(/<br>/)
var j = 0
for (j = 0; j < rows.length; j++) {
var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan')
for (let j = 0; j < rows.length; j++) {
const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan')
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve')

@@ -100,5 +96,4 @@ tspan.setAttribute('dy', '1em')

var radious = 0
var _shape = ''
let radious = 0
let _shape = ''
// Set the shape based parameters

@@ -147,5 +142,5 @@ switch (vertice.type) {

export const addEdges = function (edges, g) {
var cnt = 0
let cnt = 0
var defaultStyle
let defaultStyle
if (typeof edges.defaultStyle !== 'undefined') {

@@ -157,3 +152,3 @@ defaultStyle = edges.defaultStyle.toString().replace(/,/g, ';')

cnt++
var edgeData = {}
const edgeData = {}

@@ -167,4 +162,3 @@ // Set link type for rendering

var style = ''
let style = ''
if (typeof edge.style !== 'undefined') {

@@ -230,3 +224,3 @@ edge.style.forEach(function (s) {

export const getClasses = function (text, isDot) {
var parser
let parser
graphDb.clear()

@@ -243,3 +237,3 @@ if (isDot) {

var classes = graphDb.getClasses()
const classes = graphDb.getClasses()

@@ -264,3 +258,3 @@ // Add default class if undefined

logger.debug('Drawing flowchart')
var parser
let parser
graphDb.clear()

@@ -282,4 +276,3 @@ if (isDot) {

// Fetch the default direction, use TD if none was found
var dir
dir = graphDb.getDirection()
let dir = graphDb.getDirection()
if (typeof dir === 'undefined') {

@@ -290,3 +283,3 @@ dir = 'TD'

// Create the input mermaid.graph
var g = new dagreD3.graphlib.Graph({
const g = new dagreD3.graphlib.Graph({
multigraph: true,

@@ -305,6 +298,5 @@ compound: true

var subG
var subGraphs = graphDb.getSubGraphs()
var i = 0
for (i = subGraphs.length - 1; i >= 0; i--) {
let subG
const subGraphs = graphDb.getSubGraphs()
for (let i = subGraphs.length - 1; i >= 0; i--) {
subG = subGraphs[i]

@@ -315,8 +307,7 @@ graphDb.addVertex(subG.id, subG.title, 'group', undefined)

// Fetch the verices/nodes and edges/links from the parsed graph definition
var vert = graphDb.getVertices()
const vert = graphDb.getVertices()
var edges = graphDb.getEdges()
const edges = graphDb.getEdges()
i = 0
var j
let i = 0
for (i = subGraphs.length - 1; i >= 0; i--) {

@@ -327,3 +318,3 @@ subG = subGraphs[i]

for (j = 0; j < subG.nodes.length; j++) {
for (let j = 0; j < subG.nodes.length; j++) {
g.setParent(subG.nodes[j], subG.id)

@@ -336,11 +327,11 @@ }

// Create the renderer
var Render = dagreD3.render
var render = new Render()
const Render = dagreD3.render
const render = new Render()
// Add custom shape for rhombus type of boc (decision)
render.shapes().question = function (parent, bbox, node) {
var w = bbox.width
var h = bbox.height
var s = (w + h) * 0.8
var points = [
const w = bbox.width
const h = bbox.height
const s = (w + h) * 0.8
const points = [
{ x: s / 2, y: 0 },

@@ -351,3 +342,3 @@ { x: s, y: -s / 2 },

]
var shapeSvg = parent.insert('polygon', ':first-child')
const shapeSvg = parent.insert('polygon', ':first-child')
.attr('points', points.map(function (d) {

@@ -367,5 +358,5 @@ return d.x + ',' + d.y

render.shapes().rect_left_inv_arrow = function (parent, bbox, node) {
var w = bbox.width
var h = bbox.height
var points = [
const w = bbox.width
const h = bbox.height
const points = [
{ x: -h / 2, y: 0 },

@@ -377,3 +368,3 @@ { x: w, y: 0 },

]
var shapeSvg = parent.insert('polygon', ':first-child')
const shapeSvg = parent.insert('polygon', ':first-child')
.attr('points', points.map(function (d) {

@@ -391,5 +382,5 @@ return d.x + ',' + d.y

render.shapes().rect_right_inv_arrow = function (parent, bbox, node) {
var w = bbox.width
var h = bbox.height
var points = [
const w = bbox.width
const h = bbox.height
const points = [
{ x: 0, y: 0 },

@@ -401,3 +392,3 @@ { x: w + h / 2, y: 0 },

]
var shapeSvg = parent.insert('polygon', ':first-child')
const shapeSvg = parent.insert('polygon', ':first-child')
.attr('points', points.map(function (d) {

@@ -415,3 +406,3 @@ return d.x + ',' + d.y

render.arrows().none = function normal (parent, id, edge, type) {
var marker = parent.append('marker')
const marker = parent.append('marker')
.attr('id', id)

@@ -426,3 +417,3 @@ .attr('viewBox', '0 0 10 10')

var path = marker.append('path')
const path = marker.append('path')
.attr('d', 'M 0 0 L 0 0 L 0 0 z')

@@ -434,3 +425,3 @@ dagreD3.util.applyStyle(path, edge[type + 'Style'])

render.arrows().normal = function normal (parent, id, edge, type) {
var marker = parent.append('marker')
const marker = parent.append('marker')
.attr('id', id)

@@ -453,6 +444,6 @@ .attr('viewBox', '0 0 10 10')

// Set up an SVG group so that we can translate the final graph.
var svg = d3.select('#' + id)
const svg = d3.select('#' + id)
// Run the renderer. This is what draws the final graph.
var element = d3.select('#' + id + ' g')
const element = d3.select('#' + id + ' g')
render(element, g)

@@ -489,10 +480,10 @@

if (subG.title !== 'undefined') {
var clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect')
var clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id)
const clusterRects = document.querySelectorAll('#' + id + ' #' + subG.id + ' rect')
const clusterEl = document.querySelectorAll('#' + id + ' #' + subG.id)
var xPos = clusterRects[0].x.baseVal.value
var yPos = clusterRects[0].y.baseVal.value
var width = clusterRects[0].width.baseVal.value
var cluster = d3.select(clusterEl[0])
var te = cluster.append('text')
const xPos = clusterRects[0].x.baseVal.value
const yPos = clusterRects[0].y.baseVal.value
const width = clusterRects[0].width.baseVal.value
const cluster = d3.select(clusterEl[0])
const te = cluster.append('text')
te.attr('x', xPos + width / 2)

@@ -515,11 +506,10 @@ te.attr('y', yPos + 14)

if (!conf.htmlLabels) {
var labels = document.querySelectorAll('#' + id + ' .edgeLabel .label')
var k
for (k = 0; k < labels.length; k++) {
var label = labels[i]
const labels = document.querySelectorAll('#' + id + ' .edgeLabel .label')
for (let k = 0; k < labels.length; k++) {
const label = labels[i]
// Get dimensions of label
var dim = label.getBBox()
const dim = label.getBBox()
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')
rect.setAttribute('rx', 0)

@@ -526,0 +516,0 @@ rect.setAttribute('ry', 0)

@@ -5,11 +5,11 @@ import { logger } from '../../logger'

var vertices = {}
var edges = []
var classes = []
var subGraphs = []
var tooltips = {}
var subCount = 0
var direction
let vertices = {}
let edges = []
let classes = []
let subGraphs = []
let tooltips = {}
let subCount = 0
let direction
// Functions to be run after graph rendering
var funs = []
let funs = []
/**

@@ -23,3 +23,3 @@ * Function called by parser when a node definition has been found

export const addVertex = function (id, text, type, style) {
var txt
let txt

@@ -70,3 +70,3 @@ if (typeof id === 'undefined') {

logger.info('Got edge...', start, end)
var edge = { start: start, end: end, type: undefined, text: '' }
const edge = { start: start, end: end, type: undefined, text: '' }
linktext = type.text

@@ -159,3 +159,3 @@

var setTooltip = function (id, tooltip) {
const setTooltip = function (id, tooltip) {
if (typeof tooltip !== 'undefined') {

@@ -166,3 +166,3 @@ tooltips[id] = tooltip

var setClickFun = function (id, functionName) {
const setClickFun = function (id, functionName) {
if (typeof functionName === 'undefined') {

@@ -173,3 +173,3 @@ return

funs.push(function (element) {
var elem = d3.select(element).select('#' + id)
const elem = d3.select(element).select('#' + id)
if (elem !== null) {

@@ -184,3 +184,3 @@ elem.on('click', function () {

var setLink = function (id, linkStr) {
const setLink = function (id, linkStr) {
if (typeof linkStr === 'undefined') {

@@ -191,3 +191,3 @@ return

funs.push(function (element) {
var elem = d3.select(element).select('#' + id)
const elem = d3.select(element).select('#' + id)
if (elem !== null) {

@@ -255,4 +255,4 @@ elem.on('click', function () {

var setupToolTips = function (element) {
var tooltipElem = d3.select('.mermaidTooltip')
const setupToolTips = function (element) {
let tooltipElem = d3.select('.mermaidTooltip')
if (tooltipElem[0][0] === null) {

@@ -265,9 +265,9 @@ tooltipElem = d3.select('body')

var svg = d3.select(element).select('svg')
const svg = d3.select(element).select('svg')
var nodes = svg.selectAll('g.node')
const nodes = svg.selectAll('g.node')
nodes
.on('mouseover', function () {
var el = d3.select(this)
var title = el.attr('title')
const el = d3.select(this)
const title = el.attr('title')
// Dont try to draw a tooltip if no data is provided

@@ -277,3 +277,3 @@ if (title === null) {

}
var rect = this.getBoundingClientRect()
const rect = this.getBoundingClientRect()

@@ -292,3 +292,3 @@ tooltipElem.transition()

.style('opacity', 0)
var el = d3.select(this)
const el = d3.select(this)
el.classed('hover', false)

@@ -325,7 +325,7 @@ })

function uniq (a) {
var prims = { 'boolean': {}, 'number': {}, 'string': {} }
var objs = []
const prims = { 'boolean': {}, 'number': {}, 'string': {} }
const objs = []
return a.filter(function (item) {
var type = typeof item
const type = typeof item
if (item === ' ') {

@@ -338,7 +338,7 @@ return false

var nodeList = []
let nodeList = []
nodeList = uniq(nodeList.concat.apply(nodeList, list))
var subGraph = { id: 'subGraph' + subCount, nodes: nodeList, title: title }
const subGraph = { id: 'subGraph' + subCount, nodes: nodeList, title: title }
subGraphs.push(subGraph)

@@ -349,5 +349,4 @@ subCount = subCount + 1

var getPosForId = function (id) {
var i
for (i = 0; i < subGraphs.length; i++) {
const getPosForId = function (id) {
for (let i = 0; i < subGraphs.length; i++) {
if (subGraphs[i].id === id) {

@@ -359,6 +358,6 @@ return i

}
var secCount = -1
var posCrossRef = []
var indexNodes2 = function (id, pos) {
var nodes = subGraphs[pos].nodes
let secCount = -1
const posCrossRef = []
const indexNodes2 = function (id, pos) {
const nodes = subGraphs[pos].nodes
secCount = secCount + 1

@@ -377,9 +376,9 @@ if (secCount > 2000) {

var count = 0
var posCount = 1
let count = 0
let posCount = 1
while (count < nodes.length) {
var childPos = getPosForId(nodes[count])
const childPos = getPosForId(nodes[count])
// Ignore regular nodes (pos will be -1)
if (childPos >= 0) {
var res = indexNodes2(id, childPos)
const res = indexNodes2(id, childPos)
if (res.result) {

@@ -386,0 +385,0 @@ return {

@@ -11,6 +11,6 @@ import graphDb from '../graphDb'

it('should handle a nodes and edges', function () {
var res = flow.parser.parse('graph TD;\nA-->B;')
const res = flow.parser.parse('graph TD;\nA-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -27,7 +27,7 @@ expect(vert['A'].id).toBe('A')

it('should handle angle bracket ' > ' as direction LR', function () {
var res = flow.parser.parse('graph >;A-->B;')
const res = flow.parser.parse('graph >;A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
var direction = flow.parser.yy.getDirection()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
const direction = flow.parser.yy.getDirection()

@@ -46,7 +46,7 @@ expect(direction).toBe('LR')

it('should handle angle bracket ' < ' as direction RL', function () {
var res = flow.parser.parse('graph <;A-->B;')
const res = flow.parser.parse('graph <;A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
var direction = flow.parser.yy.getDirection()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
const direction = flow.parser.yy.getDirection()

@@ -65,7 +65,7 @@ expect(direction).toBe('RL')

it('should handle caret ' ^ ' as direction BT', function () {
var res = flow.parser.parse('graph ^;A-->B;')
const res = flow.parser.parse('graph ^;A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
var direction = flow.parser.yy.getDirection()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
const direction = flow.parser.yy.getDirection()

@@ -84,7 +84,7 @@ expect(direction).toBe('BT')

it('should handle lower-case \'v\' as direction TB', function () {
var res = flow.parser.parse('graph v;A-->B;')
const res = flow.parser.parse('graph v;A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
var direction = flow.parser.yy.getDirection()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
const direction = flow.parser.yy.getDirection()

@@ -103,6 +103,6 @@ expect(direction).toBe('TB')

it('should handle a nodes and edges and a space between link and node', function () {
var res = flow.parser.parse('graph TD;A --> B;')
const res = flow.parser.parse('graph TD;A --> B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -119,6 +119,6 @@ expect(vert['A'].id).toBe('A')

it('should handle a nodes and edges, a space between link and node and each line ending without semicolon', function () {
var res = flow.parser.parse('graph TD\nA --> B\n style e red')
const res = flow.parser.parse('graph TD\nA --> B\n style e red')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -134,6 +134,6 @@ expect(vert['A'].id).toBe('A')

it('should handle statements ending without semicolon', function () {
var res = flow.parser.parse('graph TD\nA-->B\nB-->C')
const res = flow.parser.parse('graph TD\nA-->B\nB-->C')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -150,6 +150,6 @@ expect(vert['A'].id).toBe('A')

it('should handle a comments', function () {
var res = flow.parser.parse('graph TD;\n%% CComment\n A-->B;')
const res = flow.parser.parse('graph TD;\n%% CComment\n A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -165,6 +165,6 @@ expect(vert['A'].id).toBe('A')

it('should handle comments a at the start', function () {
var res = flow.parser.parse('%% Comment\ngraph TD;\n A-->B;')
const res = flow.parser.parse('%% Comment\ngraph TD;\n A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -180,6 +180,6 @@ expect(vert['A'].id).toBe('A')

it('should handle comments at the end', function () {
var res = flow.parser.parse('graph TD;\n A-->B\n %% Comment at the find\n')
const res = flow.parser.parse('graph TD;\n A-->B\n %% Comment at the find\n')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -195,6 +195,6 @@ expect(vert['A'].id).toBe('A')

it('should handle comments at the end no trailing newline', function () {
var res = flow.parser.parse('graph TD;\n A-->B\n%% Commento')
const res = flow.parser.parse('graph TD;\n A-->B\n%% Commento')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -210,6 +210,6 @@ expect(vert['A'].id).toBe('A')

it('should handle comments at the end many trailing newlines', function () {
var res = flow.parser.parse('graph TD;\n A-->B\n%% Commento\n\n\n')
const res = flow.parser.parse('graph TD;\n A-->B\n%% Commento\n\n\n')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -225,6 +225,6 @@ expect(vert['A'].id).toBe('A')

it('should handle no trailing newlines', function () {
var res = flow.parser.parse('graph TD;\n A-->B')
const res = flow.parser.parse('graph TD;\n A-->B')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -240,6 +240,6 @@ expect(vert['A'].id).toBe('A')

it('should handle many trailing newlines', function () {
var res = flow.parser.parse('graph TD;\n A-->B\n\n')
const res = flow.parser.parse('graph TD;\n A-->B\n\n')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -255,6 +255,6 @@ expect(vert['A'].id).toBe('A')

it('should handle a comments with blank rows in-between', function () {
var res = flow.parser.parse('graph TD;\n\n\n %% Comment\n A-->B;')
const res = flow.parser.parse('graph TD;\n\n\n %% Comment\n A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -271,6 +271,6 @@ expect(vert['A'].id).toBe('A')

it('should handle a comments mermaid flowchart code in them', function () {
var res = flow.parser.parse('graph TD;\n\n\n %% Test od>Odd shape]-->|Two line<br>edge comment|ro;\n A-->B;')
const res = flow.parser.parse('graph TD;\n\n\n %% Test od>Odd shape]-->|Two line<br>edge comment|ro;\n A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -287,6 +287,6 @@ expect(vert['A'].id).toBe('A')

it('it should handle a trailing whitespaces after statememnts', function () {
var res = flow.parser.parse('graph TD;\n\n\n %% Comment\n A-->B; \n B-->C;')
const res = flow.parser.parse('graph TD;\n\n\n %% Comment\n A-->B; \n B-->C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -303,6 +303,6 @@ expect(vert['A'].id).toBe('A')

it('should handle node names with "end" substring', function () {
var res = flow.parser.parse('graph TD\nendpoint --> sender')
const res = flow.parser.parse('graph TD\nendpoint --> sender')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -316,6 +316,6 @@ expect(vert['endpoint'].id).toBe('endpoint')

it('should handle node names ending with keywords', function () {
var res = flow.parser.parse('graph TD\nblend --> monograph')
const res = flow.parser.parse('graph TD\nblend --> monograph')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -329,6 +329,6 @@ expect(vert['blend'].id).toBe('blend')

it('should handle open ended edges', function () {
var res = flow.parser.parse('graph TD;A---B;')
const res = flow.parser.parse('graph TD;A---B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -339,6 +339,6 @@ expect(edges[0].type).toBe('arrow_open')

it('should handle cross ended edges', function () {
var res = flow.parser.parse('graph TD;A--xB;')
const res = flow.parser.parse('graph TD;A--xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -349,6 +349,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle open ended edges', function () {
var res = flow.parser.parse('graph TD;A--oB;')
const res = flow.parser.parse('graph TD;A--oB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -358,6 +358,6 @@ expect(edges[0].type).toBe('arrow_circle')

it('should handle subgraphs', function () {
var res = flow.parser.parse('graph TD;A-->B;subgraph myTitle;c-->d;end;')
const res = flow.parser.parse('graph TD;A-->B;subgraph myTitle;c-->d;end;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -368,6 +368,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle subgraphs', function () {
var res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\n\n c-->d \nend\n')
const res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\n\n c-->d \nend\n')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -378,3 +378,3 @@ expect(edges[0].type).toBe('arrow')

it('should handle nested subgraphs', function () {
var str = 'graph TD\n' +
const str = 'graph TD\n' +
'A-->B\n' +

@@ -386,10 +386,10 @@ 'subgraph myTitle\n\n' +

'end\n'
var res = flow.parser.parse(str)
const res = flow.parser.parse(str)
})
it('should handle subgraphs', function () {
var res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\nc-->d\nend;')
const res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\nc-->d\nend;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -400,6 +400,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle subgraphs', function () {
var res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\nc-- text -->d\nd-->e\n end;')
const res = flow.parser.parse('graph TD\nA-->B\nsubgraph myTitle\nc-- text -->d\nd-->e\n end;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -410,6 +410,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle classDefs with style in classes', function () {
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass font-style:bold;')
const res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass font-style:bold;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -420,6 +420,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle classDefs with % in classes', function () {
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass fill:#f96,stroke:#333,stroke-width:4px,font-size:50%,font-style:bold;')
const res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass fill:#f96,stroke:#333,stroke-width:4px,font-size:50%,font-style:bold;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -430,3 +430,3 @@ expect(edges[0].type).toBe('arrow')

it('should handle style definitons with more then 1 digit in a row', function () {
var res = flow.parser.parse('graph TD\n' +
const res = flow.parser.parse('graph TD\n' +
'A-->B1\n' +

@@ -445,4 +445,4 @@ 'A-->B2\n' +

var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -453,8 +453,8 @@ expect(edges[0].type).toBe('arrow')

it('should handle line interpolation default definitions', function () {
var res = flow.parser.parse('graph TD\n' +
const res = flow.parser.parse('graph TD\n' +
'A-->B\n' +
'linkStyle default interpolate basis')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -465,3 +465,3 @@ expect(edges.defaultInterpolate).toBe('basis')

it('should handle line interpolation numbered definitions', function () {
var res = flow.parser.parse('graph TD\n' +
const res = flow.parser.parse('graph TD\n' +
'A-->B\n' +

@@ -472,4 +472,4 @@ 'A-->C\n' +

var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -481,8 +481,8 @@ expect(edges[0].interpolate).toBe('basis')

it('should handle line interpolation default with style', function () {
var res = flow.parser.parse('graph TD\n' +
const res = flow.parser.parse('graph TD\n' +
'A-->B\n' +
'linkStyle default interpolate basis stroke-width:1px;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -493,3 +493,3 @@ expect(edges.defaultInterpolate).toBe('basis')

it('should handle line interpolation numbered with style', function () {
var res = flow.parser.parse('graph TD\n' +
const res = flow.parser.parse('graph TD\n' +
'A-->B\n' +

@@ -500,4 +500,4 @@ 'A-->C\n' +

var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -511,6 +511,6 @@ expect(edges[0].interpolate).toBe('basis')

spyOn(graphDb, 'setClickEvent')
var res = flow.parser.parse('graph TD\nA-->B\nclick A callback')
const res = flow.parser.parse('graph TD\nA-->B\nclick A callback')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -522,6 +522,6 @@ expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, undefined)

spyOn(graphDb, 'setClickEvent')
var res = flow.parser.parse('graph TD\nA-->B\nclick A callback "tooltip"')
const res = flow.parser.parse('graph TD\nA-->B\nclick A callback "tooltip"')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -533,6 +533,6 @@ expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, 'tooltip')

spyOn(graphDb, 'setClickEvent')
var res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html"')
const res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html"')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -543,6 +543,6 @@ expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', undefined)

spyOn(graphDb, 'setClickEvent')
var res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html" "tooltip"')
const res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html" "tooltip"')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -555,6 +555,6 @@ expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', 'tooltip')

it('it should handle text without space', function () {
var res = flow.parser.parse('graph TD;A--x|textNoSpace|B;')
const res = flow.parser.parse('graph TD;A--x|textNoSpace|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -565,6 +565,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle with space', function () {
var res = flow.parser.parse('graph TD;A--x|text including space|B;')
const res = flow.parser.parse('graph TD;A--x|text including space|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -575,6 +575,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('it should handle text with /', function () {
var res = flow.parser.parse('graph TD;A--x|text with / should work|B;')
const res = flow.parser.parse('graph TD;A--x|text with / should work|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -585,6 +585,6 @@ expect(edges[0].text).toBe('text with / should work')

it('it should handle space and space between vertices and link', function () {
var res = flow.parser.parse('graph TD;A --x|textNoSpace| B;')
const res = flow.parser.parse('graph TD;A --x|textNoSpace| B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -595,6 +595,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and CAPS', function () {
var res = flow.parser.parse('graph TD;A--x|text including CAPS space|B;')
const res = flow.parser.parse('graph TD;A--x|text including CAPS space|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -605,6 +605,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and dir', function () {
var res = flow.parser.parse('graph TD;A--x|text including URL space|B;')
const res = flow.parser.parse('graph TD;A--x|text including URL space|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -616,6 +616,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and send', function () {
var res = flow.parser.parse('graph TD;A--text including URL space and send-->B;')
const res = flow.parser.parse('graph TD;A--text including URL space and send-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -626,6 +626,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle space and send', function () {
var res = flow.parser.parse('graph TD;A-- text including URL space and send -->B;')
const res = flow.parser.parse('graph TD;A-- text including URL space and send -->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -637,6 +637,6 @@ expect(edges[0].type).toBe('arrow')

it('should handle space and dir (TD)', function () {
var res = flow.parser.parse('graph TD;A--x|text including R TD space|B;')
const res = flow.parser.parse('graph TD;A--x|text including R TD space|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -647,6 +647,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle `', function () {
var res = flow.parser.parse('graph TD;A--x|text including `|B;')
const res = flow.parser.parse('graph TD;A--x|text including `|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -658,6 +658,6 @@ expect(edges[0].type).toBe('arrow_cross')

// only v
var res = flow.parser.parse('graph TD;A--xv(my text);')
const res = flow.parser.parse('graph TD;A--xv(my text);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -669,6 +669,6 @@ expect(edges[0].type).toBe('arrow_cross')

// v at end
var res = flow.parser.parse('graph TD;A--xcsv(my text);')
const res = flow.parser.parse('graph TD;A--xcsv(my text);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -680,6 +680,6 @@ expect(edges[0].type).toBe('arrow_cross')

// v in middle
var res = flow.parser.parse('graph TD;A--xava(my text);')
const res = flow.parser.parse('graph TD;A--xava(my text);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -691,6 +691,6 @@ expect(edges[0].type).toBe('arrow_cross')

// v at start
var res = flow.parser.parse('graph TD;A--xva(my text);')
const res = flow.parser.parse('graph TD;A--xva(my text);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -701,6 +701,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle keywords', function () {
var res = flow.parser.parse('graph TD;A--x|text including graph space|B;')
const res = flow.parser.parse('graph TD;A--x|text including graph space|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -710,17 +710,17 @@ expect(edges[0].text).toBe('text including graph space')

it('should handle keywords', function () {
var res = flow.parser.parse('graph TD;V-->a[v]')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const res = flow.parser.parse('graph TD;V-->a[v]')
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
expect(vert['a'].text).toBe('v')
})
it('should handle keywords', function () {
var res = flow.parser.parse('graph TD;V-->a[v]')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const res = flow.parser.parse('graph TD;V-->a[v]')
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
expect(vert['a'].text).toBe('v')
})
it('should handle quoted text', function () {
var res = flow.parser.parse('graph TD;V-- "test string()" -->a[v]')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const res = flow.parser.parse('graph TD;V-- "test string()" -->a[v]')
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
expect(edges[0].text).toBe('test string()')

@@ -732,6 +732,6 @@ })

it('it should handle regular lines', function () {
var res = flow.parser.parse('graph TD;A-->B;')
const res = flow.parser.parse('graph TD;A-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -741,6 +741,6 @@ expect(edges[0].stroke).toBe('normal')

it('it should handle dotted lines', function () {
var res = flow.parser.parse('graph TD;A-.->B;')
const res = flow.parser.parse('graph TD;A-.->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -750,6 +750,6 @@ expect(edges[0].stroke).toBe('dotted')

it('it should handle dotted lines', function () {
var res = flow.parser.parse('graph TD;A==>B;')
const res = flow.parser.parse('graph TD;A==>B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -759,6 +759,6 @@ expect(edges[0].stroke).toBe('thick')

it('it should handle text on lines', function () {
var res = flow.parser.parse('graph TD;A-- test text with == -->B;')
const res = flow.parser.parse('graph TD;A-- test text with == -->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -768,6 +768,6 @@ expect(edges[0].stroke).toBe('normal')

it('it should handle text on lines', function () {
var res = flow.parser.parse('graph TD;A-. test text with == .->B;')
const res = flow.parser.parse('graph TD;A-. test text with == .->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -777,6 +777,6 @@ expect(edges[0].stroke).toBe('dotted')

it('it should handle text on lines', function () {
var res = flow.parser.parse('graph TD;A== test text with - ==>B;')
const res = flow.parser.parse('graph TD;A== test text with - ==>B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -789,6 +789,6 @@ expect(edges[0].stroke).toBe('thick')

it('it should handle text without space', function () {
var res = flow.parser.parse('graph TD;A-- textNoSpace --xB;')
const res = flow.parser.parse('graph TD;A-- textNoSpace --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -799,6 +799,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('it should handle text with multiple leading space', function () {
var res = flow.parser.parse('graph TD;A-- textNoSpace --xB;')
const res = flow.parser.parse('graph TD;A-- textNoSpace --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -809,6 +809,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle with space', function () {
var res = flow.parser.parse('graph TD;A-- text including space --xB;')
const res = flow.parser.parse('graph TD;A-- text including space --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -819,6 +819,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('it should handle text with /', function () {
var res = flow.parser.parse('graph TD;A -- text with / should work --x B;')
const res = flow.parser.parse('graph TD;A -- text with / should work --x B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -829,6 +829,6 @@ expect(edges[0].text).toBe('text with / should work')

it('it should handle space and space between vertices and link', function () {
var res = flow.parser.parse('graph TD;A -- textNoSpace --x B;')
const res = flow.parser.parse('graph TD;A -- textNoSpace --x B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -839,6 +839,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and CAPS', function () {
var res = flow.parser.parse('graph TD;A-- text including CAPS space --xB;')
const res = flow.parser.parse('graph TD;A-- text including CAPS space --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -849,6 +849,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and dir', function () {
var res = flow.parser.parse('graph TD;A-- text including URL space --xB;')
const res = flow.parser.parse('graph TD;A-- text including URL space --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -860,6 +860,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle space and dir (TD)', function () {
var res = flow.parser.parse('graph TD;A-- text including R TD space --xB;')
const res = flow.parser.parse('graph TD;A-- text including R TD space --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -870,6 +870,6 @@ expect(edges[0].type).toBe('arrow_cross')

it('should handle keywords', function () {
var res = flow.parser.parse('graph TD;A-- text including graph space and v --xB;')
const res = flow.parser.parse('graph TD;A-- text including graph space and v --xB;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -879,6 +879,6 @@ expect(edges[0].text).toBe('text including graph space and v')

it('should handle keywords', function () {
var res = flow.parser.parse('graph TD;A-- text including graph space and v --xB[blav]')
const res = flow.parser.parse('graph TD;A-- text including graph space and v --xB[blav]')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -888,6 +888,6 @@ expect(edges[0].text).toBe('text including graph space and v')

// xit('should handle text on open links',function(){
// var res = flow.parser.parse('graph TD;A-- text including graph space --B');
// const res = flow.parser.parse('graph TD;A-- text including graph space --B');
//
// var vert = flow.parser.yy.getVertices();
// var edges = flow.parser.yy.getEdges();
// const vert = flow.parser.yy.getVertices();
// const edges = flow.parser.yy.getEdges();
//

@@ -900,6 +900,6 @@ // expect(edges[0].text).toBe('text including graph space');

it('should handle multi-line text', function () {
var res = flow.parser.parse('graph TD;A--o|text space|B;\n B-->|more text with space|C;')
const res = flow.parser.parse('graph TD;A--o|text space|B;\n B-->|more text with space|C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -921,5 +921,5 @@ expect(edges[0].type).toBe('arrow_circle')

it('should handle multiple edges', function () {
var res = flow.parser.parse('graph TD;A---|This is the 123 s text|B;\nA---|This is the second edge|B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const res = flow.parser.parse('graph TD;A---|This is the 123 s text|B;\nA---|This is the second edge|B;')
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -938,6 +938,6 @@ expect(vert['A'].id).toBe('A')

it('should handle text in vertices with space', function () {
var res = flow.parser.parse('graph TD;A[chimpansen hoppar]-->C;')
const res = flow.parser.parse('graph TD;A[chimpansen hoppar]-->C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -949,6 +949,6 @@ expect(vert['A'].type).toBe('square')

it('should handle text in vertices with space with spaces between vertices and link', function () {
var res = flow.parser.parse('graph TD;A[chimpansen hoppar] --> C;')
const res = flow.parser.parse('graph TD;A[chimpansen hoppar] --> C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -960,6 +960,6 @@ expect(vert['A'].type).toBe('square')

it('should handle quoted text in vertices ', function () {
var res = flow.parser.parse('graph TD;A["chimpansen hoppar ()[]"] --> C;')
const res = flow.parser.parse('graph TD;A["chimpansen hoppar ()[]"] --> C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -971,6 +971,6 @@ expect(vert['A'].type).toBe('square')

it('should handle text in circle vertices with space', function () {
var res = flow.parser.parse('graph TD;A((chimpansen hoppar))-->C;')
const res = flow.parser.parse('graph TD;A((chimpansen hoppar))-->C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -982,6 +982,6 @@ expect(vert['A'].type).toBe('circle')

it('should handle text in ellipse vertices', function () {
var res = flow.parser.parse('graph TD\nA(-this is an ellipse-)-->B')
const res = flow.parser.parse('graph TD\nA(-this is an ellipse-)-->B')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -993,6 +993,6 @@ expect(vert['A'].type).toBe('ellipse')

it('should handle text in diamond vertices with space', function () {
var res = flow.parser.parse('graph TD;A(chimpansen hoppar)-->C;')
const res = flow.parser.parse('graph TD;A(chimpansen hoppar)-->C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1004,6 +1004,6 @@ expect(vert['A'].type).toBe('round')

it('should handle text in with ?', function () {
var res = flow.parser.parse('graph TD;A(?)-->|?|C;')
const res = flow.parser.parse('graph TD;A(?)-->|?|C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1014,6 +1014,6 @@ expect(vert['A'].text).toBe('?')

it('should handle text in with éèêàçô', function () {
var res = flow.parser.parse('graph TD;A(éèêàçô)-->|éèêàçô|C;')
const res = flow.parser.parse('graph TD;A(éèêàçô)-->|éèêàçô|C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1025,6 +1025,6 @@ expect(vert['A'].text).toBe('éèêàçô')

it('should handle text in with ,.?!+-*', function () {
var res = flow.parser.parse('graph TD;A(,.?!+-*)-->|,.?!+-*|C;')
const res = flow.parser.parse('graph TD;A(,.?!+-*)-->|,.?!+-*|C;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1037,6 +1037,6 @@ expect(vert['A'].text).toBe(',.?!+-*')

it('it should handle space', function () {
var res = flow.parser.parse('graph TD;A-->C(Chimpansen hoppar);')
const res = flow.parser.parse('graph TD;A-->C(Chimpansen hoppar);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1047,6 +1047,6 @@ expect(vert['C'].type).toBe('round')

it('it should handle åäö and minus', function () {
var res = flow.parser.parse('graph TD;A-->C{Chimpansen hoppar åäö-ÅÄÖ};')
const res = flow.parser.parse('graph TD;A-->C{Chimpansen hoppar åäö-ÅÄÖ};')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1058,6 +1058,6 @@ expect(vert['C'].type).toBe('diamond')

it('it should handle with åäö, minus and space and br', function () {
var res = flow.parser.parse('graph TD;A-->C(Chimpansen hoppar åäö <br> - ÅÄÖ);')
const res = flow.parser.parse('graph TD;A-->C(Chimpansen hoppar åäö <br> - ÅÄÖ);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1068,6 +1068,6 @@ expect(vert['C'].type).toBe('round')

// xit('it should handle åäö, minus and space and br',function(){
// var res = flow.parser.parse('graph TD; A[Object&#40;foo,bar&#41;]-->B(Thing);');
// const res = flow.parser.parse('graph TD; A[Object&#40;foo,bar&#41;]-->B(Thing);');
//
// var vert = flow.parser.yy.getVertices();
// var edges = flow.parser.yy.getEdges();
// const vert = flow.parser.yy.getVertices();
// const edges = flow.parser.yy.getEdges();
//

@@ -1078,5 +1078,5 @@ // expect(vert['C'].type).toBe('round');

it('it should handle unicode chars', function () {
var res = flow.parser.parse('graph TD;A-->C(Начало);')
const res = flow.parser.parse('graph TD;A-->C(Начало);')
var vert = flow.parser.yy.getVertices()
const vert = flow.parser.yy.getVertices()

@@ -1086,5 +1086,5 @@ expect(vert['C'].text).toBe('Начало')

it('it should handle backslask', function () {
var res = flow.parser.parse('graph TD;A-->C(c:\\windows);')
const res = flow.parser.parse('graph TD;A-->C(c:\\windows);')
var vert = flow.parser.yy.getVertices()
const vert = flow.parser.yy.getVertices()

@@ -1094,6 +1094,6 @@ expect(vert['C'].text).toBe('c:\\windows')

it('it should handle CAPS', function () {
var res = flow.parser.parse('graph TD;A-->C(some CAPS);')
const res = flow.parser.parse('graph TD;A-->C(some CAPS);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1104,6 +1104,6 @@ expect(vert['C'].type).toBe('round')

it('it should handle directions', function () {
var res = flow.parser.parse('graph TD;A-->C(some URL);')
const res = flow.parser.parse('graph TD;A-->C(some URL);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1117,6 +1117,6 @@ expect(vert['C'].type).toBe('round')

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;A;')
const res = flow.parser.parse('graph TD;A;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1129,6 +1129,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a[A];')
const res = flow.parser.parse('graph TD;a[A];')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1141,6 +1141,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a[A];')
const res = flow.parser.parse('graph TD;a[A];')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1153,6 +1153,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a((A));')
const res = flow.parser.parse('graph TD;a((A));')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1164,6 +1164,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a(A);')
const res = flow.parser.parse('graph TD;a(A);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1175,6 +1175,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a>A];')
const res = flow.parser.parse('graph TD;a>A];')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1186,6 +1186,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a{A};')
const res = flow.parser.parse('graph TD;a{A};')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1197,6 +1197,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a{A <br> end};')
const res = flow.parser.parse('graph TD;a{A <br> end};')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1209,6 +1209,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;a(A <br> end);')
const res = flow.parser.parse('graph TD;a(A <br> end);')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1221,6 +1221,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;id1;')
const res = flow.parser.parse('graph TD;id1;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1232,6 +1232,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;1id;')
const res = flow.parser.parse('graph TD;1id;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1243,6 +1243,6 @@ expect(edges.length).toBe(0)

// Silly but syntactically correct
var res = flow.parser.parse('graph TD;i-d;')
const res = flow.parser.parse('graph TD;i-d;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1254,8 +1254,8 @@ expect(edges.length).toBe(0)

it('should handle styles for vertices', function () {
var res = flow.parser.parse('graph TD;style Q background:#fff;')
const res = flow.parser.parse('graph TD;style Q background:#fff;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()
var style = vert['Q'].styles[0]
const style = vert['Q'].styles[0]

@@ -1268,5 +1268,5 @@ expect(vert['Q'].styles.length).toBe(1)

it('should handle styles for edges', function () {
var res = flow.parser.parse('graph TD;a-->b;\nstyle #0 stroke: #f66;')
const res = flow.parser.parse('graph TD;a-->b;\nstyle #0 stroke: #f66;')
var edges = flow.parser.yy.getEdges()
const edges = flow.parser.yy.getEdges()

@@ -1277,6 +1277,6 @@ expect(edges.length).toBe(1)

it('should handle multiple styles for a vortex', function () {
var res = flow.parser.parse('graph TD;style R background:#fff,border:1px solid red;')
const res = flow.parser.parse('graph TD;style R background:#fff,border:1px solid red;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1289,6 +1289,6 @@ expect(vert['R'].styles.length).toBe(2)

it('should handle multiple styles in a graph', function () {
var res = flow.parser.parse('graph TD;style S background:#aaa;\nstyle T background:#bbb,border:1px solid red;')
const res = flow.parser.parse('graph TD;style S background:#aaa;\nstyle T background:#bbb,border:1px solid red;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1303,6 +1303,6 @@ expect(vert['S'].styles.length).toBe(1)

it('should handle styles and graph definitons in a graph', function () {
var res = flow.parser.parse('graph TD;S-->T;\nstyle S background:#aaa;\nstyle T background:#bbb,border:1px solid red;')
const res = flow.parser.parse('graph TD;S-->T;\nstyle S background:#aaa;\nstyle T background:#bbb,border:1px solid red;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1316,6 +1316,6 @@ expect(vert['S'].styles.length).toBe(1)

it('should handle styles and graph definitons in a graph', function () {
var res = flow.parser.parse('graph TD;style T background:#bbb,border:1px solid red;')
// var res = flow.parser.parse('graph TD;style T background: #bbb;');
const res = flow.parser.parse('graph TD;style T background:#bbb,border:1px solid red;')
// const res = flow.parser.parse('graph TD;style T background: #bbb;');
var vert = flow.parser.yy.getVertices()
const vert = flow.parser.yy.getVertices()

@@ -1328,7 +1328,7 @@ expect(vert['T'].styles.length).toBe(2)

describe('special characters should be be handled.', function () {
var charTest = function (char) {
var res = flow.parser.parse('graph TD;A(' + char + ')-->B;')
const charTest = function (char) {
const res = flow.parser.parse('graph TD;A(' + char + ')-->B;')
var vert = flow.parser.yy.getVertices()
var edges = flow.parser.yy.getEdges()
const vert = flow.parser.yy.getVertices()
const edges = flow.parser.yy.getEdges()

@@ -1383,6 +1383,6 @@ expect(vert['A'].id).toBe('A')

it('should be possible to declare a class', function () {
var res = flow.parser.parse('graph TD;classDef exClass background:#bbb,border:1px solid red;')
// var res = flow.parser.parse('graph TD;style T background: #bbb;');
const res = flow.parser.parse('graph TD;classDef exClass background:#bbb,border:1px solid red;')
// const res = flow.parser.parse('graph TD;style T background: #bbb;');
var classes = flow.parser.yy.getClasses()
const classes = flow.parser.yy.getClasses()

@@ -1395,6 +1395,6 @@ expect(classes['exClass'].styles.length).toBe(2)

it('should be possible to declare a class with a dot in the style', function () {
var res = flow.parser.parse('graph TD;classDef exClass background:#bbb,border:1.5px solid red;')
// var res = flow.parser.parse('graph TD;style T background: #bbb;');
const res = flow.parser.parse('graph TD;classDef exClass background:#bbb,border:1.5px solid red;')
// const res = flow.parser.parse('graph TD;style T background: #bbb;');
var classes = flow.parser.yy.getClasses()
const classes = flow.parser.yy.getClasses()

@@ -1406,6 +1406,6 @@ expect(classes['exClass'].styles.length).toBe(2)

it('should be possible to declare a class with a space in the style', function () {
var res = flow.parser.parse('graph TD;classDef exClass background: #bbb,border:1.5px solid red;')
// var res = flow.parser.parse('graph TD;style T background : #bbb;');
const res = flow.parser.parse('graph TD;classDef exClass background: #bbb,border:1.5px solid red;')
// const res = flow.parser.parse('graph TD;style T background : #bbb;');
var classes = flow.parser.yy.getClasses()
const classes = flow.parser.yy.getClasses()

@@ -1417,3 +1417,3 @@ expect(classes['exClass'].styles.length).toBe(2)

it('should be possible to apply a class to a vertex', function () {
var statement = ''
let statement = ''

@@ -1425,5 +1425,5 @@ statement = statement + 'graph TD;' + '\n'

var res = flow.parser.parse(statement)
const res = flow.parser.parse(statement)
var classes = flow.parser.yy.getClasses()
const classes = flow.parser.yy.getClasses()

@@ -1435,3 +1435,3 @@ expect(classes['exClass'].styles.length).toBe(2)

it('should be possible to apply a class to a comma separated list of vertices', function () {
var statement = ''
let statement = ''

@@ -1443,6 +1443,6 @@ statement = statement + 'graph TD;' + '\n'

var res = flow.parser.parse(statement)
const res = flow.parser.parse(statement)
var classes = flow.parser.yy.getClasses()
var vertices = flow.parser.yy.getVertices()
const classes = flow.parser.yy.getClasses()
const vertices = flow.parser.yy.getVertices()

@@ -1449,0 +1449,0 @@ expect(classes['exClass'].styles.length).toBe(2)

@@ -11,3 +11,3 @@ /* eslint-env jasmine */

it('should handle an dateFormat definition', function () {
var str = 'gantt\ndateFormat yyyy-mm-dd'
const str = 'gantt\ndateFormat yyyy-mm-dd'

@@ -17,3 +17,3 @@ parser.parse(str)

it('should handle an dateFormat definition', function () {
var str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'

@@ -23,3 +23,3 @@ parser.parse(str)

it('should handle an dateFormat definition', function () {
var str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'

@@ -29,3 +29,3 @@ parser.parse(str)

it('should handle an section definition', function () {
var str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid'

@@ -46,3 +46,3 @@ parser.parse(str)

it('should handle a task definition', function () {
var str = 'gantt\n' +
const str = 'gantt\n' +
'dateFormat yyyy-mm-dd\n' +

@@ -49,0 +49,0 @@ 'title Adding gantt diagram functionality to mermaid\n' +

import moment from 'moment'
import { logger } from '../../logger'
var dateFormat = ''
var title = ''
var sections = []
var tasks = []
var currentSection = ''
let dateFormat = ''
let title = ''
let sections = []
let tasks = []
let currentSection = ''

@@ -42,5 +42,5 @@ export const clear = function () {

export const getTasks = function () {
var allItemsPricessed = compileTasks()
var maxDepth = 10
var iterationCount = 0
let allItemsPricessed = compileTasks()
const maxDepth = 10
let iterationCount = 0
while (!allItemsPricessed && (iterationCount < maxDepth)) {

@@ -56,14 +56,14 @@ allItemsPricessed = compileTasks()

var getStartDate = function (prevTime, dateFormat, str) {
const getStartDate = function (prevTime, dateFormat, str) {
str = str.trim()
// Test for after
var re = /^after\s+([\d\w-]+)/
var afterStatement = re.exec(str.trim())
const re = /^after\s+([\d\w-]+)/
const afterStatement = re.exec(str.trim())
if (afterStatement !== null) {
var task = findTaskById(afterStatement[1])
const task = findTaskById(afterStatement[1])
if (typeof task === 'undefined') {
var dt = new Date()
const dt = new Date()
dt.setHours(0, 0, 0, 0)

@@ -87,3 +87,3 @@ return dt

var getEndDate = function (prevTime, dateFormat, str) {
const getEndDate = function (prevTime, dateFormat, str) {
str = str.trim()

@@ -96,6 +96,6 @@

var d = moment(prevTime)
const d = moment(prevTime)
// Check for length
var re = /^([\d]+)([wdhms])/
var durationStatement = re.exec(str.trim())
const re = /^([\d]+)([wdhms])/
const durationStatement = re.exec(str.trim())

@@ -126,4 +126,4 @@ if (durationStatement !== null) {

var taskCnt = 0
var parseId = function (idStr) {
let taskCnt = 0
const parseId = function (idStr) {
if (typeof idStr === 'undefined') {

@@ -146,4 +146,4 @@ taskCnt = taskCnt + 1

var compileData = function (prevTask, dataStr) {
var ds
const compileData = function (prevTask, dataStr) {
let ds

@@ -156,9 +156,9 @@ if (dataStr.substr(0, 1) === ':') {

var data = ds.split(',')
const data = ds.split(',')
var task = {}
var df = getDateFormat()
const task = {}
const df = getDateFormat()
// Get tags like active, done cand crit
var matchFound = true
let matchFound = true
while (matchFound) {

@@ -182,4 +182,3 @@ matchFound = false

}
var i
for (i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
data[i] = data[i].trim()

@@ -210,5 +209,4 @@ }

var parseData = function (prevTaskId, dataStr) {
var ds
const parseData = function (prevTaskId, dataStr) {
let ds
if (dataStr.substr(0, 1) === ':') {

@@ -220,8 +218,8 @@ ds = dataStr.substr(1, dataStr.length)

var data = ds.split(',')
const data = ds.split(',')
var task = {}
const task = {}
// Get tags like active, done cand crit
var matchFound = true
let matchFound = true
while (matchFound) {

@@ -245,4 +243,3 @@ matchFound = false

}
var i
for (i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
data[i] = data[i].trim()

@@ -273,8 +270,8 @@ }

var lastTask
var lastTaskID
var rawTasks = []
var taskDb = {}
let lastTask
let lastTaskID
let rawTasks = []
const taskDb = {}
export const addTask = function (descr, data) {
var rawTask = {
const rawTask = {
section: currentSection,

@@ -286,3 +283,3 @@ type: currentSection,

}
var taskInfo = parseData(lastTaskID, data)
const taskInfo = parseData(lastTaskID, data)
rawTask.raw.startTime = taskInfo.startTime

@@ -296,3 +293,3 @@ rawTask.raw.endTime = taskInfo.endTime

var pos = rawTasks.push(rawTask)
const pos = rawTasks.push(rawTask)

@@ -305,3 +302,3 @@ lastTaskID = rawTask.id

export const findTaskById = function (id) {
var pos = taskDb[id]
const pos = taskDb[id]
return rawTasks[pos]

@@ -311,3 +308,3 @@ }

export const addTaskOrg = function (descr, data) {
var newTask = {
const newTask = {
section: currentSection,

@@ -318,3 +315,3 @@ type: currentSection,

}
var taskInfo = compileData(lastTask, data)
const taskInfo = compileData(lastTask, data)
newTask.startTime = taskInfo.startTime

@@ -330,11 +327,11 @@ newTask.endTime = taskInfo.endTime

var compileTasks = function () {
var df = getDateFormat()
const compileTasks = function () {
const df = getDateFormat()
var compileTask = function (pos) {
var task = rawTasks[pos]
var startTime = ''
const compileTask = function (pos) {
const task = rawTasks[pos]
let startTime = ''
switch (rawTasks[pos].raw.startTime.type) {
case 'prevTaskEnd':
var prevTask = findTaskById(task.prevTaskId)
const prevTask = findTaskById(task.prevTaskId)
task.startTime = prevTask.endTime

@@ -360,5 +357,4 @@ break

var i
var allProcessed = true
for (i = 0; i < rawTasks.length; i++) {
let allProcessed = true
for (let i = 0; i < rawTasks.length; i++) {
compileTask(i)

@@ -365,0 +361,0 @@

@@ -14,3 +14,3 @@ /* eslint-env jasmine */

ganttDb.addTask('test1', 'id1,2013-01-01,2013-01-12')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -25,3 +25,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-12', 'YYYY-MM-DD').toDate())

ganttDb.addTask('test1', 'id1,2013-01-01,2d')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -36,3 +36,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-03', 'YYYY-MM-DD').toDate())

ganttDb.addTask('test1', 'id1,2013-01-01,2h')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -47,3 +47,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-01 2:00', 'YYYY-MM-DD hh:mm').toDate())

ganttDb.addTask('test1', 'id1,2013-01-01,2m')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -58,3 +58,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-01 00:02', 'YYYY-MM-DD hh:mm').toDate())

ganttDb.addTask('test1', 'id1,2013-01-01,2s')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -69,3 +69,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-01 00:00:02', 'YYYY-MM-DD hh:mm:ss').toDate())

ganttDb.addTask('test1', 'id1,2013-01-01,2w')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -83,3 +83,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())

var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()

@@ -96,3 +96,3 @@ expect(tasks[1].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())

ganttDb.addTask('test2', 'id2,after id3,1d')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[1].startTime).toEqual(new Date((new Date()).setHours(0, 0, 0, 0)))

@@ -107,3 +107,3 @@ expect(tasks[1].id).toEqual('id2')

ganttDb.addTask('test1', '2013-01-01,2013-01-12')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -119,3 +119,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-12', 'YYYY-MM-DD').toDate())

ganttDb.addTask('test1', '2013-01-01,4d')
var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2013-01-01', 'YYYY-MM-DD').toDate())

@@ -133,3 +133,3 @@ expect(tasks[0].endTime).toEqual(moment('2013-01-05', 'YYYY-MM-DD').toDate())

var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()

@@ -146,3 +146,3 @@ expect(tasks[1].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())

var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()

@@ -160,3 +160,3 @@ expect(tasks[1].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())

var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()

@@ -176,3 +176,3 @@ expect(tasks[1].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())

var tasks = ganttDb.getTasks()
const tasks = ganttDb.getTasks()

@@ -179,0 +179,0 @@ expect(tasks[1].startTime).toEqual(moment('2013-01-17', 'YYYY-MM-DD').toDate())

@@ -10,4 +10,4 @@

var daysInChart
var conf = {
let daysInChart
const conf = {
titleTopMargin: 25,

@@ -24,3 +24,3 @@ barHeight: 20,

export const setConf = function (cnf) {
var keys = Object.keys(cnf)
const keys = Object.keys(cnf)

@@ -31,3 +31,3 @@ keys.forEach(function (key) {

}
var w
let w
export const draw = function (text, id) {

@@ -37,3 +37,3 @@ parser.yy.clear()

var elem = document.getElementById(id)
const elem = document.getElementById(id)
w = elem.parentElement.offsetWidth

@@ -49,6 +49,6 @@

var taskArray = parser.yy.getTasks()
const taskArray = parser.yy.getTasks()
// Set height based on number of tasks
var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding
const h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding

@@ -58,8 +58,8 @@ elem.setAttribute('height', '100%')

elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h)
var svg = d3.select('#' + id)
const svg = d3.select('#' + id)
var startDate = d3.min(taskArray, function (d) {
const startDate = d3.min(taskArray, function (d) {
return d.startTime
})
var endDate = d3.max(taskArray, function (d) {
const endDate = d3.max(taskArray, function (d) {
return d.endTime

@@ -69,3 +69,3 @@ })

// Set timescale
var timeScale = d3.time.scale()
const timeScale = d3.time.scale()
.domain([d3.min(taskArray, function (d) {

@@ -79,11 +79,11 @@ return d.startTime

var categories = []
let categories = []
daysInChart = moment.duration(endDate - startDate).asDays()
for (var i = 0; i < taskArray.length; i++) {
for (let i = 0; i < taskArray.length; i++) {
categories.push(taskArray[i].type)
}
var catsUnfiltered = categories // for vert labels
const catsUnfiltered = categories // for vert labels

@@ -104,8 +104,8 @@ categories = checkUnique(categories)

function makeGant (tasks, pageWidth, pageHeight) {
var barHeight = conf.barHeight
var gap = barHeight + conf.barGap
var topPadding = conf.topPadding
var leftPadding = conf.leftPadding
const barHeight = conf.barHeight
const gap = barHeight + conf.barGap
const topPadding = conf.topPadding
const leftPadding = conf.leftPadding
var colorScale = d3.scale.linear()
const colorScale = d3.scale.linear()
.domain([0, categories.length])

@@ -136,3 +136,3 @@ .range(['#00B9FA', '#F95002'])

.attr('class', function (d) {
for (var i = 0; i < categories.length; i++) {
for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) {

@@ -145,3 +145,3 @@ return 'section section' + (i % conf.numberSectionStyles)

var rectangles = svg.append('g')
const rectangles = svg.append('g')
.selectAll('rect')

@@ -165,6 +165,6 @@ .data(theArray)

.attr('class', function (d) {
var res = 'task '
const res = 'task '
var secNum = 0
for (var i = 0; i < categories.length; i++) {
let secNum = 0
for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) {

@@ -204,5 +204,5 @@ secNum = (i % conf.numberSectionStyles)

.attr('x', function (d) {
var startX = timeScale(d.startTime)
var endX = timeScale(d.endTime)
var textWidth = this.getBBox().width
const startX = timeScale(d.startTime)
const endX = timeScale(d.endTime)
const textWidth = this.getBBox().width

@@ -225,7 +225,7 @@ // Check id text width > width of rectangle

.attr('class', function (d) {
var startX = timeScale(d.startTime)
var endX = timeScale(d.endTime)
var textWidth = this.getBBox().width
var secNum = 0
for (var i = 0; i < categories.length; i++) {
const startX = timeScale(d.startTime)
const endX = timeScale(d.endTime)
const textWidth = this.getBBox().width
let secNum = 0
for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) {

@@ -236,3 +236,3 @@ secNum = (i % conf.numberSectionStyles)

var taskType = ''
let taskType = ''
if (d.active) {

@@ -272,3 +272,3 @@ if (d.crit) {

function makeGrid (theSidePad, theTopPad, w, h) {
var pre = [
const pre = [
['.%L', function (d) {

@@ -284,3 +284,3 @@ return d.getMilliseconds()

}]]
var post = [
const post = [
['%Y', function () {

@@ -290,3 +290,3 @@ return true

var mid = [
let mid = [
// Within a day

@@ -309,7 +309,7 @@ ['%I:%M', function (d) {

]
var formatter
let formatter
if (typeof conf.axisFormatter !== 'undefined') {
mid = []
conf.axisFormatter.forEach(function (item) {
var n = []
const n = []
n[0] = item[0]

@@ -322,3 +322,3 @@ n[1] = item[1]

var xAxis = d3.svg.axis()
let xAxis = d3.svg.axis()
.scale(timeScale)

@@ -346,6 +346,6 @@ .orient('bottom')

function vertLabels (theGap, theTopPad) {
var numOccurances = []
var prevGap = 0
const numOccurances = []
let prevGap = 0
for (var i = 0; i < categories.length; i++) {
for (let i = 0; i < categories.length; i++) {
numOccurances[i] = [categories[i], getCount(categories[i], catsUnfiltered)]

@@ -365,3 +365,3 @@ }

if (i > 0) {
for (var j = 0; j < i; j++) {
for (let j = 0; j < i; j++) {
prevGap += numOccurances[i - 1][1]

@@ -375,3 +375,3 @@ return d[1] * theGap / 2 + prevGap * theGap + theTopPad

.attr('class', function (d) {
for (var i = 0; i < categories.length; i++) {
for (let i = 0; i < categories.length; i++) {
if (d[0] === categories[i]) {

@@ -386,6 +386,6 @@ return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles)

function drawToday (theSidePad, theTopPad, w, h) {
var todayG = svg.append('g')
const todayG = svg.append('g')
.attr('class', 'today')
var today = new Date()
const today = new Date()

@@ -402,5 +402,5 @@ todayG.append('line')

function checkUnique (arr) {
var hash = {}
var result = []
for (var i = 0, l = arr.length; i < l; ++i) {
const hash = {}
const result = []
for (let i = 0, l = arr.length; i < l; ++i) {
if (!hash.hasOwnProperty(arr[i])) { // it works with objects! in FF, at least

@@ -416,4 +416,4 @@ hash[arr[i]] = true

function getCounts (arr) {
var i = arr.length // var to loop over
var obj = {} // obj to store results
let i = arr.length // const to loop over
const obj = {} // obj to store results
while (i) {

@@ -420,0 +420,0 @@ obj[arr[--i]] = (obj[arr[i]] || 0) + 1 // count occurrences

@@ -5,8 +5,8 @@ import _ from 'lodash'

var commits = {}
var head = null
var branches = { 'master': head }
var curBranch = 'master'
var direction = 'LR'
var seq = 0
let commits = {}
let head = null
let branches = { 'master': head }
let curBranch = 'master'
let direction = 'LR'
let seq = 0

@@ -18,5 +18,5 @@ function getRandomInt (min, max) {

function getId () {
var pool = '0123456789abcdef'
var id = ''
for (var i = 0; i < 7; i++) {
const pool = '0123456789abcdef'
let id = ''
for (let i = 0; i < 7; i++) {
id += pool[getRandomInt(0, 16)]

@@ -45,4 +45,4 @@ }

function isReachableFrom (currentCommit, otherCommit) {
var currentSeq = currentCommit.seq
var otherSeq = otherCommit.seq
const currentSeq = currentCommit.seq
const otherSeq = otherCommit.seq
if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit)

@@ -55,3 +55,3 @@ return false

}
var options = {}
let options = {}
export const setOptions = function (rawOptString) {

@@ -73,3 +73,3 @@ logger.debug('options str', rawOptString)

export const commit = function (msg) {
var commit = {
const commit = {
id: getId(),

@@ -92,4 +92,4 @@ message: msg,

export const merge = function (otherBranch) {
var currentCommit = commits[branches[curBranch]]
var otherCommit = commits[branches[otherBranch]]
const currentCommit = commits[branches[curBranch]]
const otherCommit = commits[branches[otherBranch]]
if (isReachableFrom(currentCommit, otherCommit)) {

@@ -104,3 +104,3 @@ logger.debug('Already merged')

// create merge commit
var commit = {
const commit = {
id: getId(),

@@ -122,3 +122,3 @@ message: 'merged branch ' + otherBranch + ' into ' + curBranch,

curBranch = branch
var id = branches[curBranch]
const id = branches[curBranch]
head = commits[id]

@@ -129,5 +129,5 @@ }

logger.debug('in reset', commitRef)
var ref = commitRef.split(':')[0]
var parentCount = parseInt(commitRef.split(':')[1])
var commit = ref === 'HEAD' ? head : commits[branches[ref]]
const ref = commitRef.split(':')[0]
let parentCount = parseInt(commitRef.split(':')[1])
let commit = ref === 'HEAD' ? head : commits[branches[ref]]
logger.debug(commit, parentCount)

@@ -138,3 +138,3 @@ while (parentCount > 0) {

if (!commit) {
var err = 'Critical error - unique parent commit not found during reset'
const err = 'Critical error - unique parent commit not found during reset'
logger.error(err)

@@ -158,4 +158,4 @@ throw err

function prettyPrintCommitHistory (commitArr) {
var commit = _.maxBy(commitArr, 'seq')
var line = ''
const commit = _.maxBy(commitArr, 'seq')
let line = ''
commitArr.forEach(function (c) {

@@ -168,3 +168,3 @@ if (c === commit) {

})
var label = [line, commit.id, commit.seq]
const label = [line, commit.id, commit.seq]
_.each(branches, function (value, key) {

@@ -175,3 +175,3 @@ if (value === commit.id) label.push(key)

if (Array.isArray(commit.parent)) {
var newCommit = commits[commit.parent[0]]
const newCommit = commits[commit.parent[0]]
upsert(commitArr, commit, newCommit)

@@ -182,3 +182,3 @@ commitArr.push(commits[commit.parent[1]])

} else {
var nextCommit = commits[commit.parent]
const nextCommit = commits[commit.parent]
upsert(commitArr, commit, nextCommit)

@@ -192,3 +192,3 @@ }

logger.debug(commits)
var node = getCommitsArray()[0]
const node = getCommitsArray()[0]
prettyPrintCommitHistory([node])

@@ -215,3 +215,3 @@ }

export const getCommitsArray = function () {
var commitArr = Object.keys(commits).map(function (key) {
const commitArr = Object.keys(commits).map(function (key) {
return commits[key]

@@ -218,0 +218,0 @@ })

@@ -11,7 +11,7 @@ /* eslint-env jasmine */

it('should handle a gitGraph defintion', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n'
parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()

@@ -25,3 +25,3 @@ expect(Object.keys(commits).length).toBe(1)

it('should handle a gitGraph defintion with empty options', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'options\n' +

@@ -32,3 +32,3 @@ 'end\n' +

parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()

@@ -43,3 +43,3 @@ expect(parser.yy.getOptions()).toEqual({})

it('should handle a gitGraph defintion with valid options', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'options\n' +

@@ -51,3 +51,3 @@ '{"key": "value"}\n' +

parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(parser.yy.getOptions()['key']).toBe('value')

@@ -61,3 +61,3 @@ expect(Object.keys(commits).length).toBe(1)

it('should not fail on a gitGraph with malformed json', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'options\n' +

@@ -69,3 +69,3 @@ '{"key": "value"\n' +

parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(1)

@@ -78,7 +78,7 @@ expect(parser.yy.getCurrentBranch()).toBe('master')

it('should handle set direction', function () {
var str = 'gitGraph BT:\n' +
const str = 'gitGraph BT:\n' +
'commit\n'
parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()

@@ -92,3 +92,3 @@ expect(Object.keys(commits).length).toBe(1)

it('should checkout a branch', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'branch new\n' +

@@ -98,3 +98,3 @@ 'checkout new\n'

parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()

@@ -106,3 +106,3 @@ expect(Object.keys(commits).length).toBe(0)

it('should add commits to checked out branch', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'branch new\n' +

@@ -114,7 +114,7 @@ 'checkout new\n' +

parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(2)
expect(parser.yy.getCurrentBranch()).toBe('new')
var branchCommit = parser.yy.getBranches()['new']
const branchCommit = parser.yy.getBranches()['new']
expect(branchCommit).not.toBeNull()

@@ -124,10 +124,10 @@ expect(commits[branchCommit].parent).not.toBeNull()

it('should handle commit with args', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit "a commit"\n'
parser.parse(str)
var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(1)
var key = Object.keys(commits)[0]
const key = Object.keys(commits)[0]
expect(commits[key].message).toBe('a commit')

@@ -138,3 +138,3 @@ expect(parser.yy.getCurrentBranch()).toBe('master')

it('it should reset a branch', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -149,3 +149,3 @@ 'commit\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(3)

@@ -158,3 +158,3 @@ expect(parser.yy.getCurrentBranch()).toBe('newbranch')

it('reset can take an argument', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -169,6 +169,6 @@ 'commit\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(3)
expect(parser.yy.getCurrentBranch()).toBe('newbranch')
var master = commits[parser.yy.getBranches()['master']]
const master = commits[parser.yy.getBranches()['master']]
expect(parser.yy.getHead().id).toEqual(master.parent)

@@ -178,3 +178,3 @@ })

it('it should handle fast forwardable merges', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -190,3 +190,3 @@ 'branch newbranch\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(3)

@@ -199,3 +199,3 @@ expect(parser.yy.getCurrentBranch()).toBe('master')

it('it should handle cases when merge is a noop', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -210,3 +210,3 @@ 'branch newbranch\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(3)

@@ -219,3 +219,3 @@ expect(parser.yy.getCurrentBranch()).toBe('newbranch')

it('it should handle merge with 2 parents', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -232,3 +232,3 @@ 'branch newbranch\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(5)

@@ -241,3 +241,3 @@ expect(parser.yy.getCurrentBranch()).toBe('master')

it('it should handle ff merge when history walk has two parents (merge commit)', function () {
var str = 'gitGraph:\n' +
const str = 'gitGraph:\n' +
'commit\n' +

@@ -257,3 +257,3 @@ 'branch newbranch\n' +

var commits = parser.yy.getCommits()
const commits = parser.yy.getCommits()
expect(Object.keys(commits).length).toBe(6)

@@ -260,0 +260,0 @@ expect(parser.yy.getCurrentBranch()).toBe('newbranch')

@@ -8,5 +8,5 @@ import _ from 'lodash'

var allCommitsDict = {}
var branchNum
var config = {
let allCommitsDict = {}
let branchNum
let config = {
nodeSpacing: 150,

@@ -29,3 +29,3 @@ nodeFillColor: 'yellow',

}
var apiConfig = {}
let apiConfig = {}
export const setConf = function (c) {

@@ -58,4 +58,4 @@ apiConfig = c

interpolate = interpolate || 'basis'
var color = config.branchColors[colorIdx % config.branchColors.length]
var lineGen = d3.svg.line()
const color = config.branchColors[colorIdx % config.branchColors.length]
const lineGen = d3.svg.line()
.x(function (d) {

@@ -79,5 +79,5 @@ return Math.round(d.x)

coords = coords || element.node().getBBox()
var ctm = element.node().getCTM()
var xn = ctm.e + coords.x * ctm.a
var yn = ctm.f + coords.y * ctm.d
const ctm = element.node().getCTM()
const xn = ctm.e + coords.x * ctm.a
const yn = ctm.f + coords.y * ctm.d
return {

@@ -93,4 +93,4 @@ left: xn,

logger.debug('svgDrawLineForCommits: ', fromId, toId)
var fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'))
var toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'))
const fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'))
const toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'))
switch (direction) {

@@ -102,4 +102,4 @@ case 'LR':

if (fromBbox.left - toBbox.left > config.nodeSpacing) {
var lineStart = { x: fromBbox.left - config.nodeSpacing, y: toBbox.top + toBbox.height / 2 }
var lineEnd = { x: toBbox.left + toBbox.width, y: toBbox.top + toBbox.height / 2 }
const lineStart = { x: fromBbox.left - config.nodeSpacing, y: toBbox.top + toBbox.height / 2 }
const lineEnd = { x: toBbox.left + toBbox.width, y: toBbox.top + toBbox.height / 2 }
svgDrawLine(svg, [lineStart, lineEnd], color, 'linear')

@@ -133,4 +133,4 @@ svgDrawLine(svg, [

if (toBbox.top - fromBbox.top > config.nodeSpacing) {
lineStart = { x: toBbox.left + toBbox.width / 2, y: fromBbox.top + fromBbox.height + config.nodeSpacing }
lineEnd = { x: toBbox.left + toBbox.width / 2, y: toBbox.top }
const lineStart = { x: toBbox.left + toBbox.width / 2, y: fromBbox.top + fromBbox.height + config.nodeSpacing }
const lineEnd = { x: toBbox.left + toBbox.width / 2, y: toBbox.top }
svgDrawLine(svg, [lineStart, lineEnd], color, 'linear')

@@ -166,4 +166,4 @@ svgDrawLine(svg, [

function renderCommitHistory (svg, commitid, branches, direction) {
var commit
var numCommits = Object.keys(allCommitsDict).length
let commit
const numCommits = Object.keys(allCommitsDict).length
if (_.isString(commitid)) {

@@ -198,3 +198,3 @@ do {

var branch = _.find(branches, ['commit', commit])
const branch = _.find(branches, ['commit', commit])
if (branch) {

@@ -249,4 +249,3 @@ logger.debug('found branch ', branch.name)

try {
var parser
parser = gitGraphParser.parser
const parser = gitGraphParser.parser
parser.yy = db

@@ -260,5 +259,5 @@

logger.debug('effective options', config)
var direction = db.getDirection()
const direction = db.getDirection()
allCommitsDict = db.getCommits()
var branches = db.getBranchesAsObjArray()
const branches = db.getBranchesAsObjArray()
if (direction === 'BT') {

@@ -269,3 +268,3 @@ config.nodeLabel.x = branches.length * config.branchOffset

}
var svg = d3.select('#' + id)
const svg = d3.select('#' + id)
svgCreateDefs(svg)

@@ -272,0 +271,0 @@ branchNum = 1

import { logger } from '../../logger'
var actors = {}
var messages = []
var notes = []
var title = ''
let actors = {}
let messages = []
const notes = []
let title = ''
export const addActor = function (id, name, description) {
// Don't allow description nulling
var old = actors[id]
const old = actors[id]
if (old && name === old.name && description == null) return

@@ -84,6 +84,6 @@

export const addNote = function (actor, placement, message) {
var note = { actor: actor, placement: placement, message: message }
const note = { actor: actor, placement: placement, message: message }
// Coerce actor into a [to, from, ...] array
var actors = [].concat(actor, actor)
const actors = [].concat(actor, actor)

@@ -90,0 +90,0 @@ notes.push(note)

@@ -6,5 +6,5 @@ /* eslint-env jasmine */

var NewD3
let NewD3
var d3 = {
const d3 = {
select: function () {

@@ -18,3 +18,3 @@ return new NewD3()

var renderer = MyModuleInjector({
const renderer = MyModuleInjector({
'../../d3': d3

@@ -30,3 +30,2 @@ })

var str
describe('when parsing a sequenceDiagram', function () {

@@ -38,3 +37,3 @@ beforeEach(function () {

it('it should handle a sequenceDiagram defintion', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob:Hello Bob, how are you?\n' +

@@ -45,7 +44,7 @@ 'Note right of Bob: Bob thinks\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -57,3 +56,3 @@ expect(messages.length).toBe(3)

it('it should handle a sequenceDiagram definition with a title', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'title: Diagram Title\n' +

@@ -65,8 +64,8 @@ 'Alice->Bob:Hello Bob, how are you?\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
var title = parser.yy.getTitle()
const messages = parser.yy.getMessages()
const title = parser.yy.getTitle()

@@ -79,3 +78,3 @@ expect(messages.length).toBe(3)

it('it should space in actor names', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob:Hello Bob, how are - you?\n' +

@@ -85,7 +84,7 @@ 'Bob-->Alice: I am good thanks!'

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -97,3 +96,3 @@ expect(messages.length).toBe(2)

it('it should alias participants', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant A as Alice\n' +

@@ -106,3 +105,3 @@ 'participant B as Bob\n' +

var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(Object.keys(actors)).toEqual(['A', 'B'])

@@ -112,3 +111,3 @@ expect(actors.A.description).toBe('Alice')

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages.length).toBe(2)

@@ -119,11 +118,11 @@ expect(messages[0].from).toBe('A')

it('it should handle in async messages', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice-xBob:Hello Bob, how are you?'
parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -134,11 +133,11 @@ expect(messages.length).toBe(1)

it('it should handle in async dotted messages', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice--xBob:Hello Bob, how are you?'
parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -149,11 +148,11 @@ expect(messages.length).toBe(1)

it('it should handle in arrow messages', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->>Bob:Hello Bob, how are you?'
parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -164,11 +163,11 @@ expect(messages.length).toBe(1)

it('it should handle in arrow messages', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice-->>Bob:Hello Bob, how are you?'
parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -179,3 +178,3 @@ expect(messages.length).toBe(1)

it('it should handle actor activation', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice-->>Bob:Hello Bob, how are you?\n' +

@@ -187,7 +186,7 @@ 'activate Bob\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -203,3 +202,3 @@ expect(messages.length).toBe(4)

it('it should handle actor one line notation activation', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice-->>+Bob:Hello Bob, how are you?\n' +

@@ -209,7 +208,7 @@ 'Bob-->>- Alice:Hello Alice, I\'m fine and you?'

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -225,3 +224,3 @@ expect(messages.length).toBe(4)

it('it should handle stacked activations', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice-->>+Bob:Hello Bob, how are you?\n' +

@@ -233,7 +232,7 @@ 'Bob-->>+Carol:Carol, let me introduce Alice?\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
expect(actors.Bob.description).toBe('Bob')
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -253,3 +252,3 @@ expect(messages.length).toBe(8)

it('it should handle comments in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -261,7 +260,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -273,3 +272,3 @@ expect(messages.length).toBe(3)

it('it should handle new lines in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -281,7 +280,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -293,3 +292,3 @@ expect(messages.length).toBe(3)

it('it should handle semicolons', function () {
str = 'sequenceDiagram;' +
const str = 'sequenceDiagram;' +
'Alice->Bob: Hello Bob, how are you?;' +

@@ -300,7 +299,7 @@ 'Note right of Bob: Bob thinks;' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -312,3 +311,3 @@ expect(messages.length).toBe(3)

it('it should handle one leading space in lines in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
' Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -320,7 +319,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -332,3 +331,3 @@ expect(messages.length).toBe(3)

it('it should handle several leading spaces in lines in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
' Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -340,7 +339,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -352,3 +351,3 @@ expect(messages.length).toBe(3)

it('it should handle several leading spaces in lines in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice\n' +

@@ -366,7 +365,7 @@ 'participant Bob\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -378,3 +377,3 @@ expect(messages.length).toBe(8)

it('it should handle notes over a single actor', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -385,3 +384,3 @@ 'Note over Bob: Bob thinks\n'

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].from).toBe('Bob')

@@ -391,3 +390,3 @@ expect(messages[1].to).toBe('Bob')

it('it should handle notes over multiple actors', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -399,3 +398,3 @@ 'Note over Alice,Bob: confusion\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].from).toBe('Alice')

@@ -407,3 +406,3 @@ expect(messages[1].to).toBe('Bob')

it('it should handle loop statements a sequenceDiagram', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -417,7 +416,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -429,3 +428,3 @@ expect(messages.length).toBe(5)

it('it should handle opt statements a sequenceDiagram', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -439,7 +438,7 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()
expect(actors.Alice.description).toBe('Alice')
actors.Bob.description = 'Bob'
var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -451,3 +450,3 @@ expect(messages.length).toBe(5)

it('it should handle alt statements a sequenceDiagram', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -463,3 +462,3 @@ '%% Comment\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()

@@ -469,3 +468,3 @@ expect(actors.Alice.description).toBe('Alice')

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -477,3 +476,3 @@ expect(messages.length).toBe(7)

it('it should handle par statements a sequenceDiagram', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'par Parallel one\n' +

@@ -491,3 +490,3 @@ 'Alice->>Bob: Hello Bob, how are you?\n' +

parser.parse(str)
var actors = parser.yy.getActors()
const actors = parser.yy.getActors()

@@ -497,3 +496,3 @@ expect(actors.Alice.description).toBe('Alice')

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()

@@ -506,3 +505,3 @@ expect(messages.length).toBe(10)

it('it should handle special characters in signals', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: -:<>,;# comment'

@@ -512,7 +511,7 @@

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[0].message).toBe('-:<>,')
})
it('it should handle special characters in notes', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -523,7 +522,7 @@ 'Note right of Bob: -:<>,;# comment'

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('-:<>,')
})
it('it should handle special characters in loop', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -536,7 +535,7 @@ 'loop -:<>,;# comment\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('-:<>,')
})
it('it should handle special characters in opt', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -549,7 +548,7 @@ 'opt -:<>,;# comment\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('-:<>,')
})
it('it should handle special characters in alt', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -564,3 +563,3 @@ 'alt -:<>,;# comment\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('-:<>,')

@@ -570,3 +569,3 @@ expect(messages[3].message).toBe(',<>:-')

it('it should handle special characters in par', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -581,3 +580,3 @@ 'par -:<>,;# comment\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('-:<>,')

@@ -587,3 +586,3 @@ expect(messages[3].message).toBe(',<>:-')

it('it should handle no-label loop', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -596,3 +595,3 @@ 'loop\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('')

@@ -602,3 +601,3 @@ expect(messages[2].message).toBe('I am good thanks!')

it('it should handle no-label opt', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -611,3 +610,3 @@ 'opt # comment\n' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('')

@@ -617,3 +616,3 @@ expect(messages[2].message).toBe('I am good thanks!')

it('it should handle no-label alt', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -628,3 +627,3 @@ 'alt;' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('')

@@ -636,3 +635,3 @@ expect(messages[2].message).toBe('I am good thanks!')

it('it should handle no-label par', function () {
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -647,3 +646,3 @@ 'par;' +

var messages = parser.yy.getMessages()
const messages = parser.yy.getMessages()
expect(messages[1].message).toBe('')

@@ -657,3 +656,3 @@ expect(messages[2].message).toBe('I am good thanks!')

describe('when checking the bounds in a sequenceDiagram', function () {
var conf
let conf
beforeEach(function () {

@@ -681,3 +680,3 @@ parser.yy = sequenceDb

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(100)

@@ -694,3 +693,3 @@ expect(bounds.starty).toBe(100)

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(25)

@@ -708,3 +707,3 @@ expect(bounds.starty).toBe(50)

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(25)

@@ -723,3 +722,3 @@ expect(bounds.starty).toBe(50)

var loop = renderer.bounds.endLoop()
const loop = renderer.bounds.endLoop()

@@ -732,3 +731,3 @@ expect(loop.startx).toBe(125 - conf.boxMargin)

// Check bounds of first loop
var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()

@@ -750,3 +749,3 @@ expect(bounds.startx).toBe(25)

// Check bounds of first loop
var loop = renderer.bounds.endLoop()
let loop = renderer.bounds.endLoop()

@@ -767,3 +766,3 @@ expect(loop.startx).toBe(200 - conf.boxMargin)

// Check bounds of first loop
var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()

@@ -783,3 +782,3 @@ expect(bounds.startx).toBe(100)

var loop = renderer.bounds.endLoop()
const loop = renderer.bounds.endLoop()

@@ -792,3 +791,3 @@ expect(loop.startx).toBe(50 - conf.boxMargin)

// Check bounds after the loop
var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()

@@ -803,3 +802,3 @@ expect(bounds.startx).toBe(loop.startx)

describe('when rendering a sequenceDiagram', function () {
var conf
let conf
beforeEach(function () {

@@ -812,3 +811,3 @@ parser.yy = sequenceDb

NewD3 = function () {
var o = {
const o = {
append: function () {

@@ -860,3 +859,3 @@ return NewD3()

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice'

@@ -867,3 +866,3 @@

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -877,3 +876,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice\n' +

@@ -885,3 +884,3 @@ 'Note over Alice: Alice thinks\n'

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -895,3 +894,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice\n' +

@@ -903,3 +902,3 @@ 'Note left of Alice: Alice thinks'

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(-(conf.width / 2) - (conf.actorMargin / 2))

@@ -913,3 +912,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice\n' +

@@ -921,3 +920,3 @@ 'Note right of Alice: Alice thinks'

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -931,3 +930,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?'

@@ -938,3 +937,3 @@

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -947,3 +946,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -956,3 +955,3 @@ 'Note over Alice,Bob: Looks\n' +

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -965,3 +964,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -973,3 +972,3 @@ 'Bob->Alice: Fine!'

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -982,3 +981,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -991,7 +990,7 @@ 'Note right of Bob: Bob thinks\n' +

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)
expect(bounds.starty).toBe(0)
var expStopX = conf.actorMargin + conf.width + (conf.width / 2) + conf.noteMargin + conf.width
const expStopX = conf.actorMargin + conf.width + (conf.width / 2) + conf.noteMargin + conf.width

@@ -1003,3 +1002,3 @@ expect(bounds.stopx).toBe(expStopX)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -1012,3 +1011,3 @@ 'Note left of Alice: Bob thinks\n' +

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(-(conf.width / 2) - (conf.actorMargin / 2))

@@ -1022,3 +1021,3 @@ expect(bounds.starty).toBe(0)

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n' +

@@ -1031,3 +1030,3 @@ 'loop Cheers\n' +

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -1042,3 +1041,3 @@ expect(bounds.starty).toBe(0)

describe('when rendering a sequenceDiagram with actor mirror activated', function () {
var conf
let conf
beforeEach(function () {

@@ -1049,3 +1048,3 @@ parser.yy = sequenceDb

NewD3 = function () {
var o = {
const o = {
append: function () {

@@ -1101,3 +1100,3 @@ return NewD3()

renderer.bounds.init()
var str = 'sequenceDiagram\n' +
const str = 'sequenceDiagram\n' +
'participant Alice'

@@ -1108,3 +1107,3 @@

var bounds = renderer.bounds.getBounds()
const bounds = renderer.bounds.getBounds()
expect(bounds.startx).toBe(0)

@@ -1111,0 +1110,0 @@ expect(bounds.starty).toBe(0)

@@ -9,3 +9,3 @@ import svgDraw from './svgDraw'

var conf = {
const conf = {

@@ -69,4 +69,4 @@ diagramMarginX: 50,

updateBounds: function (startx, starty, stopx, stopy) {
var _self = this
var cnt = 0
const _self = this
let cnt = 0
function updateFn (type) {

@@ -76,3 +76,3 @@ return function updateItemBounds (item) {

// The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
var n = _self.sequenceItems.length - cnt + 1
const n = _self.sequenceItems.length - cnt + 1

@@ -99,9 +99,7 @@ _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min)

insert: function (startx, starty, stopx, stopy) {
var _startx, _starty, _stopx, _stopy
const _startx = Math.min(startx, stopx)
const _stopx = Math.max(startx, stopx)
const _starty = Math.min(starty, stopy)
const _stopy = Math.max(starty, stopy)
_startx = Math.min(startx, stopx)
_stopx = Math.max(startx, stopx)
_starty = Math.min(starty, stopy)
_stopy = Math.max(starty, stopy)
this.updateVal(bounds.data, 'startx', _startx, Math.min)

@@ -115,5 +113,5 @@ this.updateVal(bounds.data, 'starty', _starty, Math.min)

newActivation: function (message, diagram) {
var actorRect = parser.yy.getActors()[message.from.actor]
var stackedSize = actorActivations(message.from.actor).length
var x = actorRect.x + conf.width / 2 + (stackedSize - 1) * conf.activationWidth / 2
const actorRect = parser.yy.getActors()[message.from.actor]
const stackedSize = actorActivations(message.from.actor).length
const x = actorRect.x + conf.width / 2 + (stackedSize - 1) * conf.activationWidth / 2
this.activations.push({

@@ -130,6 +128,6 @@ startx: x,

// find most recent activation for given actor
var lastActorActivationIdx = this.activations
const lastActorActivationIdx = this.activations
.map(function (activation) { return activation.actor })
.lastIndexOf(message.from.actor)
var activation = this.activations.splice(lastActorActivationIdx, 1)[0]
const activation = this.activations.splice(lastActorActivationIdx, 1)[0]
return activation

@@ -141,7 +139,7 @@ },

endLoop: function () {
var loop = this.sequenceItems.pop()
const loop = this.sequenceItems.pop()
return loop
},
addSectionToLoop: function (message) {
var loop = this.sequenceItems.pop()
const loop = this.sequenceItems.pop()
loop.sections = loop.sections || []

@@ -171,4 +169,4 @@ loop.sectionTitles = loop.sectionTitles || []

*/
var drawNote = function (elem, startx, verticalPos, msg, forceWidth) {
var rect = svgDraw.getNoteRect()
const drawNote = function (elem, startx, verticalPos, msg, forceWidth) {
const rect = svgDraw.getNoteRect()
rect.x = startx

@@ -179,6 +177,6 @@ rect.y = verticalPos

var g = elem.append('g')
var rectElem = svgDraw.drawRect(g, rect)
let g = elem.append('g')
const rectElem = svgDraw.drawRect(g, rect)
var textObj = svgDraw.getTextObj()
const textObj = svgDraw.getTextObj()
textObj.x = startx - 4

@@ -191,5 +189,5 @@ textObj.y = verticalPos - 13

var textElem = svgDraw.drawText(g, textObj, rect.width - conf.noteMargin)
let textElem = svgDraw.drawText(g, textObj, rect.width - conf.noteMargin)
var textHeight = textElem[0][0].getBBox().height
let textHeight = textElem[0][0].getBBox().height
if (!forceWidth && textHeight > conf.width) {

@@ -220,7 +218,7 @@ textElem.remove()

*/
var drawMessage = function (elem, startx, stopx, verticalPos, msg) {
var g = elem.append('g')
var txtCenter = startx + (stopx - startx) / 2
const drawMessage = function (elem, startx, stopx, verticalPos, msg) {
const g = elem.append('g')
const txtCenter = startx + (stopx - startx) / 2
var textElem = g.append('text') // text label for the x axis
const textElem = g.append('text') // text label for the x axis
.attr('x', txtCenter)

@@ -232,4 +230,3 @@ .attr('y', verticalPos - 7)

var textWidth
let textWidth
if (typeof textElem[0][0].getBBox !== 'undefined') {

@@ -241,4 +238,3 @@ textWidth = textElem[0][0].getBBox().width

var line
let line
if (startx === stopx) {

@@ -250,3 +246,3 @@ line = g.append('path')

bounds.bumpVerticalPos(30)
var dx = Math.max(textWidth / 2, 100)
const dx = Math.max(textWidth / 2, 100)
bounds.insert(startx - dx, bounds.getVerticalPos() - 10, stopx + dx, bounds.getVerticalPos())

@@ -270,3 +266,3 @@ } else {

var url = ''
let url = ''
if (conf.arrowMarkerAbsolute) {

@@ -291,6 +287,5 @@ url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search

export const drawActors = function (diagram, actors, actorKeys, verticalPos) {
var i
// Draw the actors
for (i = 0; i < actorKeys.length; i++) {
var key = actorKeys[i]
for (let i = 0; i < actorKeys.length; i++) {
const key = actorKeys[i]

@@ -313,3 +308,3 @@ // Add some rendering data to the object

export const setConf = function (cnf) {
var keys = Object.keys(cnf)
const keys = Object.keys(cnf)

@@ -321,3 +316,3 @@ keys.forEach(function (key) {

var actorActivations = function (actor) {
const actorActivations = function (actor) {
return bounds.activations.filter(function (activation) {

@@ -328,9 +323,9 @@ return activation.actor === actor

var actorFlowVerticaBounds = function (actor) {
const actorFlowVerticaBounds = function (actor) {
// handle multiple stacked activations for same actor
var actors = parser.yy.getActors()
var activations = actorActivations(actor)
const actors = parser.yy.getActors()
const activations = actorActivations(actor)
var left = activations.reduce(function (acc, activation) { return Math.min(acc, activation.startx) }, actors[actor].x + conf.width / 2)
var right = activations.reduce(function (acc, activation) { return Math.max(acc, activation.stopx) }, actors[actor].x + conf.width / 2)
const left = activations.reduce(function (acc, activation) { return Math.min(acc, activation.startx) }, actors[actor].x + conf.width / 2)
const right = activations.reduce(function (acc, activation) { return Math.max(acc, activation.stopx) }, actors[actor].x + conf.width / 2)
return [left, right]

@@ -349,13 +344,13 @@ }

bounds.init()
var diagram = d3.select('#' + id)
const diagram = d3.select('#' + id)
var startx
var stopx
var forceWidth
let startx
let stopx
let forceWidth
// Fetch data from the parsing
var actors = parser.yy.getActors()
var actorKeys = parser.yy.getActorKeys()
var messages = parser.yy.getMessages()
var title = parser.yy.getTitle()
const actors = parser.yy.getActors()
const actorKeys = parser.yy.getActorKeys()
const messages = parser.yy.getMessages()
const title = parser.yy.getTitle()
drawActors(diagram, actors, actorKeys, 0)

@@ -368,3 +363,3 @@

function activeEnd (msg, verticalPos) {
var activationData = bounds.endActivation(msg)
const activationData = bounds.endActivation(msg)
if (activationData.starty + 18 > verticalPos) {

@@ -379,8 +374,7 @@ activationData.starty = verticalPos - 6

// var lastMsg
// const lastMsg
// Draw the messages/signals
messages.forEach(function (msg) {
var loopData
let loopData
switch (msg.type) {

@@ -470,12 +464,12 @@ case parser.yy.LINETYPE.NOTE:

bounds.bumpVerticalPos(conf.messageMargin)
var fromBounds = actorFlowVerticaBounds(msg.from)
var toBounds = actorFlowVerticaBounds(msg.to)
var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0
var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1
const fromBounds = actorFlowVerticaBounds(msg.from)
const toBounds = actorFlowVerticaBounds(msg.to)
const fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0
const toIdx = fromBounds[0] < toBounds[0] ? 0 : 1
startx = fromBounds[fromIdx]
stopx = toBounds[toIdx]
var verticalPos = bounds.getVerticalPos()
const verticalPos = bounds.getVerticalPos()
drawMessage(diagram, startx, stopx, verticalPos, msg)
var allBounds = fromBounds.concat(toBounds)
const allBounds = fromBounds.concat(toBounds)
bounds.insert(Math.min.apply(null, allBounds), verticalPos, Math.max.apply(null, allBounds), verticalPos)

@@ -494,11 +488,10 @@ } catch (e) {

var box = bounds.getBounds()
const box = bounds.getBounds()
// Adjust line height of actor lines now that the height of the diagram is known
logger.debug('For line height fix Querying: #' + id + ' .actor-line')
var actorLines = d3.selectAll('#' + id + ' .actor-line')
const actorLines = d3.selectAll('#' + id + ' .actor-line')
actorLines.attr('y2', box.stopy)
var height = box.stopy - box.starty + 2 * conf.diagramMarginY
let height = box.stopy - box.starty + 2 * conf.diagramMarginY
if (conf.mirrorActors) {

@@ -508,3 +501,3 @@ height = height - conf.boxMargin + conf.bottomMarginAdj

var width = (box.stopx - box.startx) + (2 * conf.diagramMarginX)
const width = (box.stopx - box.startx) + (2 * conf.diagramMarginX)

@@ -526,3 +519,3 @@ if (title) {

}
var extraVertForTitle = title ? 40 : 0
const extraVertForTitle = title ? 40 : 0
diagram.attr('viewBox', (box.startx - conf.diagramMarginX) + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle))

@@ -529,0 +522,0 @@ }

export const drawRect = function (elem, rectData) {
var rectElem = elem.append('rect')
const rectElem = elem.append('rect')
rectElem.attr('x', rectData.x)

@@ -21,5 +21,5 @@ rectElem.attr('y', rectData.y)

// Remove and ignore br:s
var nText = textData.text.replace(/<br\/?>/ig, ' ')
const nText = textData.text.replace(/<br\/?>/ig, ' ')
var textElem = elem.append('text')
const textElem = elem.append('text')
textElem.attr('x', textData.x)

@@ -33,3 +33,3 @@ textElem.attr('y', textData.y)

var span = textElem.append('tspan')
const span = textElem.append('tspan')
span.attr('x', textData.x + textData.textMargin * 2)

@@ -58,3 +58,3 @@ span.attr('fill', textData.fill)

}
var polygon = elem.append('polygon')
const polygon = elem.append('polygon')
polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7))

@@ -67,3 +67,3 @@ polygon.attr('class', 'labelBox')

}
var actorCnt = -1
let actorCnt = -1
/**

@@ -76,4 +76,4 @@ * Draws an actor in the diagram with the attaced line

export const drawActor = function (elem, left, verticalPos, description, conf) {
var center = left + (conf.width / 2)
var g = elem.append('g')
const center = left + (conf.width / 2)
const g = elem.append('g')
if (verticalPos === 0) {

@@ -92,3 +92,3 @@ actorCnt++

var rect = getNoteRect()
const rect = getNoteRect()
rect.x = left

@@ -118,4 +118,4 @@ rect.y = verticalPos

export const drawActivation = function (elem, bounds, verticalPos) {
var rect = getNoteRect()
var g = bounds.anchored
const rect = getNoteRect()
const g = bounds.anchored
rect.x = bounds.startx

@@ -136,4 +136,4 @@ rect.y = bounds.starty

export const drawLoop = function (elem, bounds, labelText, conf) {
var g = elem.append('g')
var drawLoopLine = function (startx, starty, stopx, stopy) {
const g = elem.append('g')
const drawLoopLine = function (startx, starty, stopx, stopy) {
return g.append('line')

@@ -156,3 +156,3 @@ .attr('x1', startx)

var txt = getTextObj()
let txt = getTextObj()
txt.text = labelText

@@ -204,4 +204,4 @@ txt.x = bounds.startx

export const insertArrowCrossHead = function (elem) {
var defs = elem.append('defs')
var marker = defs.append('marker')
const defs = elem.append('defs')
const marker = defs.append('marker')
.attr('id', 'crosshead')

@@ -233,3 +233,3 @@ .attr('markerWidth', 15)

export const getTextObj = function () {
var txt = {
const txt = {
x: 0,

@@ -250,3 +250,3 @@ y: 0,

export const getNoteRect = function () {
var rect = {
const rect = {
x: 0,

@@ -265,5 +265,5 @@ y: 0,

var _drawTextCandidateFunc = (function () {
const _drawTextCandidateFunc = (function () {
function byText (content, g, x, y, width, height, textAttrs) {
var text = g.append('text')
const text = g.append('text')
.attr('x', x + width / 2).attr('y', y + height / 2 + 5)

@@ -276,3 +276,3 @@ .style('text-anchor', 'middle')

function byTspan (content, g, x, y, width, height, textAttrs) {
var text = g.append('text')
const text = g.append('text')
.attr('x', x + width / 2).attr('y', y)

@@ -289,3 +289,3 @@ .style('text-anchor', 'middle')

// vertical aligment after d3textwrap expans tspan to multiple tspans
var tspans = text.selectAll('tspan')
let tspans = text.selectAll('tspan')
if (tspans.length > 0 && tspans[0].length > 0) {

@@ -303,8 +303,8 @@ tspans = tspans[0]

function byFo (content, g, x, y, width, height, textAttrs) {
var s = g.append('switch')
var f = s.append('foreignObject')
const s = g.append('switch')
const f = s.append('foreignObject')
.attr('x', x).attr('y', y)
.attr('width', width).attr('height', height)
var text = f.append('div').style('display', 'table')
const text = f.append('div').style('display', 'table')
.style('height', '100%').style('width', '100%')

@@ -321,3 +321,3 @@

function _setTextAttrs (toText, fromTextAttrsDict) {
for (var key in fromTextAttrsDict) {
for (const key in fromTextAttrsDict) {
if (fromTextAttrsDict.hasOwnProperty(key)) {

@@ -324,0 +324,0 @@ toText.attr(key, fromTextAttrsDict[key])

@@ -11,3 +11,3 @@ /**

var nextId = 0
let nextId = 0

@@ -35,6 +35,6 @@ /**

*/
var init = function () {
var conf = mermaidAPI.getConfig()
const init = function () {
const conf = mermaidAPI.getConfig()
logger.debug('Starting rendering diagrams')
var nodes
let nodes
if (arguments.length >= 2) {

@@ -52,3 +52,3 @@ /*! sequence config was passed as #1 */

// if last argument is a function this is the callback function
var callback
let callback
if (typeof arguments[arguments.length - 1] === 'function') {

@@ -85,13 +85,6 @@ callback = arguments[arguments.length - 1]

var txt
var insertSvg = function (svgCode, bindFunctions) {
element.innerHTML = svgCode
if (typeof callback !== 'undefined') {
callback(id)
}
bindFunctions(element)
}
let txt
for (var i = 0; i < nodes.length; i++) {
var element = nodes[i]
for (let i = 0; i < nodes.length; i++) {
const element = nodes[i]

@@ -105,3 +98,3 @@ /*! Check if previously processed */

var id = 'mermaidChart' + nextId++
const id = 'mermaidChart' + nextId++

@@ -114,3 +107,9 @@ // Fetch the graph definition including tags

mermaidAPI.render(id, txt, insertSvg, element)
mermaidAPI.render(id, txt, (svgCode, bindFunctions) => {
element.innerHTML = svgCode
if (typeof callback !== 'undefined') {
callback(id)
}
bindFunctions(element)
}, element)
}

@@ -142,3 +141,3 @@ }

const contentLoaded = function () {
var config
let config
// Check state of start config mermaid namespace

@@ -145,0 +144,0 @@ if (typeof global.mermaid_config !== 'undefined') {

@@ -62,5 +62,5 @@ /* eslint-env jasmine */

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -80,5 +80,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -97,5 +97,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -114,5 +114,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -131,5 +131,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -148,5 +148,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -167,5 +167,5 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
const edges = flowParser.parser.yy.getEdges()
var mockG = {
const mockG = {
setEdge: function (start, end, options) {

@@ -185,4 +185,4 @@ expect(start).toBe('A')

flowParser.parser.yy.getVertices()
var edges = flowParser.parser.yy.getEdges()
var mockG = {
const edges = flowParser.parser.yy.getEdges()
const mockG = {
setEdge: function (start, end, options) {

@@ -213,3 +213,3 @@ expect(start).toBe('A')

it('it should not throw for a valid sequenceDiagram definition', function () {
var text = 'sequenceDiagram\n' +
const text = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n\n' +

@@ -227,3 +227,3 @@ '%% Comment\n' +

it('it should throw for an invalid sequenceDiagram definition', function () {
var text = 'sequenceDiagram\n' +
const text = 'sequenceDiagram\n' +
'Alice:->Bob: Hello Bob, how are you?\n\n' +

@@ -230,0 +230,0 @@ '%% Comment\n' +

@@ -61,3 +61,3 @@ /**

*/
var config = {
const config = {
theme: defaultTheme,

@@ -255,4 +255,4 @@

function parse (text) {
var graphType = utils.detectType(text)
var parser
const graphType = utils.detectType(text)
let parser

@@ -308,10 +308,10 @@ switch (graphType) {

export const encodeEntities = function (text) {
var txt = text
let txt = text
txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
var innerTxt = s.substring(0, s.length - 1)
const innerTxt = s.substring(0, s.length - 1)
return innerTxt
})
txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
var innerTxt = s.substring(0, s.length - 1)
const innerTxt = s.substring(0, s.length - 1)
return innerTxt

@@ -321,5 +321,5 @@ })

txt = txt.replace(/#\w+;/g, function (s) {
var innerTxt = s.substring(1, s.length - 1)
const innerTxt = s.substring(1, s.length - 1)
var isInt = /^\+?\d+$/.test(innerTxt)
const isInt = /^\+?\d+$/.test(innerTxt)
if (isInt) {

@@ -336,3 +336,3 @@ return 'fl°°' + innerTxt + '¶ß'

export const decodeEntities = function (text) {
var txt = text
let txt = text

@@ -360,4 +360,4 @@ txt = txt.replace(/fl°°/g, function () {

* $(function(){
* var graphDefinition = 'graph TB\na-->b';
* var cb = function(svgGraph){
* const graphDefinition = 'graph TB\na-->b';
* const cb = function(svgGraph){
* console.log(svgGraph);

@@ -375,3 +375,3 @@ * };

*/
var render = function (id, txt, cb, container) {
const render = function (id, txt, cb, container) {
if (typeof container !== 'undefined') {

@@ -405,4 +405,4 @@ container.innerHTML = ''

var element = d3.select('#d' + id).node()
var graphType = utils.detectType(txt)
const element = d3.select('#d' + id).node()
const graphType = utils.detectType(txt)
switch (graphType) {

@@ -460,3 +460,3 @@ case 'gitGraph':

var url = ''
let url = ''
if (config.arrowMarkerAbsolute) {

@@ -469,3 +469,3 @@ url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search

// Fix for when the base tag is used
var svgCode = d3.select('#d' + id).node().innerHTML.replace(/url\(#arrowhead/g, 'url(' + url + '#arrowhead', 'g')
let svgCode = d3.select('#d' + id).node().innerHTML.replace(/url\(#arrowhead/g, 'url(' + url + '#arrowhead', 'g')

@@ -480,3 +480,3 @@ svgCode = decodeEntities(svgCode)

var node = d3.select('#d' + id).node()
const node = d3.select('#d' + id).node()
if (node !== null && typeof node.remove === 'function') {

@@ -507,12 +507,10 @@ d3.select('#d' + id).node().remove()

var setConf = function (cnf) {
const setConf = function (cnf) {
// Top level initially mermaid, gflow, sequenceDiagram and gantt
var lvl1Keys = Object.keys(cnf)
var i
for (i = 0; i < lvl1Keys.length; i++) {
const lvl1Keys = Object.keys(cnf)
for (let i = 0; i < lvl1Keys.length; i++) {
if (typeof cnf[lvl1Keys[i]] === 'object') {
var lvl2Keys = Object.keys(cnf[lvl1Keys[i]])
const lvl2Keys = Object.keys(cnf[lvl1Keys[i]])
var j
for (j = 0; j < lvl2Keys.length; j++) {
for (let j = 0; j < lvl2Keys.length; j++) {
logger.debug('Setting conf ', lvl1Keys[i], '-', lvl2Keys[j])

@@ -519,0 +517,0 @@ if (typeof config[lvl1Keys[i]] === 'undefined') {

@@ -12,7 +12,7 @@ /* eslint-env jasmine */

it('should copy a literal into the configuration', function () {
var orgConfig = mermaidAPI.getConfig()
const orgConfig = mermaidAPI.getConfig()
expect(orgConfig.testLiteral).toBe(undefined)
mermaidAPI.initialize({ 'testLiteral': true })
var config = mermaidAPI.getConfig()
const config = mermaidAPI.getConfig()

@@ -22,6 +22,6 @@ expect(config.testLiteral).toBe(true)

it('should copy a an object into the configuration', function () {
var orgConfig = mermaidAPI.getConfig()
const orgConfig = mermaidAPI.getConfig()
expect(orgConfig.testObject).toBe(undefined)
var object = {
const object = {
test1: 1,

@@ -33,3 +33,3 @@ test2: false

mermaidAPI.initialize({ 'testObject': { 'test3': true } })
var config = mermaidAPI.getConfig()
const config = mermaidAPI.getConfig()

@@ -36,0 +36,0 @@ expect(config.testObject.test1).toBe(1)

@@ -5,13 +5,10 @@ /* eslint-env jasmine */

describe('when detecting chart type ', function () {
var str
it('should handle a graph defintion', function () {
str = 'graph TB\nbfs1:queue'
var type = utils.detectType(str)
const str = 'graph TB\nbfs1:queue'
const type = utils.detectType(str)
expect(type).toBe('graph')
})
it('should handle a graph defintion with leading spaces', function () {
str = ' graph TB\nbfs1:queue'
var type = utils.detectType(str)
const str = ' graph TB\nbfs1:queue'
const type = utils.detectType(str)
expect(type).toBe('graph')

@@ -21,11 +18,9 @@ })

it('should handle a graph defintion with leading spaces and newline', function () {
str = ' \n graph TB\nbfs1:queue'
var type = utils.detectType(str)
const str = ' \n graph TB\nbfs1:queue'
const type = utils.detectType(str)
expect(type).toBe('graph')
})
it('should handle a graph defintion for gitGraph', function () {
str = ' \n gitGraph TB:\nbfs1:queue'
var type = utils.detectType(str)
const str = ' \n gitGraph TB:\nbfs1:queue'
const type = utils.detectType(str)
expect(type).toBe('gitGraph')

@@ -37,11 +32,11 @@ })

it('should return the array index that contains the substring', function () {
var arr = ['stroke:val1', 'fill:val2']
var result = utils.isSubstringInArray('fill', arr)
const arr = ['stroke:val1', 'fill:val2']
const result = utils.isSubstringInArray('fill', arr)
expect(result).toEqual(1)
})
it('should return -1 if the substring is not found in the array', function () {
var arr = ['stroke:val1', 'stroke-width:val2']
var result = utils.isSubstringInArray('fill', arr)
const arr = ['stroke:val1', 'stroke-width:val2']
const result = utils.isSubstringInArray('fill', arr)
expect(result).toEqual(-1)
})
})

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc