mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
formatters/whisper: polish corner case handling code
This commit is contained in:
parent
6a058b690b
commit
b326202314
@ -159,11 +159,8 @@ var inputPostFormatter = function(post) {
|
||||
post.priority = utils.fromDecimal(post.priority);
|
||||
|
||||
// fallback
|
||||
if (post.topics == undefined) {
|
||||
post.topics = []
|
||||
}
|
||||
if (!utils.isArray(post.topics)) {
|
||||
post.topics = [post.topics];
|
||||
post.topics = post.topics ? [post.topics] : [];
|
||||
}
|
||||
|
||||
// format the following options
|
||||
@ -195,8 +192,8 @@ var outputPostFormatter = function(post){
|
||||
}
|
||||
|
||||
// format the following options
|
||||
if (post.topics == undefined) {
|
||||
post.topics = []
|
||||
if (!post.topics) {
|
||||
post.topics = [];
|
||||
}
|
||||
post.topics = post.topics.map(function(topic){
|
||||
return utils.toAscii(topic);
|
||||
|
Loading…
x
Reference in New Issue
Block a user