How to use the parseQuery function from urijs

Find comprehensive JavaScript urijs.parseQuery code examples handpicked from public code repositorys.

4
5
6
7
8
9
10
11
12
13
const URI = require('urijs');

const validModes = ['utf8', 'utf16', 'utf32'];

const { query } = URI.parse(decodeURIComponent(window.location.href));
const MODE = ((left = URI.parseQuery(query).mode) != null ? left : 'utf8').toLowerCase();

if (!Array.from(validModes).includes(MODE)) {
    // Ensure the mode is an actualy encoding
    alert('Mode must be in #{validModes}');
fork icon75
star icon0
watch icon0

+ 9 other calls in file

208
209
210
211
212
213
214
215
216
217
218


/**
 * Handles loading data from URL parameters if a query string is passed
 */
ElectionSearch.prototype.handlePopState = function() {
  var params = URI.parseQuery(window.location.search);
  this.$zip.val(params.zip);
  this.$state.val(params.state);
  this.handleStateChange();
  this.$district.val(params.district);
fork icon37
star icon85
watch icon0

921
922
923
924
925
926
927
928
929
930
  committee_id: $map.data('committee-id'),
  cycle: $map.data('cycle'),
  per_page: 99
});

var query = URI.parseQuery(window.location.search);

// If we're on the raising tab, load the state map
if (query.tab === 'raising') {
  $.getJSON(mapUrl).done(function(data) {
fork icon37
star icon85
watch icon0

467
468
469
470
471
472
473
474
475
476
  var nextLink = next.href;
  if(!nextLink) {
    nextLink = next; //older version of JSONAPI
  }
  var nextURI = new URI(nextLink);
  var nextParams = URI.parseQuery(nextURI.query());
  nextOffset = parseInt(nextParams["page[offset]"], 10)
}
if(resultHandler) {
  resultHandler(data, included, nextOffset);
fork icon1
star icon1
watch icon0

9
10
11
12
13
14
15
16
17
18
19
20
21
let queryParams = {}




$(document).ready(() => {
    const currentUrl = URI(window.location.href)
    queryParams = URI.parseQuery(currentUrl.query())


    if(queryParams.hasOwnProperty('q'))
        searchInput.val(queryParams.q)

fork icon0
star icon1
watch icon0

13
14
15
16
17
18
19
20
21
22
 * Otherwise, if there is a UF-Redirect header, redirect to that page.
 * Otherwise, redirect to the home page.
 */
function redirectOnLogin(jqXHR) {
    var components = URI.parse(window.location.href);
    var query = URI.parseQuery(components['query']);

    if (query && query['redirect']) {
        // Strip leading slashes from redirect strings           
        var redirectString = site.uri.public + '/' + query['redirect'].replace(/^\/+/, "");
fork icon0
star icon0
watch icon0

65
66
67
68
69
70
71
72
73
74
// console.log("token :",TOKEN);

// console.log(ctx.request.url)

const txParams = URI.parseQuery(new URI(ctx.request.url).query())
// const txParams = URI.parseQuery(new URI(tsturl).query())
console.log(ctx.request)
if (checkSignature(txParams, TOKEN)) {
  ctx.body = txParams.echostr
} else {
fork icon0
star icon0
watch icon0