UNPKG

gatsby-source-nytimes-books-api

Version:

This [GatsyJS](https://gatsbyjs.org) source plugin fetches data from the [NYTimes Books API](https://developer.nytimes.com/docs/books-product/1/overview)

16 lines (11 loc) 338 B
const qs = require("querystring") function getQueryString(paramValues, acceptedParams, queryObj = {}) { const paramKeys = Object.keys(paramValues) paramKeys.forEach(key => { if (acceptedParams.includes(key)) { queryObj[key] = paramValues[key] } }) return qs.stringify(queryObj) } module.exports = getQueryString