forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputFileNameRule.ts
More file actions
28 lines (22 loc) · 757 Bytes
/
Copy pathInputFileNameRule.ts
File metadata and controls
28 lines (22 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
import { IOptions } from '../../interfaces/options/IOptions';
import { StringSeparator } from '../../enums/StringSeparator';
/**
* @param {IOptions} options
* @returns {IOptions}
*/
export const InputFileNameRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
let { inputFileName } = options;
if (inputFileName) {
inputFileName = inputFileName
.replace(/^\/+/, '')
.split(StringSeparator.Dot)
.slice(0, -1)
.join(StringSeparator.Dot) || inputFileName;
options = {
...options,
inputFileName: `${inputFileName}.js`
};
}
return options;
};