fluent-transpiler
Advanced tools
Comparing version
13
index.js
@@ -71,4 +71,11 @@ import { parse } from '@fluent/syntax' | ||
const types = { | ||
Identifier: (data) => { | ||
const value = variableNotation[options.variableNotation](data.name) | ||
Identifier: (data, parent) => { | ||
const value = | ||
parent === 'Attribute' | ||
? data.name | ||
: variableNotation[options.variableNotation](data.name) | ||
if (value.includes('-')) { | ||
return `'${value}'` | ||
} | ||
// Check for reserved words - TODO add in rest | ||
@@ -81,3 +88,3 @@ if (['const', 'default', 'enum', 'if'].includes(value)) { | ||
Attribute: (data) => { | ||
const key = compileType(data.id) | ||
const key = compileType(data.id, data.type) | ||
const value = compileType(data.value, data.type) | ||
@@ -84,0 +91,0 @@ return ` ${key}: ${value}` |
{ | ||
"name": "fluent-transpiler", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Transpile Fluent (ftl) files into optimized, tree-shakable, JavaScript EcmaScript Modules (esm).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
21839
0.71%487
1.25%