Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 22, 2024
1 parent 95ffea6 commit 5b2042a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,17 @@ function extractObjectProperties(lines: string[]): PropertyInfo[] {
}

function inferType(value: string): string {
if (value.startsWith('"') || value.startsWith('\''))
return value.replace(/^['"]|['"]$/g, '')
// Handle string literals - keep the quotes
if (value.startsWith('"') || value.startsWith('\'')) {
// Ensure consistent quote style (using single quotes)
const cleanValue = value.trim().replace(/^["']|["']$/g, '')
return `'${cleanValue}'`
}

if (value === 'true' || value === 'false')
return value

if (!isNaN(Number(value)))
if (!Number.isNaN(Number(value)))
return value

if (value.includes('=>') || value.includes('function'))
Expand Down

0 comments on commit 5b2042a

Please sign in to comment.