Total Complexity | 3 |
Complexity/F | 3 |
Lines of Code | 23 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | 'use strict' |
||
2 | |||
3 | const fs = require('fs') |
||
4 | |||
5 | module.exports = (baseFileDir, value) => { |
||
6 | if ( typeof(value |
||
7 | ) != 'object' ) { |
||
8 | return value |
||
9 | } |
||
10 | |||
11 | let filePath = baseFileDir + '/' + value.file |
||
12 | let fileContent |
||
13 | |||
14 | //try { |
||
15 | fileContent = fs.readFileSync(filePath, 'utf-8') |
||
16 | //} catch(error) { |
||
17 | // fileContent = '--Error loading file--'; |
||
18 | //} |
||
19 | |||
20 | return value.text |
||
21 | ? value.text.replace('$FILE', fileContent) |
||
22 | : fileContent |
||
23 | } |
||
24 |