Skip to content

Commit b7ac86b

Browse files
committed
added: String.prototype.parseJSON()
1 parent 91a0c93 commit b7ac86b

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

changes.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Framework loads modules, packages, models, definitions, controllers
6565
- added: routing supports schemas `*custom-schema/User` and we can define it in flags
6666
- added: String.prototype.parseBool()
6767
- added: framework.responseImageCache(req, res, fnPrepare, fnProcess, [headers])
68+
- added: String.prototype.parseJSON()
6869

6970
- updated: (IMPORTANT) framework doesn't remove subdirectories with files in temporary directory
7071
- updated: (IMPORTANT) all models are loaded after is the framework loaded
@@ -117,7 +118,7 @@ Framework loads modules, packages, models, definitions, controllers
117118
- fixed: sender name encoding in mail (supports UTF-8)
118119
- fixed: Utils.trim()
119120
- fixed: Response.cookie()
120-
- fixed: String.format() --> null/undefined --> returns empty string
121+
- fixed: String.prototype.format() --> null/undefined --> returns empty string
121122

122123
- improvements: routing performance
123124

utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,14 @@ exports.parseXML = function(xml) {
14181418
return obj;
14191419
};
14201420

1421+
exports.parseJSON = function() {
1422+
try {
1423+
return JSON.parse(this);
1424+
} catch(e) {
1425+
return null;
1426+
}
1427+
};
1428+
14211429
/**
14221430
* Get WebSocket frame
14231431
* @author Jozef Gula <gula.jozef@gmail.com>

0 commit comments

Comments
 (0)