UNPKG

637 BJavaScriptView Raw
1var jfogs = require('jfogs');
2
3/**
4 * jfogs 代码混淆
5 *
6 * @param {string} content 文本内容
7 * @param {Object} attrs 属性
8 * @param {string} attrs.type 混淆方式 "zero" | "reverse"
9 * @param {string} attrs.prefix 参数名前缀
10 * @param {Object} scope 作用域
11 * @param {Function} scope.execImport 导入数据
12 */
13module.exports = function processor(content, attrs, scope) {
14 if (!content) {
15 return content;
16 }
17 return jfogs.obfuscate(content, {
18 type: scope.execImport(attrs.type),
19 breakout: /^(yes|on|ok|true)$/.test(scope.execImport(attrs.breakout)),
20 prefix: scope.execImport(attrs.prefix)
21 });
22};
\No newline at end of file