-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
export(graphql2json) | ||
importFrom(Rcpp,sourceCpp) | ||
importFrom(jsonlite,toJSON) | ||
useDynLib(graphql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
#' Dump GraphQL to JSON | ||
#' | ||
#' Parses GraphQL and exports as JSON | ||
#' Parses GraphQL and exports the AST in JSON format. | ||
#' | ||
#' @export | ||
#' @useDynLib graphql | ||
#' @importFrom Rcpp sourceCpp | ||
graphql2json <- function(string){ | ||
dump_json_ast(string) | ||
#' @importFrom jsonlite toJSON | ||
#' @param input a string with graphql syntax | ||
#' @examples graphql2json("{ field(complex: { a: { b: [ $var ] } }) }") | ||
graphql2json <- function(input){ | ||
stopifnot(is.character(input)) | ||
input <- paste(input, collapse = "\n") | ||
json <- dump_json_ast(input) | ||
structure(json, class = "json") | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.