UNPKG

linkedin-private-api-node12

Version:

![Build](https://github.com/eilonmore/linkedin-private-api/workflows/Build/badge.svg?branch=master)

23 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.paramsSerializer = void 0; const lodash_1 = require("lodash"); const querystring_1 = require("querystring"); const encodeFilter = (value, key) => encodeURIComponent(`${key}->${lodash_1.castArray(value).join('|')}`); const paramsSerializer = (params) => { const encodedParams = lodash_1.mapValues(params, value => { if (!lodash_1.isArray(value) && !lodash_1.isPlainObject(value)) { return value.toString(); } if (lodash_1.isArray(value)) { return `List(${value.join(',')})`; } const encodedList = lodash_1.reduce(value, (res, filterVal, filterKey) => `${res}${res ? ',' : ''}${encodeFilter(filterVal, filterKey)}`, ''); return `List(${encodedList})`; }); return querystring_1.stringify(encodedParams, undefined, undefined, { encodeURIComponent: uri => uri, }); }; exports.paramsSerializer = paramsSerializer; //# sourceMappingURL=paramsSerializer.js.map