Skip to content

Commit d28e2ad

Browse files
authored
Merge pull request ninenine#36 from lukechinworth/master
Only set topic fields if they already exist
2 parents 41e84fd + 18a7d32 commit d28e2ad

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,18 @@ var Beep = {
141141
parseTopic: function (data, callback) {
142142
// from http://htmlarrows.com/symbols/
143143
var starHTML = '*';
144-
data.topic.title = Beep.parseContent(data.topic.title, starHTML);
145-
data.topic.slug = Beep.parseContent(data.topic.slug, starHTML);
146-
data.topic.titleRaw = Beep.parseContent(data.topic.titleRaw, starHTML);
144+
145+
if (data.topic.hasOwnProperty('title')) {
146+
data.topic.title = Beep.parseContent(data.topic.title, starHTML);
147+
}
148+
149+
if (data.topic.hasOwnProperty('slug')) {
150+
data.topic.slug = Beep.parseContent(data.topic.slug, starHTML);
151+
}
152+
153+
if (data.topic.hasOwnProperty('titleRaw')) {
154+
data.topic.titleRaw = Beep.parseContent(data.topic.titleRaw, starHTML);
155+
}
147156

148157
callback(null, data);
149158
},

0 commit comments

Comments
 (0)