mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-11-22 15:17:13 +00:00
Remove redundant code in format/json.js (#9358)
* Remove redundant code in format/json.js * Revise json.js
This commit is contained in:
1 parent
fb4d417629
commit
c8e41bfade
1 file changed
+2
-6
@@ -16,12 +16,8 @@ exports.json = function(source,operand,options) {
|
||||
spaces = /^\d+$/.test(operand) ? parseInt(operand,10) : operand;
|
||||
}
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title);
|
||||
try {
|
||||
data = JSON.parse(title);
|
||||
} catch(e) {
|
||||
data = undefined;
|
||||
}
|
||||
var data = $tw.utils.parseJSONSafe(title,function(){return undefined;});
|
||||
|
||||
if(data !== undefined) {
|
||||
results.push(JSON.stringify(data,null,spaces));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user