add jsdoc

This commit is contained in:
Ruidy 2021-02-19 09:06:55 +01:00
parent 36e2d0d9a6
commit ff9b368f1e
3 changed files with 14 additions and 2 deletions

View file

@ -10,5 +10,6 @@ const listener = Deno.listen({ hostname, port });
console.log(`Listen on ${hostname}:${port}`);
for await (const conn of listener) {
console.log("Connection initiated");
Deno.copy(conn, conn);
}

View file

@ -1,6 +1,16 @@
// Library exporting `sayHello` function
const capitalize = (word: string) =>
/**
* Title case the given word. First character uppercase and the rest lowercase.
* @param {string} word
* @returns {string} Capitalized word.
*/
const capitalize = (word: string): string =>
`${word.charAt(0).toUpperCase()}${word.toLowerCase().slice(1)}`;
export const sayHello = (name: string) => `Hello ${capitalize(name)}`;
/**
* Greets the named user after name capitalization
* @param {string} name
* @returns {string} Greeting to the user
*/
export const sayHello = (name: string): string => `Hello ${capitalize(name)}`;

View file

@ -3,6 +3,7 @@ import { serve } from "https://deno.land/std@0.87.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello, World\n" });
}