Total Complexity | 4 |
Complexity/F | 2 |
Lines of Code | 18 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import path from 'path'; |
||
2 | import { assert } from 'chai'; |
||
3 | import { entry } from './constants'; |
||
4 | |||
5 | export function load(relPath, clearCache) { |
||
6 | const absPath = path.resolve(entry, relPath); |
||
7 | |||
8 | if (clearCache) delete require.cache[require.resolve(absPath)]; |
||
9 | // eslint-disable-next-line security/detect-non-literal-require |
||
10 | const result = require(absPath); |
||
11 | |||
12 | if (clearCache) delete require.cache[require.resolve(absPath)]; |
||
13 | |||
14 | return result; |
||
15 | } |
||
16 | |||
17 | export function resolve(relPath) { |
||
18 | return require.resolve(path.join(entry, relPath)); |
||
19 | } |
||
51 |