mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-02 17:03:36 +00:00
Merge pull request #1008 from embark-framework/bugfix/json-function
Stringiy function for command console
This commit is contained in:
commit
fc902b6242
@ -41,7 +41,7 @@ class Console {
|
||||
if (typeof result === 'string') {
|
||||
return res.send({result});
|
||||
}
|
||||
res.send({result: stringify(result, null, 2)});
|
||||
res.send({result: stringify(result, utils.jsonFunctionReplacer, 2)});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -524,6 +524,14 @@ function fuzzySearch(text, list, filter) {
|
||||
return fuzzy.filter(text, list, {extract: (filter || function () {})});
|
||||
}
|
||||
|
||||
function jsonFunctionReplacer(_key, value) {
|
||||
if (typeof value === 'function') {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
joinPath,
|
||||
dirname,
|
||||
@ -570,5 +578,6 @@ module.exports = {
|
||||
timer,
|
||||
fileTreeSort,
|
||||
copyToClipboard,
|
||||
fuzzySearch
|
||||
fuzzySearch,
|
||||
jsonFunctionReplacer
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user