Skip to content

Commit

Permalink
update Node toJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Feb 16, 2024
1 parent 5995085 commit 108d566
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/methods-Nodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ setMethod(toJSONGeneric, "Node", function(object, named = c(FALSE, TRUE)) {
tmp <- character()

tmp <- paste0('"id":', jsonlite::toJSON(jsonlite::unbox(id(object))))
if (!!length(x(object))) tmp <- paste0(tmp, ',"x":', jsonlite::toJSON(jsonlite::unbox(x(object))))
if (!!length(y(object))) tmp <- paste0(tmp, ',"y":', jsonlite::toJSON(jsonlite::unbox(y(object))))
if (!!length(x(object)) && !is.na(x(object))) tmp <- paste0(tmp, ',"x":', jsonlite::toJSON(jsonlite::unbox(x(object))))
if (!!length(y(object)) && !is.na(y(object))) tmp <- paste0(tmp, ',"y":', jsonlite::toJSON(jsonlite::unbox(y(object))))
if (!!length(color(object))) tmp <- paste0(tmp, ',"color":', jsonlite::toJSON(jsonlite::unbox(color(object))))
if (!!length(weight(object))) tmp <- paste0(tmp, ',"weight":', jsonlite::toJSON(jsonlite::unbox(weight(object))))
if (!!length(degree(object))) tmp <- paste0(tmp, ',"degree":', jsonlite::toJSON(jsonlite::unbox(degree(object))))
Expand Down

0 comments on commit 108d566

Please sign in to comment.