| Total Complexity | 2 |
| Complexity/F | 2 |
| Lines of Code | 33 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* eslint-env es6, deno */ |
||
| 2 | // # spell-checker:ignore Deno |
||
| 3 | |||
| 4 | /* 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 */ |
||
| 5 | |||
| 6 | // @ts-ignore |
||
| 7 | import osPaths from 'https://deno.land/x/[email protected]/src/mod.deno.ts'; |
||
| 8 | |||
| 9 | // create a local reference to refer to `Deno` (for better linting without need for multiple `// @ts-ignore` directives) |
||
| 10 | // @ts-ignore |
||
| 11 | const deno = Deno; |
||
| 12 | |||
| 13 | function objectEntries(obj: any) { |
||
| 14 | const map: any = {}; |
||
| 15 | Object.keys(obj).forEach((key) => { |
||
| 16 | const value = obj[key]; |
||
| 17 | const val = typeof value === 'function' ? value() : value; |
||
| 18 | map[key] = val; |
||
| 19 | }); |
||
| 20 | return map; |
||
| 21 | } |
||
| 22 | |||
| 23 | console.log({ osPaths }); |
||
| 24 | console.log(objectEntries(osPaths)); |
||
| 25 | |||
| 26 | deno.env.set('TEMP', 'temp'); |
||
| 27 | deno.env.set('TMPDIR', 'tmpdir'); |
||
| 28 | deno.env.set('TMP', 'tmp'); |
||
| 29 | console.log(objectEntries(osPaths)); |
||
| 30 | |||
| 31 | deno.env.set('TEMP', 'NEW'); |
||
| 32 | console.log(objectEntries(osPaths)); |
||
| 33 | |||
| 34 | /* 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 */ |
||
| 35 |