edge.js
Advanced tools
Comparing version 5.2.2 to 5.3.0
@@ -10,2 +10,3 @@ import { Parser } from 'edge-parser'; | ||
private obj; | ||
addSpread(key: string): void; | ||
/** | ||
@@ -12,0 +13,0 @@ * Add key/value pair to the object. |
@@ -22,2 +22,5 @@ "use strict"; | ||
} | ||
addSpread(key) { | ||
this.obj += this.obj.length ? `, ${key}` : `${key}`; | ||
} | ||
/** | ||
@@ -72,5 +75,10 @@ * Add key/value pair to the object. | ||
arg.properties.forEach((prop) => { | ||
const key = parser.utils.stringify(prop.key); | ||
const value = parser.utils.stringify(prop.value); | ||
objectifyString.add(key, value, prop.computed); | ||
if (prop.type === 'SpreadElement') { | ||
objectifyString.addSpread(parser.utils.stringify(prop)); | ||
} | ||
else { | ||
const key = parser.utils.stringify(prop.key); | ||
const value = parser.utils.stringify(prop.value); | ||
objectifyString.add(key, value, prop.computed); | ||
} | ||
}); | ||
@@ -77,0 +85,0 @@ } |
@@ -55,6 +55,15 @@ "use strict"; | ||
if (expression.type === edge_parser_1.expressions.SequenceExpression) { | ||
return [ | ||
parser.utils.stringify(name), | ||
StringifiedObject_1.StringifiedObject.fromAcornExpressions(expression.expressions, parser), | ||
]; | ||
/** | ||
* We only need to entertain the first expression of the sequence | ||
* expression, as components allows a max of two arguments | ||
*/ | ||
const firstSequenceExpression = expression.expressions[0]; | ||
if (firstSequenceExpression && | ||
[edge_parser_1.expressions.ObjectExpression, edge_parser_1.expressions.AssignmentExpression].includes(firstSequenceExpression.type)) { | ||
return [ | ||
parser.utils.stringify(name), | ||
StringifiedObject_1.StringifiedObject.fromAcornExpressions([firstSequenceExpression], parser), | ||
]; | ||
} | ||
return [parser.utils.stringify(name), parser.utils.stringify(firstSequenceExpression)]; | ||
} | ||
@@ -61,0 +70,0 @@ /** |
{ | ||
"name": "edge.js", | ||
"version": "5.2.2", | ||
"version": "5.3.0", | ||
"description": "Template engine", | ||
@@ -38,19 +38,19 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@adonisjs/mrm-preset": "^4.1.0", | ||
"@adonisjs/require-ts": "^2.0.4", | ||
"@adonisjs/mrm-preset": "^4.1.1", | ||
"@adonisjs/require-ts": "^2.0.6", | ||
"@poppinss/dev-utils": "^1.1.4", | ||
"@types/node": "^15.6.1", | ||
"@types/node": "^16.3.2", | ||
"dedent-js": "^1.0.1", | ||
"del-cli": "^3.0.1", | ||
"doctoc": "^2.0.0", | ||
"eslint": "^7.27.0", | ||
"del-cli": "^4.0.0", | ||
"doctoc": "^2.0.1", | ||
"eslint": "^7.30.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-adonis": "^1.3.1", | ||
"eslint-plugin-adonis": "^1.3.2", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"github-label-sync": "^2.0.0", | ||
"husky": "^6.0.0", | ||
"github-label-sync": "^2.0.1", | ||
"husky": "^7.0.1", | ||
"japa": "^3.1.1", | ||
"mrm": "^3.0.2", | ||
"np": "^7.5.0", | ||
"prettier": "^2.3.0", | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.4.0-dev.20210515" | ||
@@ -57,0 +57,0 @@ }, |
140165
4090