Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Nov 12, 2024
1 parent ab96970 commit 19c5909
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/blog.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Blog

# Returns a JSON representation of this object.
toJSON: ->
map = blog: @url?.href ? ""
map = blog: if @url? then @url.href else ""
map.blog_charset = @charset if @charset
map.blog_lang = Array.from(@languages).join "," if @languages.size
map
2 changes: 1 addition & 1 deletion src/comment.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Comment

# Returns a JSON representation of this object.
toJSON: ->
map = @author?.toJSON() ? {}
map = @author?.toJSON() or {}
map.comment_content = @content if @content
map.comment_context = @context if @context.length
map.comment_date_gmt = @date.toJSON() if @date
Expand Down
2 changes: 1 addition & 1 deletion test/client_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {describe, it} from "node:test"
# Tests the features of the `Client` class.
describe "Client", ->
# The client used to query the remote API.
client = new Client env.AKISMET_API_KEY ? "", new Blog(url: "https://github.com/cedx/akismet.js"), isTest: yes
client = new Client env.AKISMET_API_KEY or "", new Blog(url: "https://github.com/cedx/akismet.js"), isTest: yes

# A comment with content marked as ham.
ham = new Comment
Expand Down

0 comments on commit 19c5909

Please sign in to comment.