Skip to content
Myr

query.js

This file

Path

lib/middleware/query.js

47 lines · 885 bytes · JavaScript

Last changed by

deps: qs@6.5.0Douglas Christopher Wilsonbefore adoptiondeffce5

History of this file

Take it

The walk stopped after 200 commits: lines older than dd2b897 point at it.

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 1–14why, one step back
1/*!
2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2013 Roman Shtylman5 * Copyright(c) 2014-2015 Douglas Christopher Wilson6 * MIT Licensed7 */89'use strict';1011/**12 * Module dependencies.13 */14

deps: qs@6.5.0Douglas Christopher Wilsonbefore adoptiondeffce5

line 15why, one step back
15var merge = require('utils-merge')

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 16–25why, one step back
16var parseUrl = require('parseurl');
17var qs = require('qs');1819/**20 * @param {Object} options21 * @return {Function}22 * @api public23 */2425module.exports = function query(options) {

deps: qs@6.5.0Douglas Christopher Wilsonbefore adoptiondeffce5

line 26why, one step back
26 var opts = merge({}, options)

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 27–33why, one step back
27 var queryparse = qs.parse;
2829 if (typeof options === 'function') {30 queryparse = options;31 opts = undefined;32 }33

deps: qs@6.2.0Douglas Christopher Wilsonbefore adoption999546d

lines 34–36why, one step back
34 if (opts !== undefined && opts.allowPrototypes === undefined) {
35 // back-compat for qs module36 opts.allowPrototypes = true;

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 37–47why, one step back
37 }
3839 return function query(req, res, next){40 if (!req.query) {41 var val = parseUrl(req).query;42 req.query = queryparse(val, opts);43 }4445 next();46 };47};