Skip to content

Commit

Permalink
fixed: 'prefix' is not defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
zswang committed Aug 23, 2015
1 parent 4e50e2d commit 7f65a7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions lib/jfogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Javascript code obfuscator
* @author
* zswang (http://weibo.com/zswang)
* @version 0.0.6
* @version 0.0.7
* @date 2015-08-23
*/
var esprima = require('esprima');
Expand Down Expand Up @@ -40,14 +40,14 @@ function format(template, json) {
* @return {String} 返回混淆后的代码
*/
function obfuscate(code, options) {
function identFrom(index) {
prefix = options.prefix || '$fog$';
return prefix + index;
}
if (!code) {
return code;
}
options = options || {};
var prefix = options.prefix || '$fog$';
function identFrom(index) {
return prefix + index;
}
code = String(code).replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
.replace(/^\uFEFF/, ''); // 数据清洗
var syntax = esprima.parse(code, {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jfogs",
"version": "0.0.6",
"version": "0.0.7",
"description": "Javascript code obfuscator",
"main": "index.js",
"bin": {
Expand Down
10 changes: 5 additions & 5 deletions src/jfogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ function format(template, json) {
* @return {String} 返回混淆后的代码
*/
function obfuscate(code, options) {
function identFrom(index) {
prefix = options.prefix || '$fog$';
return prefix + index;
}

if (!code) {
return code;
}
options = options || {};
var prefix = options.prefix || '$fog$';

function identFrom(index) {
return prefix + index;
}

code = String(code).replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
.replace(/^\uFEFF/, ''); // 数据清洗
Expand Down

0 comments on commit 7f65a7f

Please sign in to comment.