Skip to content

Commit

Permalink
Rename properties to fields
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Jun 16, 2023
1 parent c579bf0 commit 9fbb129
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export function buildJsx(tree, options) {
/** @type {MemberExpression | Literal | Identifier} */
let name
/** @type {Array<Property | SpreadElement>} */
const properties = []
const fields = []
/** @type {Array<Expression>} */
let parameters = []
/** @type {Expression | undefined} */
Expand Down Expand Up @@ -314,9 +314,9 @@ export function buildJsx(tree, options) {
if (attribute.type === 'JSXSpreadAttribute') {
const {argument} = attribute
if (argument.type === 'ObjectExpression') {
properties.push(...argument.properties)
fields.push(...argument.properties)
} else {
properties.push({
fields.push({
type: 'SpreadElement',
argument
})
Expand All @@ -341,7 +341,7 @@ export function buildJsx(tree, options) {
// attribute values? 🤷‍♂️
key = prop.value
} else {
properties.push(prop)
fields.push(prop)
}
}
}
Expand All @@ -358,7 +358,7 @@ export function buildJsx(tree, options) {

if (automatic) {
if (children.length > 0) {
properties.push({
fields.push({
type: 'Property',
key: {type: 'Identifier', name: 'children'},
value:
Expand All @@ -379,7 +379,7 @@ export function buildJsx(tree, options) {
let callee

if (automatic) {
parameters.push({type: 'ObjectExpression', properties})
parameters.push({type: 'ObjectExpression', properties: fields})

if (key) {
parameters.push(key)
Expand Down Expand Up @@ -450,8 +450,8 @@ export function buildJsx(tree, options) {
}
// Classic.
else {
if (properties.length > 0) {
parameters.unshift({type: 'ObjectExpression', properties})
if (fields.length > 0) {
parameters.unshift({type: 'ObjectExpression', properties: fields})
} else if (parameters.length > 0) {
parameters.unshift({type: 'Literal', value: null})
}
Expand Down

0 comments on commit 9fbb129

Please sign in to comment.