-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-env es6, deno */ | ||
// # spell-checker:ignore Deno | ||
|
||
/* eslint-disable no-console , functional/immutable-data , security/detect-object-injection, security-node/detect-crlf , @typescript-eslint/ban-ts-comment , @typescript-eslint/no-explicit-any */ | ||
|
||
// @ts-ignore | ||
import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@2d5924e692617a575c8a73c9fb611e93085c4339/src/mod.deno.ts'; | ||
// import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@latest/src/mod.deno.ts'; | ||
// import osPaths from 'https://cdn.jsdelivr.net/gh/rivy/js.os-paths@6.0/src/mod.deno.ts'; | ||
|
||
// create a local reference to refer to `Deno` (for better linting without need for multiple `// @ts-ignore` directives) | ||
// @ts-ignore | ||
const deno = Deno; | ||
|
||
function objectEntries(obj: any) { | ||
const map: any = {}; | ||
Object.keys(obj).forEach((key) => { | ||
const value = obj[key]; | ||
const val = typeof value === 'function' ? value() : value; | ||
map[key] = val; | ||
}); | ||
return map; | ||
} | ||
|
||
console.log({ osPaths }); | ||
console.log(objectEntries(osPaths)); | ||
|
||
deno.env.set('TEMP', 'temp'); | ||
deno.env.set('TMPDIR', 'tmpdir'); | ||
deno.env.set('TMP', 'tmp'); | ||
console.log(objectEntries(osPaths)); | ||
|
||
deno.env.set('TEMP', 'NEW'); | ||
console.log(objectEntries(osPaths)); | ||
|
||
/* eslint-enable no-console , functional/immutable-data , security/detect-object-injection, security-node/detect-crlf , @typescript-eslint/ban-ts-comment , @typescript-eslint/no-explicit-any */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters