swagger-client 3.32.1 → 3.32.2

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.
@@ -32,15 +32,16 @@ export default function stylize(config) {
32
32
  return encodePrimitive(config);
33
33
  }
34
34
  export function valueEncoder(value, escape = false) {
35
+ var _value;
35
36
  if (Array.isArray(value) || value !== null && typeof value === 'object') {
36
37
  value = JSON.stringify(value);
37
38
  } else if (typeof value === 'number' || typeof value === 'boolean') {
38
39
  value = String(value);
39
40
  }
40
- if (escape && value.length > 0) {
41
+ if (escape && typeof value === 'string' && value.length > 0) {
41
42
  return encodeCharacters(value, escape);
42
43
  }
43
- return value;
44
+ return (_value = value) !== null && _value !== void 0 ? _value : '';
44
45
  }
45
46
  function encodeArray({
46
47
  key,
@@ -40,9 +40,7 @@ export const stringifyQuery = (queryObject, {
40
40
  encode = true
41
41
  } = {}) => {
42
42
  const buildNestedParams = (params, key, value) => {
43
- if (value == null) {
44
- params.append(key, '');
45
- } else if (Array.isArray(value)) {
43
+ if (Array.isArray(value)) {
46
44
  value.reduce((acc, v) => buildNestedParams(params, key, v), params);
47
45
  } else if (value instanceof Date) {
48
46
  params.append(key, value.toISOString());
@@ -38,15 +38,16 @@ function stylize(config) {
38
38
  return encodePrimitive(config);
39
39
  }
40
40
  function valueEncoder(value, escape = false) {
41
+ var _value;
41
42
  if (Array.isArray(value) || value !== null && typeof value === 'object') {
42
43
  value = JSON.stringify(value);
43
44
  } else if (typeof value === 'number' || typeof value === 'boolean') {
44
45
  value = String(value);
45
46
  }
46
- if (escape && value.length > 0) {
47
+ if (escape && typeof value === 'string' && value.length > 0) {
47
48
  return encodeCharacters(value, escape);
48
49
  }
49
- return value;
50
+ return (_value = value) != null ? _value : '';
50
51
  }
51
52
  function encodeArray({
52
53
  key,
@@ -47,9 +47,7 @@ const stringifyQuery = (queryObject, {
47
47
  encode = true
48
48
  } = {}) => {
49
49
  const buildNestedParams = (params, key, value) => {
50
- if (value == null) {
51
- params.append(key, '');
52
- } else if (Array.isArray(value)) {
50
+ if (Array.isArray(value)) {
53
51
  value.reduce((acc, v) => buildNestedParams(params, key, v), params);
54
52
  } else if (value instanceof Date) {
55
53
  params.append(key, value.toISOString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.32.1",
3
+ "version": "3.32.2",
4
4
  "description": "SwaggerJS - a collection of interfaces for OAI specs",
5
5
  "browser": {
6
6
  "./src/helpers/btoa.node.js": "./src/helpers/btoa.browser.js",