Source

network/toQueryString.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var qs_1 = __importDefault(require("qs"));
var omitBy_1 = __importDefault(require("lodash/omitBy"));
var isNullOrUndef_1 = __importDefault(require("../validators/isNullOrUndef"));
/**
 * Parse object to query string with "?" prefix auto-added
 *
 * @param params
 * @category network
 * @module toQueryString
 */
function toQueryString(params) {
    var queryString = qs_1.default.stringify((0, omitBy_1.default)(params, function (value) { return (value === ''
        || (0, isNullOrUndef_1.default)(value)); }));
    // Return query string with question mark
    return queryString ? "?".concat(queryString) : '';
}
exports.default = toQueryString;