To build composable programs, it is necessary to be able to import and export functions from other modules. This is accomplished by using ECMA script modules in Deno.
./util.ts
export function sayHello(thing: string) {
console.log(`Hello, ${thing}!`);
}./util.ts
export interface Foo {}
export class Bar {}
export const baz = "baz";./main.ts
import { sayHello } from "./util.ts";
sayHello("World");./main.ts
import * as util from "./util.ts";
util.sayHello("World");./main.ts
import { camelCase } from "jsr:@luca/cases@1";
console.log(camelCase("hello world")); // helloWorld
import OpenAI from "jsr:@openai/openai";
const client = new OpenAI();