Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 22 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import osPaths from '../dist/cjs/mod.cjs.js'; // ## maint: [2021-02-07; rivy] await resolution of <https://github.com/TypeStrong/ts-node/issues/783> to return to direct TS import |
||
2 | |||
3 | /* eslint-disable no-console , functional/immutable-data , security/detect-object-injection, security-node/detect-crlf , @typescript-eslint/no-explicit-any */ |
||
4 | |||
5 | function objectEntries(obj: any) { |
||
6 | const map: any = {}; |
||
7 | Object.keys(obj).forEach((key) => { |
||
8 | const value = obj[key]; |
||
9 | const val = typeof value === 'function' ? value() : value; |
||
10 | map[key] = val; |
||
11 | }); |
||
12 | return map; |
||
13 | } |
||
14 | |||
15 | console.log({ osPaths }); |
||
16 | console.log(objectEntries(osPaths)); |
||
17 | console.log('home() =', osPaths.home()); |
||
18 | console.log('temp() =', osPaths.temp()); |
||
19 | |||
20 | process.env.TMPDIR = process.env.TEMP = process.env.TMP = 'temp'; |
||
21 | console.log(objectEntries(osPaths)); |
||
22 | |||
23 | /* eslint-enable no-console , functional/immutable-data , security/detect-object-injection, security-node/detect-crlf , @typescript-eslint/no-explicit-any*/ |
||
24 |