Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ddiidev committed Oct 2, 2024
1 parent 6e77009 commit 5c528a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function main() {

function runCode() {
try {
const code = JsonToStruct(editorJson.getValue())
const code = jsonToStruct(editorJson.getValue())

if (code === null)
return;
Expand Down Expand Up @@ -76,9 +76,9 @@ function pushAfterImplementationType(type) {
/**
* @description Add a new type to the list of types to be implemented and convert the json to struct
*/
function JsonToStruct(js, type_obj = undefined) {
function jsonToStruct(js, type_obj = undefined) {
afterImplementationTypes = [];
let code = ConstructStrucFromJson(js, type_obj).code;
let code = constructStrucFromJson(js, type_obj).code;

if (code === null)
return null;
Expand All @@ -105,7 +105,7 @@ function JsonToStruct(js, type_obj = undefined) {
* @param {{nameType: string, view: string, nameObj: string} | undefined} hiritageObj
* @returns {{code: string, afterImplementation: string}}
*/
function ConstructStrucFromJson(js, hiritageObj = undefined) {
function constructStrucFromJson(js, hiritageObj = undefined) {


const json = (() => {
Expand All @@ -132,7 +132,7 @@ function ConstructStrucFromJson(js, hiritageObj = undefined) {

if (isInsideNestedArray(hiritageObj) && currentTypeIsObject(currentType)) {
/* into nested array */
const contentTree = ConstructStrucFromJson(json[keys[key]],
const contentTree = constructStrucFromJson(json[keys[key]],
{
...currentType,
nameObj: hiritageObj
Expand All @@ -156,7 +156,7 @@ function ConstructStrucFromJson(js, hiritageObj = undefined) {

} else if (currentTypeIsArray(currentType)) {
/* Get element by element of array */
let contentTree = ConstructStrucFromJson(json[keys[key]],
let contentTree = constructStrucFromJson(json[keys[key]],
{
...currentType,
nameObj: !Array.isArray(json) ? keys[key] : undefined
Expand All @@ -173,7 +173,7 @@ function ConstructStrucFromJson(js, hiritageObj = undefined) {
/**
* Object or Array of key nested
*/
let contentTree = ConstructStrucFromJson(json[keys[key]],
let contentTree = constructStrucFromJson(json[keys[key]],
{
...currentType,
nameObj: !Array.isArray(json) ? keys[key] : undefined
Expand Down
1 change: 1 addition & 0 deletions types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var RESERVED_WORDS = [
'union',
'type',
'enum',
'implements',


'for',
Expand Down

0 comments on commit 5c528a5

Please sign in to comment.