0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

docs: env.get will return undefined if not exist (#10514)

This commit is contained in:
迷渡 2021-05-06 17:45:36 +08:00 committed by GitHub
parent a9c58d5e51
commit 7e22987876
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -177,12 +177,12 @@ declare namespace Deno {
export function exit(code?: number): never;
export const env: {
/** Retrieve the value of an environment variable. Returns undefined if that
/** Retrieve the value of an environment variable. Returns `undefined` if that
* key doesn't exist.
*
* ```ts
* console.log(Deno.env.get("HOME")); // e.g. outputs "/home/alice"
* console.log(Deno.env.get("MADE_UP_VAR")); // outputs "Undefined"
* console.log(Deno.env.get("MADE_UP_VAR")); // outputs "undefined"
* ```
* Requires `allow-env` permission. */
get(key: string): string | undefined;
@ -201,7 +201,7 @@ declare namespace Deno {
*
* ```ts
* Deno.env.set("SOME_VAR", "Value");
* Deno.env.delete("SOME_VAR"); // outputs "Undefined"
* Deno.env.delete("SOME_VAR"); // outputs "undefined"
* ```
*
* Requires `allow-env` permission. */