mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-06 02:37:14 +00:00
No RSoD when getting non-string objects as well
This commit is contained in:
parent
405773312d
commit
494bce97a2
@ -21,6 +21,9 @@ exports.moduleproperty = function(source,operator,options) {
|
||||
try {
|
||||
var value = require(title)[operator.operand || ""];
|
||||
if(value !== undefined) {
|
||||
if(typeof value !== "string") {
|
||||
value = JSON.stringify(value);
|
||||
}
|
||||
results.push(value);
|
||||
}
|
||||
} catch(e) {
|
||||
|
@ -1141,6 +1141,8 @@ Tests the filtering mechanism.
|
||||
expect(wiki.filterTiddlers("[[macro]modules[]moduleproperty[nonexistent]]").length).toBe(0);
|
||||
// No such tiddlers. Nothing to return.
|
||||
expect(wiki.filterTiddlers("[[nonexistent]moduleproperty[name]]").length).toBe(0);
|
||||
// Non string properties should get toStringed.
|
||||
expect(wiki.filterTiddlers("[[$:/core/modules/commands/init.js]moduleproperty[info]]").join(" ")).toBe('{"name":"init","synchronous":true}');
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user