Skip to content

Commit

Permalink
docs ~ show local and remote deno examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Dec 26, 2020
1 parent 66b0b2f commit 07cafd1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions eg/show-paths.local.deno.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// # spell-checker:ignore APPNAME Deno
/* eslint-env es6, deno */
'use strict';

/// <reference path="../types/deno.d.ts"/>

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import osPaths from '../src/mod.deno.ts';
// import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@c8e003b4fcb75c83a81c8229a7a78f89345e281b/src/index.deno.ts';

// create a local reference to refer to `Deno` (for better linting without need for multiple `// @ts-ignore` directives)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const deno = Deno;

console.log({ osPaths });

Object.keys(osPaths).forEach((key) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value = (osPaths as any)[key]();
console.log({ key, value });
});

deno.env.set('TEMP', 'temp');
deno.env.set('TMPDIR', 'tmpdir');
deno.env.set('TMP', 'tmp');
Object.keys(osPaths).forEach((key) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value = (osPaths as any)[key]();
console.log({ key, value });
});

deno.env.set('TEMP', 'NEW');
Object.keys(osPaths).forEach((key) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value = (osPaths as any)[key]();
console.log({ key, value });
});
File renamed without changes.

0 comments on commit 07cafd1

Please sign in to comment.