Comparing version 0.2.1 to 0.2.2
@@ -20,1 +20,5 @@ | ||
0.2.2 | ||
================== | ||
- [feature] 添加global.__debug | ||
@@ -41,3 +41,3 @@ { | ||
"name": "febs", | ||
"version": "0.2.1" | ||
"version": "0.2.2" | ||
} |
@@ -48,2 +48,3 @@ febs 库是一些常用的工具的合集; | ||
| __line | 当前所在行, 可以配合 __filename 定位错误日志 | | ||
| __debug | 判断当前的环境process.env.NODE_ENV是否为development, 如对此值设置后, 使用设置后的值. | | ||
| console.debug | development 环境下输出日志 | | ||
@@ -50,0 +51,0 @@ |
@@ -33,6 +33,22 @@ | ||
// | ||
// define the __debug. | ||
if (!global.hasOwnProperty('__debug')) { | ||
Object.defineProperty(global, '__debug', { | ||
get: function() { | ||
if (global.hasOwnProperty('__debugValue')) | ||
return global.__debugValue; | ||
else | ||
return ((process.env.NODE_ENV || 'development') == 'development'); | ||
}, | ||
set: function(isDebug) { | ||
global.__debugValue = isDebug; | ||
} | ||
}); | ||
} | ||
// | ||
// debug. | ||
// | ||
if (!console.debug) { | ||
if ((process.env.NODE_ENV || 'development') == 'development') { | ||
if (global.__debug) { | ||
console.debug = console.warn; | ||
@@ -39,0 +55,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227660
1347
494