diff --git a/examples/hello.ts b/examples/hello.ts new file mode 100644 index 0000000..f7566af --- /dev/null +++ b/examples/hello.ts @@ -0,0 +1,6 @@ +// Library exporting `sayHello` function + +const capitalize = (word: string) => + `${word.charAt(0).toUpperCase()}${word.toLowerCase().slice(1)}`; + +export const sayHello = (name: string) => `Hello ${capitalize(name)}`; diff --git a/examples/import.ts b/examples/import.ts new file mode 100644 index 0000000..d44cd89 --- /dev/null +++ b/examples/import.ts @@ -0,0 +1,7 @@ +// Import as ES modules + +import { sayHello } from "./hello.ts"; + +const name = Deno.args[0]; + +console.log(sayHello(name)); diff --git a/examples/test.ts b/examples/test.ts new file mode 100644 index 0000000..259cfb3 --- /dev/null +++ b/examples/test.ts @@ -0,0 +1,11 @@ +// Run using deno test + +import { assert } from "https://deno.land/std@0.87.0/testing/asserts.ts"; + +Deno.test("Hello test", () => { + assert("Hello"); +}); + +Deno.test("Hello test", () => { + assert(false); +});