mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
refactor(util) parseJSON, stringifyJSON
This commit is contained in:
parent
b7efa6203f
commit
4902adbe8f
1 changed files with 8 additions and 8 deletions
16
lib/util.js
16
lib/util.js
|
|
@ -237,27 +237,27 @@
|
|||
/**
|
||||
* @param pJSON
|
||||
*/
|
||||
this.parseJSON = function(pJSON) {
|
||||
var ret;
|
||||
this.parseJSON = function(str) {
|
||||
var obj;
|
||||
|
||||
Util.tryCatch(function() {
|
||||
ret = JSON.parse(pJSON);
|
||||
obj = JSON.parse(str);
|
||||
});
|
||||
|
||||
return ret;
|
||||
return obj;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param pObj
|
||||
*/
|
||||
this.stringifyJSON = function(pObj) {
|
||||
var ret;
|
||||
this.stringifyJSON = function(obj) {
|
||||
var str;
|
||||
|
||||
Util.tryCatchLog(function() {
|
||||
ret = JSON.stringify(pObj, null, 4);
|
||||
str = JSON.stringify(obj, null, 4);
|
||||
});
|
||||
|
||||
return ret;
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue