diff --git a/.vscode/settings.json b/.vscode/settings.json index 43df84f..f8c2e42 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "deno.enable": true + "deno.enable": true, + "editor.formatOnSave": false } diff --git a/development/typescript/source/greet.ts b/development/typescript/source/greet.ts index 9f40b0e..7205a06 100644 --- a/development/typescript/source/greet.ts +++ b/development/typescript/source/greet.ts @@ -1,3 +1,5 @@ +export const HELLO: string = "Hello" + export const greet = (name: string) => { - console.log(`Hello ${name}!`) + console.log(`${HELLO} ${name}!`) } diff --git a/development/typescript/typescript-embed.ts b/development/typescript/typescript-embed.ts index 34c998f..93c31ee 100644 --- a/development/typescript/typescript-embed.ts +++ b/development/typescript/typescript-embed.ts @@ -10,11 +10,14 @@ const TypescriptFrogasaurus: any = {} //====== ./greet.ts ====== { TypescriptFrogasaurus["./greet.ts"] = {} + const HELLO: string = "Hello" + const greet = (name: string) => { - console.log(`Hello ${name}!`) + console.log(`${HELLO} ${name}!`) } + TypescriptFrogasaurus["./greet.ts"].HELLO = HELLO TypescriptFrogasaurus["./greet.ts"].greet = greet } @@ -37,6 +40,7 @@ const TypescriptFrogasaurus: any = {} // EXPORTS // //=========// const Typescript = { + HELLO: TypescriptFrogasaurus["./greet.ts"].HELLO, greet: TypescriptFrogasaurus["./greet.ts"].greet, main: TypescriptFrogasaurus["./main.ts"].main, } \ No newline at end of file diff --git a/development/typescript/typescript-import.ts b/development/typescript/typescript-import.ts index 6413b16..c3298a2 100644 --- a/development/typescript/typescript-import.ts +++ b/development/typescript/typescript-import.ts @@ -10,11 +10,14 @@ const TypescriptFrogasaurus: any = {} //====== ./greet.ts ====== { TypescriptFrogasaurus["./greet.ts"] = {} + const HELLO: string = "Hello" + const greet = (name: string) => { - console.log(`Hello ${name}!`) + console.log(`${HELLO} ${name}!`) } + TypescriptFrogasaurus["./greet.ts"].HELLO = HELLO TypescriptFrogasaurus["./greet.ts"].greet = greet } @@ -36,10 +39,11 @@ const TypescriptFrogasaurus: any = {} //=========// // EXPORTS // //=========// -export const { greet } = TypescriptFrogasaurus["./greet.ts"] +export const { HELLO, greet } = TypescriptFrogasaurus["./greet.ts"] export const { main } = TypescriptFrogasaurus["./main.ts"] export const Typescript = { + HELLO: TypescriptFrogasaurus["./greet.ts"].HELLO, greet: TypescriptFrogasaurus["./greet.ts"].greet, main: TypescriptFrogasaurus["./main.ts"].main, } \ No newline at end of file diff --git a/development/typescript/typescript-standalone.ts b/development/typescript/typescript-standalone.ts index ac04999..377d026 100644 --- a/development/typescript/typescript-standalone.ts +++ b/development/typescript/typescript-standalone.ts @@ -10,11 +10,14 @@ const TypescriptFrogasaurus: any = {} //====== ./greet.ts ====== { TypescriptFrogasaurus["./greet.ts"] = {} + const HELLO: string = "Hello" + const greet = (name: string) => { - console.log(`Hello ${name}!`) + console.log(`${HELLO} ${name}!`) } + TypescriptFrogasaurus["./greet.ts"].HELLO = HELLO TypescriptFrogasaurus["./greet.ts"].greet = greet } diff --git a/frogasaurus.js b/frogasaurus.js index 54cb9f7..dff6a40 100644 --- a/frogasaurus.js +++ b/frogasaurus.js @@ -314,7 +314,7 @@ const FrogasaurusFrogasaurus = {} const getConstName = (line) => { for (let i = "const ".length; i < line.length; i++) { const char = line[i] - if (char === " " || char === " " || char === "=") { + if (char === " " || char === " " || char === "=" || char === ":") { return line.slice("const ".length, i) } } diff --git a/source/parse.js b/source/parse.js index d954e71..ddbb206 100644 --- a/source/parse.js +++ b/source/parse.js @@ -3,7 +3,7 @@ import { trimStart } from "./string.js" export const getConstName = (line) => { for (let i = "const ".length; i < line.length; i++) { const char = line[i] - if (char === " " || char === " " || char === "=") { + if (char === " " || char === " " || char === "=" || char === ":") { return line.slice("const ".length, i) } }