Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!regex.test(key)) continue;
delete cust_params[key];
}
delete vast_query.cust_params["$$remove"];
}
// transform
let transformed = this.macros.transform(vast_query, {
get: (key) => {
return vast.tnl_keys[key.toLowerCase()];
}
});
query.cust_params = cust_params;
merge(query, transformed);
query.cust_params = qs.stringify(query.cust_params);
return true;
}
}
const {
method,
parameters,
headers = {},
logging = false
} = options
let url = options.url
const fetchOptions = { method, headers }
// set the JSON body if we have one
if (parametersForBody(method) && parametersIsObject(parameters)) {
fetchOptions.body = JSON.stringify(parameters)
} else if (parametersForQueryString(method) && parametersIsObject(parameters)) {
url = R.concat(url, QueryString.stringify(parameters, true))
}
if (logging) {
logRequest(url, method, parameters)
}
// start the clock
const timeStart = Date.now()
// make the call and wait
return new Promise((resolve, reject) => {
const clientResponse = {
ok: false,
json: null,
statusCode: null
}
export const viewComment = id => (dispatch, _, { pym }) => {
const search = queryString.stringify({
...queryString.parse(location.search),
comment_id: id,
});
// remove the comment_id url param
const url = buildUrl({ ...location, search });
try {
// "window" here refers to the embedded iframe
window.history.replaceState({}, document.title, url);
// also change the parent url
pym.sendMessage('coral-view-comment', id);
} catch (e) {
/* not sure if we're worried about old browsers */
}
// Only set the API key for authenticated endpoints,
// when it is required or optional and set on the client
if (this._usesApiKey()) {
query['access_token'] = this.apiKey
}
// Set the language for localized endpoints
if (this.isLocalized) {
query['lang'] = this.lang
}
// Merge the parsed query parts out of the url
query = Object.assign(query, parsedQuery)
// Build the url with the finished query
query = qs.stringify(query, true).replace(/%2C/g, ',')
return parsedUrl[0] + query
}
export const ensureString = input =>
isString(input) ? input : qs.stringify(input)
const IPRE = /^[0-9.]+$/
function urlToString(url: any) {
const { pathname, query } = url;
const querystring = qs.stringify(query);
if (!querystring) {
return pathname;
} else {
return `${pathname}?${querystring}`;
}
}
function buildStreamIframeUrl(talkBaseUrl, query) {
let url = talkBaseUrl + 'embed/stream?';
url += queryString.stringify(query);
return url;
}
const pathParams: Record = {};
const queryParams: Record = {};
Object.keys(params).forEach(name => {
if (pathParameters[name]) {
pathParams[name] = params[name];
} else {
if (params[name] !== undefined) {
queryParams[name] = params[name];
}
}
});
return (
builder.path(pathParams) +
qs.stringify(queryParams, Object.keys(queryParams).length > 0)
);
}
.keys(params)
.filter(key => Object.keys(paramDefs).indexOf(key) > -1)
.reduce((acc, key) => {
const value = params[key] === 'undefined' ? undefined
: params[key] === 'null' ? null
: params[key];
const paramDef = paramDefs[key];
return paramDef.default() === value
? acc //avoid query string clutter: don't serialize values that are the same as the default
: {
[key]: params[key],
...acc
}
}, null);
return qs.stringify(queryStringParams);
}
country,
} = address;
const query = [ city, street, province, zip, country ]
.filter( identity )
.map( trim )
.join( ', ' );
const args = {
f: 'q',
source: 's_q',
geocode: '',
q: query,
};
return `https://maps.google.com/maps?${ stringify( args ) }`;
}