@readme/httpsnippet 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.1.2",
2
+ "version": "3.1.3",
3
3
  "name": "@readme/httpsnippet",
4
4
  "description": "HTTP Request snippet generator for *most* languages",
5
5
  "homepage": "https://github.com/readmeio/httpsnippet",
@@ -23,20 +23,17 @@ module.exports = function (source) {
23
23
 
24
24
  // Construct query string
25
25
  const qs = source.queryObj;
26
- const queryCount = Object.keys(qs).length;
27
26
  // eslint-disable-next-line no-param-reassign
28
27
  delete source.queryObj.key;
29
28
 
30
- if (source.queryString.length === 1) {
29
+ const queryCount = Object.keys(qs).length;
30
+ if (queryCount === 1) {
31
31
  code.push('queryString <- list(%s = "%s")', Object.keys(qs), Object.values(qs).toString()).blank();
32
- } else if (source.queryString.length > 1) {
33
- let count = 1;
34
-
32
+ } else if (queryCount > 1) {
35
33
  code.push('queryString <- list(');
36
34
 
37
- Object.keys(qs).forEach(query => {
38
- // eslint-disable-next-line no-plusplus
39
- if (count++ !== queryCount - 1) {
35
+ Object.keys(qs).forEach((query, i) => {
36
+ if (i !== queryCount - 1) {
40
37
  code.push(' %s = "%s",', query, qs[query].toString());
41
38
  } else {
42
39
  code.push(' %s = "%s"', query, qs[query].toString());