Fixed React dependency and added exercise 07 and 08
This commit is contained in:
parent
e1cbab07d4
commit
494cbfdf5c
Binary file not shown.
@ -15,17 +15,22 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
</div>
|
</div>
|
||||||
<div class="container"></div>
|
<div class="container">
|
||||||
<div id="date"></div>
|
<div id="date"></div>
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--scripts-->
|
<!--scripts-->
|
||||||
<script src="./lib//jquery-3.3.1.min.js"></script>
|
|
||||||
<script src="./lib/es6-shim.min.js"></script>
|
<script src="./lib/es6-shim.min.js"></script>
|
||||||
<!--<script src="../../lib/bootstrap.min.js"></script>-->
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~loacle.de"></script>
|
||||||
|
<script src="./lib//jquery-2.2.4.min.js"></script>
|
||||||
|
<script src="../../lib/bootstrap.min.js"></script>
|
||||||
|
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
|
<!--script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script-->
|
||||||
|
|
||||||
<script src="./lib/babel.min.js"></script>
|
<script src="./lib/babel.min.js"></script>
|
||||||
<script src="./lib/react.js"></script>
|
<script src="./lib/react.js"></script>
|
||||||
@ -36,7 +41,8 @@
|
|||||||
<script src="scripts/Patient.js"></script>
|
<script src="scripts/Patient.js"></script>
|
||||||
<script src="scripts/fhirService.js"></script>
|
<script src="scripts/fhirService.js"></script>
|
||||||
|
|
||||||
<script src="scripts/react.js" type="text/babel"></script>
|
<script src="scripts/react.js" type="text/babel">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
function loadTemplates() {
|
function loadTemplates() {
$('#navigation').load('templates/NavbarTemplate.html');
|
||||||
$('#navigation').load('templates/NavbarTemplate.html');
|
$('#content').load('templates/AboutTemplate.html');
|
||||||
$('#content').load('templates/AboutTemplate.html');
|
}
$(document).ready(loadTemplates());
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(loadTemplates);
|
|
43
code/code/exercise06/app/scripts/babel.min.js
vendored
Normal file
43
code/code/exercise06/app/scripts/babel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
43
code/code/exercise06/app/scripts/lib/babel.min.js
vendored
Normal file
43
code/code/exercise06/app/scripts/lib/babel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17232
code/code/exercise06/app/scripts/lib/react-dom.js
vendored
Normal file
17232
code/code/exercise06/app/scripts/lib/react-dom.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1741
code/code/exercise06/app/scripts/lib/react.js
vendored
Normal file
1741
code/code/exercise06/app/scripts/lib/react.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
code/code/exercise06/app/scripts/react.js
vendored
7
code/code/exercise06/app/scripts/react.js
vendored
@ -1,12 +1,13 @@
|
|||||||
class DateMessage extends React.Components
|
class DateMessage extends React.Component
|
||||||
{
|
{
|
||||||
currentDateSTring(int_format){
|
currentDateString(int_format){
|
||||||
const options = {year: 'numeric', month: '2-digit', day: '2-digit'};
|
const options = {year: 'numeric', month: '2-digit', day: '2-digit'};
|
||||||
return (new Intl.DateTimeFormat(int_format, options)).format(Date.now());
|
return (new Intl.DateTimeFormat(int_format, options)).format(Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div className="container">
|
return <div className="container">
|
||||||
<div className="col-xs-12">
|
<div className="cal-xs-12">
|
||||||
<span className="pull-right">
|
<span className="pull-right">
|
||||||
{this.currentDateString(this.props.format)}
|
{this.currentDateString(this.props.format)}
|
||||||
</span>
|
</span>
|
||||||
|
27
code/code/exercise08/app/css/mobile.css
Normal file
27
code/code/exercise08/app/css/mobile.css
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
.btn-style{
|
||||||
|
min-width: 150px;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body{
|
||||||
|
padding-top: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
padding: 10px;
|
||||||
|
color: white;
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-center{
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
101
code/code/exercise08/app/data/patient.json
Normal file
101
code/code/exercise08/app/data/patient.json
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"address": [
|
||||||
|
{
|
||||||
|
"city": "Amsterdam",
|
||||||
|
"country": "NLD",
|
||||||
|
"line": [ "Van Egmondkade 23" ],
|
||||||
|
"postalCode": "1024 RJ",
|
||||||
|
"use": "home"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"birthDate": "1944-11-17",
|
||||||
|
"communication": [
|
||||||
|
{
|
||||||
|
"language": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"code": "nl",
|
||||||
|
"display": "Dutch",
|
||||||
|
"system": "urn:ietf:bcp:47"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Nederlands"
|
||||||
|
},
|
||||||
|
"preferred": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contact": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"family": [ "Abels" ],
|
||||||
|
"given": [ "Sarah" ],
|
||||||
|
"use": "usual"
|
||||||
|
},
|
||||||
|
"relationship": [
|
||||||
|
{
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"code": "partner",
|
||||||
|
"system": "http://hl7.org/fhir/patient-contact-relationship"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"telecom": [
|
||||||
|
{
|
||||||
|
"system": "phone",
|
||||||
|
"use": "mobile",
|
||||||
|
"value": "0690383372"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"deceasedBoolean": false,
|
||||||
|
"gender": "male",
|
||||||
|
"id": "f001",
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"system": "urn:oid:2.16.840.1.113883.2.4.6.3",
|
||||||
|
"use": "usual",
|
||||||
|
"value": "738472983"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"managingOrganization": {
|
||||||
|
"display": "Burgers University Medical Centre",
|
||||||
|
"reference": "Organization/f001"
|
||||||
|
},
|
||||||
|
"maritalStatus": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"code": "M",
|
||||||
|
"display": "Married",
|
||||||
|
"system": "http://hl7.org/fhir/v3/MaritalStatus"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"text": "Getrouwd"
|
||||||
|
},
|
||||||
|
"multipleBirthBoolean": true,
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"family": [ "van de Heuvel" ],
|
||||||
|
"given": [ "Pieter" ],
|
||||||
|
"suffix": [ "MSc" ],
|
||||||
|
"use": "usual"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"photo": [],
|
||||||
|
"resourceType": "Patient",
|
||||||
|
"telecom": [
|
||||||
|
{
|
||||||
|
"system": "phone",
|
||||||
|
"use": "mobile",
|
||||||
|
"value": "0648352638"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"system": "email",
|
||||||
|
"use": "home",
|
||||||
|
"value": "p.heuvel@gmail.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
code/code/exercise08/app/data/patientlist.json
Normal file
1
code/code/exercise08/app/data/patientlist.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"active":true,"address":[{"city":"Amsterdam","country":"NLD","line":["Van Egmondkade 23"],"postalCode":"1024 RJ","use":"home"}],"birthDate":"1944-11-17","communication":[{"language":{"coding":[{"code":"nl","display":"Dutch","system":"urn:ietf:bcp:47"}],"text":"Nederlands"},"preferred":true}],"contact":[{"name":{"family":["Abels"],"given":["Sarah"],"use":"usual"},"relationship":[{"coding":[{"code":"partner","system":"http://hl7.org/fhir/patient-contact-relationship"}]}],"telecom":[{"system":"phone","use":"mobile","value":"0690383372"}]}],"deceasedBoolean":false,"gender":"male","id":"f001","identifier":[{"system":"urn:oid:2.16.840.1.113883.2.4.6.3","use":"usual","value":"738472983"}],"managingOrganization":{"display":"Burgers University Medical Centre","reference":"Organization/f001"},"maritalStatus":{"coding":[{"code":"M","display":"Married","system":"http://hl7.org/fhir/v3/MaritalStatus"}],"text":"Getrouwd"},"multipleBirthBoolean":true,"name":[{"family":["van de Heuvel"],"given":["Pieter"],"suffix":["MSc"],"use":"usual"}],"photo":[],"resourceType":"Patient","telecom":[{"system":"phone","use":"mobile","value":"0648352638"},{"system":"email","use":"home","value":"p.heuvel@gmail.com"}]}]
|
BIN
code/code/exercise08/app/img/bootstrap.png
Normal file
BIN
code/code/exercise08/app/img/bootstrap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
code/code/exercise08/app/img/css3.png
Normal file
BIN
code/code/exercise08/app/img/css3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
code/code/exercise08/app/img/html5.png
Normal file
BIN
code/code/exercise08/app/img/html5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
BIN
code/code/exercise08/app/img/jQuery.png
Normal file
BIN
code/code/exercise08/app/img/jQuery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
BIN
code/code/exercise08/app/img/js.png
Normal file
BIN
code/code/exercise08/app/img/js.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
code/code/exercise08/app/img/react.png
Normal file
BIN
code/code/exercise08/app/img/react.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
47
code/code/exercise08/app/index.html
Normal file
47
code/code/exercise08/app/index.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title></title>
|
||||||
|
|
||||||
|
<!--css-->
|
||||||
|
<link rel="stylesheet" href="css/mobile.css">
|
||||||
|
<link rel="stylesheet" href="../../lib/bootstrap.min.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="navigation">
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div id="date"></div>
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--scripts-->
|
||||||
|
<script src="../../lib/es6-shim.min.js"></script>
|
||||||
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~loacle.de"></script>
|
||||||
|
<script src="../../lib/jquery-2.2.4.min.js"></script>
|
||||||
|
<script src="../../lib/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<script src="../../lib/babel.min.js"></script>
|
||||||
|
<script src="../../lib/react.js"></script>
|
||||||
|
<script src="../../lib/react-dom.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/app.js"></script>
|
||||||
|
<script src="scripts/landung.js"></script>
|
||||||
|
<script src="scripts/Patient.js"></script>
|
||||||
|
<script src="scripts/fhirService.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/react.js" type="text/babel">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
46
code/code/exercise08/app/scripts/Patient.js
Normal file
46
code/code/exercise08/app/scripts/Patient.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
function Patient(fhirpatient) {
|
||||||
|
var patient = fhirpatient;
|
||||||
|
|
||||||
|
return {
|
||||||
|
"lastname": () => {
|
||||||
|
if (patient.name) {
|
||||||
|
var nameElement = patient.name.find((element) => {
|
||||||
|
return (element.use == "usual");
|
||||||
|
});
|
||||||
|
if (nameElement)
|
||||||
|
return nameElement.family;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
|
"gender": () => {
|
||||||
|
if(patient.gender)
|
||||||
|
return patient.gender;
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
},
|
||||||
|
"date": () => {
|
||||||
|
if(patient.birthDate)
|
||||||
|
return patient.birthDate;
|
||||||
|
},
|
||||||
|
"home": () => {
|
||||||
|
if (patient.address) {
|
||||||
|
var addressElement = patient.address.find((element) => {
|
||||||
|
return (element.use == "home");
|
||||||
|
});
|
||||||
|
if (addressElement)
|
||||||
|
return (addressElement.postalCode + " " + addressElement.city);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
|
"country": () => {
|
||||||
|
if (patient.address) {
|
||||||
|
var addressElement = patient.address.find((element) => {
|
||||||
|
return (element.use == "home");
|
||||||
|
});
|
||||||
|
if (addressElement)
|
||||||
|
return (addressElement.country);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
3
code/code/exercise08/app/scripts/app.js
Normal file
3
code/code/exercise08/app/scripts/app.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function loadTemplates() {
$('#navigation').load('templates/NavbarTemplate.html');
|
||||||
|
$('#content').load('templates/AboutTemplate.html');
|
||||||
|
}
$(document).ready(loadTemplates);
|
43
code/code/exercise08/app/scripts/babel.min.js
vendored
Normal file
43
code/code/exercise08/app/scripts/babel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
code/code/exercise08/app/scripts/fhirService.js
Normal file
5
code/code/exercise08/app/scripts/fhirService.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
var patient = {};
|
||||||
|
|
||||||
|
$.getJSON("data/patient.json", (data) => {
|
||||||
|
patient = Patient(data);
|
||||||
|
});
|
77
code/code/exercise08/app/scripts/landung.js
Normal file
77
code/code/exercise08/app/scripts/landung.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
function simulation() {
|
||||||
|
var v;
|
||||||
|
var s;
|
||||||
|
var fuel;
|
||||||
|
var schub = false;
|
||||||
|
|
||||||
|
setStartValues(50000, -1000, 10000);
|
||||||
|
|
||||||
|
function switchon() {
|
||||||
|
schub = true;
|
||||||
|
update();
|
||||||
|
checkGameOver();
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchoff() {
|
||||||
|
schub = false;
|
||||||
|
update();
|
||||||
|
checkGameOver();
|
||||||
|
}
|
||||||
|
|
||||||
|
function a() {
|
||||||
|
if (schub == false || fuel <= 0)
|
||||||
|
return -1.63;
|
||||||
|
else {
|
||||||
|
fuel = fuel - 100;
|
||||||
|
return -1.63 + 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showValues() {
|
||||||
|
$("#height").html("Höhe: " + s + " m");
|
||||||
|
$("#speed").html("Geschwindigkeit: " + v + " m/s");
|
||||||
|
$("#fuel").html("Teibstoffvorrat: " + fuel + " l");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
v = v + a();
|
||||||
|
s = s + v;
|
||||||
|
showValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkGameOver() {
|
||||||
|
if (s <= 0) {
|
||||||
|
if (v < -10)
|
||||||
|
alert("Fehlschlag");
|
||||||
|
else
|
||||||
|
alert("Erfolgreich");
|
||||||
|
|
||||||
|
setStartValues(50000, -1000, 10000);
|
||||||
|
showValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStartValues(height, velocity, Newfuel) {
|
||||||
|
v = velocity;
|
||||||
|
s = height;
|
||||||
|
fuel = Newfuel;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#content').html("<h2>Mondlandung</h2>");
|
||||||
|
$("#content").append("<div class='menu'>Hauptmenü</div>")
|
||||||
|
$("#content").append("<div id='height'>Höhe: </div>");
|
||||||
|
$("#content").append("<div id='speed'>Geschwindikgiet: </div>");
|
||||||
|
$("#content").append("<div id='fuel'>Treibstoffvorrat: </div>");
|
||||||
|
$("#content").append("<button id='energy' class='btn-style'>Triebwerk an</button>");
|
||||||
|
$("#content").append("<button id='no-energy' class='btn-style'>Triebwerk aus</button>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#energy").click(switchon);
|
||||||
|
$("#no-energy").click(switchoff);
|
||||||
|
|
||||||
|
showValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
43
code/code/exercise08/app/scripts/lib/babel.min.js
vendored
Normal file
43
code/code/exercise08/app/scripts/lib/babel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17232
code/code/exercise08/app/scripts/lib/react-dom.js
vendored
Normal file
17232
code/code/exercise08/app/scripts/lib/react-dom.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1741
code/code/exercise08/app/scripts/lib/react.js
vendored
Normal file
1741
code/code/exercise08/app/scripts/lib/react.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
code/code/exercise08/app/scripts/react.js
vendored
Normal file
19
code/code/exercise08/app/scripts/react.js
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
class DateMessage extends React.Component
|
||||||
|
{
|
||||||
|
currentDateString(int_format){
|
||||||
|
const options = {year: 'numeric', month: '2-digit', day: '2-digit'};
|
||||||
|
return (new Intl.DateTimeFormat(int_format, options)).format(Date.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return <div className="container">
|
||||||
|
<div className="cal-xs-12">
|
||||||
|
<span className="pull-right">
|
||||||
|
{this.currentDateString(this.props.format)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render(<DateMessage format="de-DE"/>, document.getElementById('date'));
|
41
code/code/exercise08/app/server/patient.js
Normal file
41
code/code/exercise08/app/server/patient.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
var filesystem = require('fs');
|
||||||
|
var patients = [];
|
||||||
|
|
||||||
|
filesystem.readFile('../data/patientlist.json', 'utf8', (err, data) => {
|
||||||
|
if (err)
|
||||||
|
return console.log(err);
|
||||||
|
|
||||||
|
patients = JSON.parse(data);
|
||||||
|
console.log("Anzahl eingelesner Patienten: " + patients.length);
|
||||||
|
});
|
||||||
|
|
||||||
|
function writePatients() {
|
||||||
|
filesystem.writeFile('../data/patientlist.json', JSON.stringify(patients), function (err) {
|
||||||
|
if (err)
|
||||||
|
return console.log(err);
|
||||||
|
console.log("Anzahl geschriebener Patienten: " + patients.length);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.readAll = function () {
|
||||||
|
return patients;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.read = function (id) {
|
||||||
|
return patients.find(function (element) {
|
||||||
|
return (element.id == id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.update = function (id, patient) {
|
||||||
|
var count = 0;
|
||||||
|
patients = patients.map(function (element) {
|
||||||
|
if (element.id == id) {
|
||||||
|
count++;
|
||||||
|
return patient;
|
||||||
|
} else
|
||||||
|
return element;
|
||||||
|
});
|
||||||
|
writePatients();
|
||||||
|
return count;
|
||||||
|
}
|
41
code/code/exercise08/app/server/server.js
Normal file
41
code/code/exercise08/app/server/server.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
var express = require('express');
|
||||||
|
var bodyParser = require('body-parser');
|
||||||
|
var app = express();
|
||||||
|
var api = require('./patient.js');
|
||||||
|
|
||||||
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
app.get('/', (request, response) => {
|
||||||
|
console.log("Anfrage erhalten");
|
||||||
|
response.send("Hello World");
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/patients', (req, res) => {
|
||||||
|
res.json(api.readAll());
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/patients/:id', (req, res) => {
|
||||||
|
var patient = api.read(req.params.id);
|
||||||
|
if (patient)
|
||||||
|
res.json(patient);
|
||||||
|
else
|
||||||
|
res.sendStatus(404);
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/patients', (req, res) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
app.put('/patients/:id', (req, res) => {
|
||||||
|
var count = api.update(req.params.id, req.body);
|
||||||
|
res.json({ "count": count });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.delete('/patients/:id', (req, res) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(3000, () => {
|
||||||
|
console.log("MDT5/2 Server");
|
||||||
|
})
|
45
code/code/exercise08/app/templates/AboutTemplate.html
Normal file
45
code/code/exercise08/app/templates/AboutTemplate.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<div class="row">
|
||||||
|
<h2 class="col-xs-12 page-header">
|
||||||
|
Patientenverwaltung
|
||||||
|
<small>Ein Demoprojekt</small>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/html5.png" alt="HTML5 LOGO" />
|
||||||
|
<h4>HTML5</h4>
|
||||||
|
<p>Strukturierte Inhalte für den Browser</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/css3.png" alt="CSS3 LOGO" />
|
||||||
|
<h4>CSS3</h4>
|
||||||
|
<p>Flexibles Design und Layout</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/bootstrap.png" alt="Bootstrap" />
|
||||||
|
<h4>Bootstrap3</h4>
|
||||||
|
<p>Responsive und schick</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/jQuery.png" alt="JQuery LOGO" />
|
||||||
|
<h4>JQuery</h4>
|
||||||
|
<p>Zugriff auf das DOM</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/react.png" alt="REACT LOGO" />
|
||||||
|
<h4>REACT</h4>
|
||||||
|
<p>Building User Interfaces</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-sm-6 col-xs-12 text-center">
|
||||||
|
<img class="img-circle img-responsive img-center"
|
||||||
|
src="img/js.png" alt="JavaScript" />
|
||||||
|
<h4>JavaScript</h4>
|
||||||
|
<p>Die Programmiersprache im Browser</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
22
code/code/exercise08/app/templates/NavbarTemplate.html
Normal file
22
code/code/exercise08/app/templates/NavbarTemplate.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<span class="navbar-brand" href="#" onclick="simulation()">
|
||||||
|
Patientenverwaltung
|
||||||
|
</span>
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menu">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="menu" class="collapse navbar-collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="#" onclick="$('#content').load('templates/PatientDetailsTemplate.html')">Patient</a></li>
|
||||||
|
<li><a href="#" onclick="$('#content').load('templates/AboutTemplate.html')">Info</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
@ -0,0 +1,45 @@
|
|||||||
|
<div class="row">
|
||||||
|
<h2 class="col-xs-12 page-header">
|
||||||
|
Patientenverwaltung
|
||||||
|
<span id="patient-name">Patientenname</span>
|
||||||
|
</h2>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#patient-name").html(patient.lastname())
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<h6 class="col-xs-6">
|
||||||
|
Geschlecht
|
||||||
|
</h6>
|
||||||
|
<h6 class="col-xs-6" id="patient-gender"></h6>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#patient-gender").html(patient.gender())
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<h6 class="col-xs-6">
|
||||||
|
Geburtsdatum
|
||||||
|
</h6>
|
||||||
|
<h6 class="col-xs-6" id="patient-date">Geburtsdatum</h6>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#patient-date").html(patient.date())
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<h6 class="col-xs-6">
|
||||||
|
Wohnort:
|
||||||
|
</h6>
|
||||||
|
<h6 class="col-xs-6" id="patient-home">Patientenname</h6>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#patient-home").html(patient.home())
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<h6 class="col-xs-6">
|
||||||
|
Land:
|
||||||
|
</h6>
|
||||||
|
<h6 class="col-xs-6" id="patient-country">Land:</h6>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#patient-country").html(patient.country())
|
||||||
|
</script>
|
||||||
|
</div>
|
18
code/code/lib/CORS.js
Normal file
18
code/code/lib/CORS.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
app.use(function (req, res, next) {
|
||||||
|
|
||||||
|
// Website you wish to allow to connect
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
|
||||||
|
// Request methods you wish to allow
|
||||||
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
|
||||||
|
|
||||||
|
// Request headers you wish to allow
|
||||||
|
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
|
||||||
|
|
||||||
|
// Set to true if you need the website to include cookies in the requests sent
|
||||||
|
// to the API (e.g. in case you use sessions)
|
||||||
|
res.setHeader('Access-Control-Allow-Credentials', false);
|
||||||
|
|
||||||
|
// Pass to next layer of middleware
|
||||||
|
next();
|
||||||
|
});
|
1
code/code/node-http-start.bat
Normal file
1
code/code/node-http-start.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
node node_modules\http-server\bin\http-server
|
15
code/code/node_modules/.bin/ecstatic
generated
vendored
Normal file
15
code/code/node_modules/.bin/ecstatic
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../ecstatic/lib/ecstatic.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../ecstatic/lib/ecstatic.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/ecstatic.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/ecstatic.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\ecstatic\lib\ecstatic.js" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\ecstatic\lib\ecstatic.js" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/he
generated
vendored
Normal file
15
code/code/node_modules/.bin/he
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../he/bin/he" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../he/bin/he" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/he.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/he.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\he\bin\he" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\he\bin\he" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/hs
generated
vendored
Normal file
15
code/code/node_modules/.bin/hs
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../http-server/bin/http-server" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../http-server/bin/http-server" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/hs.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/hs.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\http-server\bin\http-server" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\http-server\bin\http-server" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/http-server
generated
vendored
Normal file
15
code/code/node_modules/.bin/http-server
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../http-server/bin/http-server" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../http-server/bin/http-server" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/http-server.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/http-server.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\http-server\bin\http-server" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\http-server\bin\http-server" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/mime
generated
vendored
Normal file
15
code/code/node_modules/.bin/mime
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mime/cli.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mime/cli.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/mime.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/mime.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\mime\cli.js" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\mime\cli.js" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/mkdirp
generated
vendored
Normal file
15
code/code/node_modules/.bin/mkdirp
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||||
|
)
|
15
code/code/node_modules/.bin/opener
generated
vendored
Normal file
15
code/code/node_modules/.bin/opener
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../opener/opener.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../opener/opener.js" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
code/code/node_modules/.bin/opener.cmd
generated
vendored
Normal file
7
code/code/node_modules/.bin/opener.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\opener\opener.js" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\opener\opener.js" %*
|
||||||
|
)
|
236
code/code/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
236
code/code/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
1.3.7 / 2019-04-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.6.2
|
||||||
|
- Fix sorting charset, encoding, and language with extra parameters
|
||||||
|
|
||||||
|
1.3.6 / 2019-04-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.24
|
||||||
|
- deps: mime-db@~1.40.0
|
||||||
|
|
||||||
|
1.3.5 / 2018-02-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.18
|
||||||
|
- deps: mime-db@~1.33.0
|
||||||
|
|
||||||
|
1.3.4 / 2017-08-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.16
|
||||||
|
- deps: mime-db@~1.29.0
|
||||||
|
|
||||||
|
1.3.3 / 2016-05-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.11
|
||||||
|
- deps: mime-db@~1.23.0
|
||||||
|
* deps: negotiator@0.6.1
|
||||||
|
- perf: improve `Accept` parsing speed
|
||||||
|
- perf: improve `Accept-Charset` parsing speed
|
||||||
|
- perf: improve `Accept-Encoding` parsing speed
|
||||||
|
- perf: improve `Accept-Language` parsing speed
|
||||||
|
|
||||||
|
1.3.2 / 2016-03-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.10
|
||||||
|
- Fix extension of `application/dash+xml`
|
||||||
|
- Update primary extension for `audio/mp4`
|
||||||
|
- deps: mime-db@~1.22.0
|
||||||
|
|
||||||
|
1.3.1 / 2016-01-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.9
|
||||||
|
- deps: mime-db@~1.21.0
|
||||||
|
|
||||||
|
1.3.0 / 2015-09-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.7
|
||||||
|
- deps: mime-db@~1.19.0
|
||||||
|
* deps: negotiator@0.6.0
|
||||||
|
- Fix including type extensions in parameters in `Accept` parsing
|
||||||
|
- Fix parsing `Accept` parameters with quoted equals
|
||||||
|
- Fix parsing `Accept` parameters with quoted semicolons
|
||||||
|
- Lazy-load modules from main entry point
|
||||||
|
- perf: delay type concatenation until needed
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: hoist regular expressions
|
||||||
|
- perf: remove closures getting spec properties
|
||||||
|
- perf: remove a closure from media type parsing
|
||||||
|
- perf: remove property delete from media type parsing
|
||||||
|
|
||||||
|
1.2.13 / 2015-09-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.6
|
||||||
|
- deps: mime-db@~1.18.0
|
||||||
|
|
||||||
|
1.2.12 / 2015-07-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.4
|
||||||
|
- deps: mime-db@~1.16.0
|
||||||
|
|
||||||
|
1.2.11 / 2015-07-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.3
|
||||||
|
- deps: mime-db@~1.15.0
|
||||||
|
|
||||||
|
1.2.10 / 2015-07-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.2
|
||||||
|
- deps: mime-db@~1.14.0
|
||||||
|
|
||||||
|
1.2.9 / 2015-06-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.1
|
||||||
|
- perf: fix deopt during mapping
|
||||||
|
|
||||||
|
1.2.8 / 2015-06-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.0
|
||||||
|
- deps: mime-db@~1.13.0
|
||||||
|
* perf: avoid argument reassignment & argument slice
|
||||||
|
* perf: avoid negotiator recursive construction
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove unnecessary bitwise operator
|
||||||
|
|
||||||
|
1.2.7 / 2015-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.3
|
||||||
|
- Fix media type parameter matching to be case-insensitive
|
||||||
|
|
||||||
|
1.2.6 / 2015-05-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.11
|
||||||
|
- deps: mime-db@~1.9.1
|
||||||
|
* deps: negotiator@0.5.2
|
||||||
|
- Fix comparing media types with quoted values
|
||||||
|
- Fix splitting media types with quoted commas
|
||||||
|
|
||||||
|
1.2.5 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.10
|
||||||
|
- deps: mime-db@~1.8.0
|
||||||
|
|
||||||
|
1.2.4 / 2015-02-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support Node.js 0.6
|
||||||
|
* deps: mime-types@~2.0.9
|
||||||
|
- deps: mime-db@~1.7.0
|
||||||
|
* deps: negotiator@0.5.1
|
||||||
|
- Fix preference sorting to be stable for long acceptable lists
|
||||||
|
|
||||||
|
1.2.3 / 2015-01-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.8
|
||||||
|
- deps: mime-db@~1.6.0
|
||||||
|
|
||||||
|
1.2.2 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.7
|
||||||
|
- deps: mime-db@~1.5.0
|
||||||
|
|
||||||
|
1.2.1 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.5
|
||||||
|
- deps: mime-db@~1.3.1
|
||||||
|
|
||||||
|
1.2.0 / 2014-12-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.0
|
||||||
|
- Fix list return order when large accepted list
|
||||||
|
- Fix missing identity encoding when q=0 exists
|
||||||
|
- Remove dynamic building of Negotiator class
|
||||||
|
|
||||||
|
1.1.4 / 2014-12-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.4
|
||||||
|
- deps: mime-db@~1.3.0
|
||||||
|
|
||||||
|
1.1.3 / 2014-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.3
|
||||||
|
- deps: mime-db@~1.2.0
|
||||||
|
|
||||||
|
1.1.2 / 2014-10-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.9
|
||||||
|
- Fix error when media type has invalid parameter
|
||||||
|
|
||||||
|
1.1.1 / 2014-09-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.2
|
||||||
|
- deps: mime-db@~1.1.0
|
||||||
|
* deps: negotiator@0.4.8
|
||||||
|
- Fix all negotiations to be case-insensitive
|
||||||
|
- Stable sort preferences of same quality according to client order
|
||||||
|
|
||||||
|
1.1.0 / 2014-09-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* update `mime-types`
|
||||||
|
|
||||||
|
1.0.7 / 2014-07-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix wrong type returned from `type` when match after unknown extension
|
||||||
|
|
||||||
|
1.0.6 / 2014-06-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.7
|
||||||
|
|
||||||
|
1.0.5 / 2014-06-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix crash when unknown extension given
|
||||||
|
|
||||||
|
1.0.4 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `mime-types`
|
||||||
|
|
||||||
|
1.0.3 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.6
|
||||||
|
- Order by specificity when quality is the same
|
||||||
|
|
||||||
|
1.0.2 / 2014-05-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix interpretation when header not in request
|
||||||
|
* deps: pin negotiator@0.4.5
|
||||||
|
|
||||||
|
1.0.1 / 2014-01-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Identity encoding isn't always acceptable
|
||||||
|
* deps: negotiator@~0.4.0
|
||||||
|
|
||||||
|
1.0.0 / 2013-12-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Genesis
|
23
code/code/node_modules/accepts/LICENSE
generated
vendored
Normal file
23
code/code/node_modules/accepts/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
142
code/code/node_modules/accepts/README.md
generated
vendored
Normal file
142
code/code/node_modules/accepts/README.md
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
# accepts
|
||||||
|
|
||||||
|
[![NPM Version][npm-version-image]][npm-url]
|
||||||
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||||
|
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||||
|
|
||||||
|
In addition to negotiator, it allows:
|
||||||
|
|
||||||
|
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||||
|
as well as `('text/html', 'application/json')`.
|
||||||
|
- Allows type shorthands such as `json`.
|
||||||
|
- Returns `false` when no types match
|
||||||
|
- Treats non-existent headers as `*`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install accepts
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
```
|
||||||
|
|
||||||
|
### accepts(req)
|
||||||
|
|
||||||
|
Create a new `Accepts` object for the given `req`.
|
||||||
|
|
||||||
|
#### .charset(charsets)
|
||||||
|
|
||||||
|
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .charsets()
|
||||||
|
|
||||||
|
Return the charsets that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .encoding(encodings)
|
||||||
|
|
||||||
|
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .encodings()
|
||||||
|
|
||||||
|
Return the encodings that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .language(languages)
|
||||||
|
|
||||||
|
Return the first accepted language. If nothing in `languages` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .languages()
|
||||||
|
|
||||||
|
Return the languages that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .type(types)
|
||||||
|
|
||||||
|
Return the first accepted type (and it is returned as the same text as what
|
||||||
|
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||||
|
is returned.
|
||||||
|
|
||||||
|
The `types` array can contain full MIME types or file extensions. Any value
|
||||||
|
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||||
|
|
||||||
|
#### .types()
|
||||||
|
|
||||||
|
Return the types that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Simple type negotiation
|
||||||
|
|
||||||
|
This simple example shows how to use `accepts` to return a different typed
|
||||||
|
respond body based on what the client wants to accept. The server lists it's
|
||||||
|
preferences in order and will get back the best match between the client and
|
||||||
|
server.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
var http = require('http')
|
||||||
|
|
||||||
|
function app (req, res) {
|
||||||
|
var accept = accepts(req)
|
||||||
|
|
||||||
|
// the order of this list is significant; should be server preferred order
|
||||||
|
switch (accept.type(['json', 'html'])) {
|
||||||
|
case 'json':
|
||||||
|
res.setHeader('Content-Type', 'application/json')
|
||||||
|
res.write('{"hello":"world!"}')
|
||||||
|
break
|
||||||
|
case 'html':
|
||||||
|
res.setHeader('Content-Type', 'text/html')
|
||||||
|
res.write('<b>hello, world!</b>')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// the fallback is text/plain, so no need to specify it above
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('hello, world!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
http.createServer(app).listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test this out with the cURL program:
|
||||||
|
```sh
|
||||||
|
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||||
|
[npm-url]: https://npmjs.org/package/accepts
|
||||||
|
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/accepts
|
238
code/code/node_modules/accepts/index.js
generated
vendored
Normal file
238
code/code/node_modules/accepts/index.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
/*!
|
||||||
|
* accepts
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Negotiator = require('negotiator')
|
||||||
|
var mime = require('mime-types')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = Accepts
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Accepts object for the given req.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Accepts (req) {
|
||||||
|
if (!(this instanceof Accepts)) {
|
||||||
|
return new Accepts(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.headers = req.headers
|
||||||
|
this.negotiator = new Negotiator(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given `type(s)` is acceptable, returning
|
||||||
|
* the best match when true, otherwise `undefined`, in which
|
||||||
|
* case you should respond with 406 "Not Acceptable".
|
||||||
|
*
|
||||||
|
* The `type` value may be a single mime type string
|
||||||
|
* such as "application/json", the extension name
|
||||||
|
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||||
|
* or array is given the _best_ match, if any is returned.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* // Accept: text/html
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
* this.types('text/html');
|
||||||
|
* // => "text/html"
|
||||||
|
* this.types('json', 'text');
|
||||||
|
* // => "json"
|
||||||
|
* this.types('application/json');
|
||||||
|
* // => "application/json"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('image/png');
|
||||||
|
* this.types('png');
|
||||||
|
* // => undefined
|
||||||
|
*
|
||||||
|
* // Accept: text/*;q=.5, application/json
|
||||||
|
* this.types(['html', 'json']);
|
||||||
|
* this.types('html', 'json');
|
||||||
|
* // => "json"
|
||||||
|
*
|
||||||
|
* @param {String|Array} types...
|
||||||
|
* @return {String|Array|Boolean}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.type =
|
||||||
|
Accepts.prototype.types = function (types_) {
|
||||||
|
var types = types_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (types && !Array.isArray(types)) {
|
||||||
|
types = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < types.length; i++) {
|
||||||
|
types[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no types, return all requested types
|
||||||
|
if (!types || types.length === 0) {
|
||||||
|
return this.negotiator.mediaTypes()
|
||||||
|
}
|
||||||
|
|
||||||
|
// no accept header, return first given type
|
||||||
|
if (!this.headers.accept) {
|
||||||
|
return types[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
var mimes = types.map(extToMime)
|
||||||
|
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||||
|
var first = accepts[0]
|
||||||
|
|
||||||
|
return first
|
||||||
|
? types[mimes.indexOf(first)]
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted encodings or best fit based on `encodings`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Encoding: gzip, deflate`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['gzip', 'deflate']
|
||||||
|
*
|
||||||
|
* @param {String|Array} encodings...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.encoding =
|
||||||
|
Accepts.prototype.encodings = function (encodings_) {
|
||||||
|
var encodings = encodings_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (encodings && !Array.isArray(encodings)) {
|
||||||
|
encodings = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < encodings.length; i++) {
|
||||||
|
encodings[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no encodings, return all requested encodings
|
||||||
|
if (!encodings || encodings.length === 0) {
|
||||||
|
return this.negotiator.encodings()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.encodings(encodings)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted charsets or best fit based on `charsets`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||||
|
*
|
||||||
|
* @param {String|Array} charsets...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.charset =
|
||||||
|
Accepts.prototype.charsets = function (charsets_) {
|
||||||
|
var charsets = charsets_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (charsets && !Array.isArray(charsets)) {
|
||||||
|
charsets = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < charsets.length; i++) {
|
||||||
|
charsets[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no charsets, return all requested charsets
|
||||||
|
if (!charsets || charsets.length === 0) {
|
||||||
|
return this.negotiator.charsets()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.charsets(charsets)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted languages or best fit based on `langs`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['es', 'pt', 'en']
|
||||||
|
*
|
||||||
|
* @param {String|Array} langs...
|
||||||
|
* @return {Array|String}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.lang =
|
||||||
|
Accepts.prototype.langs =
|
||||||
|
Accepts.prototype.language =
|
||||||
|
Accepts.prototype.languages = function (languages_) {
|
||||||
|
var languages = languages_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (languages && !Array.isArray(languages)) {
|
||||||
|
languages = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < languages.length; i++) {
|
||||||
|
languages[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no languages, return all requested languages
|
||||||
|
if (!languages || languages.length === 0) {
|
||||||
|
return this.negotiator.languages()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.languages(languages)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert extnames to mime.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extToMime (type) {
|
||||||
|
return type.indexOf('/') === -1
|
||||||
|
? mime.lookup(type)
|
||||||
|
: type
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if mime is valid.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validMime (type) {
|
||||||
|
return typeof type === 'string'
|
||||||
|
}
|
86
code/code/node_modules/accepts/package.json
generated
vendored
Normal file
86
code/code/node_modules/accepts/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"_from": "accepts@~1.3.7",
|
||||||
|
"_id": "accepts@1.3.7",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||||
|
"_location": "/accepts",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "accepts@~1.3.7",
|
||||||
|
"name": "accepts",
|
||||||
|
"escapedName": "accepts",
|
||||||
|
"rawSpec": "~1.3.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "~1.3.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
|
"_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
|
||||||
|
"_spec": "accepts@~1.3.7",
|
||||||
|
"_where": "C:\\Users\\ittnerpa60944\\source\\repos\\MDTWebApp\\code\\code\\node_modules\\express",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/accepts/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Douglas Christopher Wilson",
|
||||||
|
"email": "doug@somethingdoug.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonathan Ong",
|
||||||
|
"email": "me@jongleberry.com",
|
||||||
|
"url": "http://jongleberry.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "~2.1.24",
|
||||||
|
"negotiator": "0.6.2"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Higher-level content negotiation",
|
||||||
|
"devDependencies": {
|
||||||
|
"deep-equal": "1.0.1",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.17.2",
|
||||||
|
"eslint-plugin-markdown": "1.0.0",
|
||||||
|
"eslint-plugin-node": "8.0.1",
|
||||||
|
"eslint-plugin-promise": "4.1.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"mocha": "6.1.4",
|
||||||
|
"nyc": "14.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"HISTORY.md",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/accepts#readme",
|
||||||
|
"keywords": [
|
||||||
|
"content",
|
||||||
|
"negotiation",
|
||||||
|
"accept",
|
||||||
|
"accepts"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "accepts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/accepts.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||||
|
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||||
|
"test-travis": "nyc --reporter=text npm test"
|
||||||
|
},
|
||||||
|
"version": "1.3.7"
|
||||||
|
}
|
21
code/code/node_modules/array-flatten/LICENSE
generated
vendored
Normal file
21
code/code/node_modules/array-flatten/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
43
code/code/node_modules/array-flatten/README.md
generated
vendored
Normal file
43
code/code/node_modules/array-flatten/README.md
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Array Flatten
|
||||||
|
|
||||||
|
[![NPM version][npm-image]][npm-url]
|
||||||
|
[![NPM downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build status][travis-image]][travis-url]
|
||||||
|
[![Test coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install array-flatten --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var flatten = require('array-flatten')
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
||||||
|
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
|
||||||
|
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
||||||
|
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
flatten(arguments) //=> [1, 2, 3]
|
||||||
|
})(1, [2, 3])
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
||||||
|
[npm-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
||||||
|
[downloads-url]: https://npmjs.org/package/array-flatten
|
||||||
|
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
||||||
|
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
64
code/code/node_modules/array-flatten/array-flatten.js
generated
vendored
Normal file
64
code/code/node_modules/array-flatten/array-flatten.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose `arrayFlatten`.
|
||||||
|
*/
|
||||||
|
module.exports = arrayFlatten
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function with depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenWithDepth (array, result, depth) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (depth > 0 && Array.isArray(value)) {
|
||||||
|
flattenWithDepth(value, result, depth - 1)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive flatten function. Omitting depth is slightly faster.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Array} result
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function flattenForever (array, result) {
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var value = array[i]
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
flattenForever(value, result)
|
||||||
|
} else {
|
||||||
|
result.push(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flatten an array, with the ability to define a depth.
|
||||||
|
*
|
||||||
|
* @param {Array} array
|
||||||
|
* @param {Number} depth
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function arrayFlatten (array, depth) {
|
||||||
|
if (depth == null) {
|
||||||
|
return flattenForever(array, [])
|
||||||
|
}
|
||||||
|
|
||||||
|
return flattenWithDepth(array, [], depth)
|
||||||
|
}
|
64
code/code/node_modules/array-flatten/package.json
generated
vendored
Normal file
64
code/code/node_modules/array-flatten/package.json
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"_from": "array-flatten@1.1.1",
|
||||||
|
"_id": "array-flatten@1.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
|
||||||
|
"_location": "/array-flatten",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "array-flatten@1.1.1",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"escapedName": "array-flatten",
|
||||||
|
"rawSpec": "1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/express"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
|
"_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
|
||||||
|
"_spec": "array-flatten@1.1.1",
|
||||||
|
"_where": "C:\\Users\\ittnerpa60944\\source\\repos\\MDTWebApp\\code\\code\\node_modules\\express",
|
||||||
|
"author": {
|
||||||
|
"name": "Blake Embrey",
|
||||||
|
"email": "hello@blakeembrey.com",
|
||||||
|
"url": "http://blakeembrey.me"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Flatten an array of nested arrays into a single flat array",
|
||||||
|
"devDependencies": {
|
||||||
|
"istanbul": "^0.3.13",
|
||||||
|
"mocha": "^2.2.4",
|
||||||
|
"pre-commit": "^1.0.7",
|
||||||
|
"standard": "^3.7.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"array-flatten.js",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/blakeembrey/array-flatten",
|
||||||
|
"keywords": [
|
||||||
|
"array",
|
||||||
|
"flatten",
|
||||||
|
"arguments",
|
||||||
|
"depth"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "array-flatten.js",
|
||||||
|
"name": "array-flatten",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/blakeembrey/array-flatten.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "istanbul cover _mocha -- -R spec"
|
||||||
|
},
|
||||||
|
"version": "1.1.1"
|
||||||
|
}
|
125
code/code/node_modules/async/CHANGELOG.md
generated
vendored
Normal file
125
code/code/node_modules/async/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
# v1.5.2
|
||||||
|
- Allow using `"consructor"` as an argument in `memoize` (#998)
|
||||||
|
- Give a better error messsage when `auto` dependency checking fails (#994)
|
||||||
|
- Various doc updates (#936, #956, #979, #1002)
|
||||||
|
|
||||||
|
# v1.5.1
|
||||||
|
- Fix issue with `pause` in `queue` with concurrency enabled (#946)
|
||||||
|
- `while` and `until` now pass the final result to callback (#963)
|
||||||
|
- `auto` will properly handle concurrency when there is no callback (#966)
|
||||||
|
- `auto` will now properly stop execution when an error occurs (#988, #993)
|
||||||
|
- Various doc fixes (#971, #980)
|
||||||
|
|
||||||
|
# v1.5.0
|
||||||
|
|
||||||
|
- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) (#892)
|
||||||
|
- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. (#873)
|
||||||
|
- `auto` now accepts an optional `concurrency` argument to limit the number of running tasks (#637)
|
||||||
|
- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891)
|
||||||
|
- Various code simplifications (#896, #904)
|
||||||
|
- Various doc fixes :scroll: (#890, #894, #903, #905, #912)
|
||||||
|
|
||||||
|
# v1.4.2
|
||||||
|
|
||||||
|
- Ensure coverage files don't get published on npm (#879)
|
||||||
|
|
||||||
|
# v1.4.1
|
||||||
|
|
||||||
|
- Add in overlooked `detectLimit` method (#866)
|
||||||
|
- Removed unnecessary files from npm releases (#861)
|
||||||
|
- Removed usage of a reserved word to prevent :boom: in older environments (#870)
|
||||||
|
|
||||||
|
# v1.4.0
|
||||||
|
|
||||||
|
- `asyncify` now supports promises (#840)
|
||||||
|
- Added `Limit` versions of `filter` and `reject` (#836)
|
||||||
|
- Add `Limit` versions of `detect`, `some` and `every` (#828, #829)
|
||||||
|
- `some`, `every` and `detect` now short circuit early (#828, #829)
|
||||||
|
- Improve detection of the global object (#804), enabling use in WebWorkers
|
||||||
|
- `whilst` now called with arguments from iterator (#823)
|
||||||
|
- `during` now gets called with arguments from iterator (#824)
|
||||||
|
- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.3.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
- Added `constant`
|
||||||
|
- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. (#671, #806)
|
||||||
|
- Added `during` and `doDuring`, which are like `whilst` with an async truth test. (#800)
|
||||||
|
- `retry` now accepts an `interval` parameter to specify a delay between retries. (#793)
|
||||||
|
- `async` should work better in Web Workers due to better `root` detection (#804)
|
||||||
|
- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` (#642)
|
||||||
|
- Various internal updates (#786, #801, #802, #803)
|
||||||
|
- Various doc fixes (#790, #794)
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. (#740, #744, #783)
|
||||||
|
|
||||||
|
|
||||||
|
# v1.2.1
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
|
||||||
|
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782)
|
||||||
|
|
||||||
|
|
||||||
|
# v1.2.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
- Added `timesLimit` (#743)
|
||||||
|
- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. (#747, #772)
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #777)
|
||||||
|
|
||||||
|
|
||||||
|
# v1.1.1
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
|
||||||
|
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782)
|
||||||
|
|
||||||
|
|
||||||
|
# v1.1.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
- `cargo` now supports all of the same methods and event callbacks as `queue`.
|
||||||
|
- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. (#769)
|
||||||
|
- Optimized `map`, `eachOf`, and `waterfall` families of functions
|
||||||
|
- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array (#667).
|
||||||
|
- The callback is now optional for the composed results of `compose` and `seq`. (#618)
|
||||||
|
- Reduced file size by 4kb, (minified version by 1kb)
|
||||||
|
- Added code coverage through `nyc` and `coveralls` (#768)
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
- `forever` will no longer stack overflow with a synchronous iterator (#622)
|
||||||
|
- `eachLimit` and other limit functions will stop iterating once an error occurs (#754)
|
||||||
|
- Always pass `null` in callbacks when there is no error (#439)
|
||||||
|
- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668)
|
||||||
|
- `each` and family will properly handle an empty array (#578)
|
||||||
|
- `eachSeries` and family will finish if the underlying array is modified during execution (#557)
|
||||||
|
- `queue` will throw if a non-function is passed to `q.push()` (#593)
|
||||||
|
- Doc fixes (#629, #766)
|
||||||
|
|
||||||
|
|
||||||
|
# v1.0.0
|
||||||
|
|
||||||
|
No known breaking changes, we are simply complying with semver from here on out.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Start using a changelog!
|
||||||
|
- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) (#168 #704 #321)
|
||||||
|
- Detect deadlocks in `auto` (#663)
|
||||||
|
- Better support for require.js (#527)
|
||||||
|
- Throw if queue created with concurrency `0` (#714)
|
||||||
|
- Fix unneeded iteration in `queue.resume()` (#758)
|
||||||
|
- Guard against timer mocking overriding `setImmediate` (#609 #611)
|
||||||
|
- Miscellaneous doc fixes (#542 #596 #615 #628 #631 #690 #729)
|
||||||
|
- Use single noop function internally (#546)
|
||||||
|
- Optimize internal `_each`, `_map` and `_keys` functions.
|
19
code/code/node_modules/async/LICENSE
generated
vendored
Normal file
19
code/code/node_modules/async/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2010-2014 Caolan McMahon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
1877
code/code/node_modules/async/README.md
generated
vendored
Normal file
1877
code/code/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1265
code/code/node_modules/async/dist/async.js
generated
vendored
Normal file
1265
code/code/node_modules/async/dist/async.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
code/code/node_modules/async/dist/async.min.js
generated
vendored
Normal file
2
code/code/node_modules/async/dist/async.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1265
code/code/node_modules/async/lib/async.js
generated
vendored
Normal file
1265
code/code/node_modules/async/lib/async.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
113
code/code/node_modules/async/package.json
generated
vendored
Normal file
113
code/code/node_modules/async/package.json
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"_from": "async@^1.5.2",
|
||||||
|
"_id": "async@1.5.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
|
||||||
|
"_location": "/async",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "async@^1.5.2",
|
||||||
|
"name": "async",
|
||||||
|
"escapedName": "async",
|
||||||
|
"rawSpec": "^1.5.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.5.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/portfinder"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
|
||||||
|
"_shasum": "ec6a61ae56480c0c3cb241c95618e20892f9672a",
|
||||||
|
"_spec": "async@^1.5.2",
|
||||||
|
"_where": "C:\\Users\\ittnerpa60944\\source\\repos\\MDTWebApp\\code\\code\\node_modules\\portfinder",
|
||||||
|
"author": {
|
||||||
|
"name": "Caolan McMahon"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/caolan/async/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||||
|
"devDependencies": {
|
||||||
|
"benchmark": "github:bestiejs/benchmark.js",
|
||||||
|
"bluebird": "^2.9.32",
|
||||||
|
"chai": "^3.1.0",
|
||||||
|
"coveralls": "^2.11.2",
|
||||||
|
"es6-promise": "^2.3.0",
|
||||||
|
"jscs": "^1.13.1",
|
||||||
|
"jshint": "~2.8.0",
|
||||||
|
"karma": "^0.13.2",
|
||||||
|
"karma-browserify": "^4.2.1",
|
||||||
|
"karma-firefox-launcher": "^0.1.6",
|
||||||
|
"karma-mocha": "^0.2.0",
|
||||||
|
"karma-mocha-reporter": "^1.0.2",
|
||||||
|
"lodash": "^3.9.0",
|
||||||
|
"mkdirp": "~0.5.1",
|
||||||
|
"mocha": "^2.2.5",
|
||||||
|
"native-promise-only": "^0.8.0-a",
|
||||||
|
"nodeunit": ">0.0.0",
|
||||||
|
"nyc": "^2.1.0",
|
||||||
|
"rsvp": "^3.0.18",
|
||||||
|
"semver": "^4.3.6",
|
||||||
|
"uglify-js": "~2.4.0",
|
||||||
|
"xyz": "^0.5.0",
|
||||||
|
"yargs": "~3.9.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"dist/async.js",
|
||||||
|
"dist/async.min.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/caolan/async#readme",
|
||||||
|
"jam": {
|
||||||
|
"main": "lib/async.js",
|
||||||
|
"include": [
|
||||||
|
"lib/async.js",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
"Utilities"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"async",
|
||||||
|
"callback",
|
||||||
|
"utility",
|
||||||
|
"module"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/async.js",
|
||||||
|
"name": "async",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/caolan/async.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"coverage": "nyc npm test && nyc report",
|
||||||
|
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
|
||||||
|
"lint": "jshint lib/*.js test/*.js perf/*.js && jscs lib/*.js test/*.js perf/*.js",
|
||||||
|
"mocha-browser-test": "karma start",
|
||||||
|
"mocha-node-test": "mocha mocha_test/",
|
||||||
|
"mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
|
||||||
|
"nodeunit-test": "nodeunit test/test-async.js",
|
||||||
|
"test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test"
|
||||||
|
},
|
||||||
|
"spm": {
|
||||||
|
"main": "lib/async.js"
|
||||||
|
},
|
||||||
|
"version": "1.5.2",
|
||||||
|
"volo": {
|
||||||
|
"main": "lib/async.js",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
609
code/code/node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
609
code/code/node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,609 @@
|
|||||||
|
1.19.0 / 2019-04-25
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@3.1.0
|
||||||
|
- Add petabyte (`pb`) support
|
||||||
|
* deps: http-errors@1.7.2
|
||||||
|
- Set constructor name when possible
|
||||||
|
- deps: setprototypeof@1.1.1
|
||||||
|
- deps: statuses@'>= 1.5.0 < 2'
|
||||||
|
* deps: iconv-lite@0.4.24
|
||||||
|
- Added encoding MIK
|
||||||
|
* deps: qs@6.7.0
|
||||||
|
- Fix parsing array brackets after index
|
||||||
|
* deps: raw-body@2.4.0
|
||||||
|
- deps: bytes@3.1.0
|
||||||
|
- deps: http-errors@1.7.2
|
||||||
|
- deps: iconv-lite@0.4.24
|
||||||
|
* deps: type-is@~1.6.17
|
||||||
|
- deps: mime-types@~2.1.24
|
||||||
|
- perf: prevent internal `throw` on invalid type
|
||||||
|
|
||||||
|
1.18.3 / 2018-05-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix stack trace for strict json parse error
|
||||||
|
* deps: depd@~1.1.2
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
* deps: http-errors@~1.6.3
|
||||||
|
- deps: depd@~1.1.2
|
||||||
|
- deps: setprototypeof@1.1.0
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.23
|
||||||
|
- Fix loading encoding with year appended
|
||||||
|
- Fix deprecation warnings on Node.js 10+
|
||||||
|
* deps: qs@6.5.2
|
||||||
|
* deps: raw-body@2.3.3
|
||||||
|
- deps: http-errors@1.6.3
|
||||||
|
- deps: iconv-lite@0.4.23
|
||||||
|
* deps: type-is@~1.6.16
|
||||||
|
- deps: mime-types@~2.1.18
|
||||||
|
|
||||||
|
1.18.2 / 2017-09-22
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.9
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.18.1 / 2017-09-12
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: content-type@~1.0.4
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
- perf: skip parameter parsing when no parameters
|
||||||
|
* deps: iconv-lite@0.4.19
|
||||||
|
- Fix ISO-8859-1 regression
|
||||||
|
- Update Windows-1255
|
||||||
|
* deps: qs@6.5.1
|
||||||
|
- Fix parsing & compacting very deep objects
|
||||||
|
* deps: raw-body@2.3.2
|
||||||
|
- deps: iconv-lite@0.4.19
|
||||||
|
|
||||||
|
1.18.0 / 2017-09-08
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict violation error to match native parse error
|
||||||
|
* Include the `body` property on verify errors
|
||||||
|
* Include the `type` property on all generated errors
|
||||||
|
* Use `http-errors` to set status code on errors
|
||||||
|
* deps: bytes@3.0.0
|
||||||
|
* deps: debug@2.6.8
|
||||||
|
* deps: depd@~1.1.1
|
||||||
|
- Remove unnecessary `Buffer` loading
|
||||||
|
* deps: http-errors@~1.6.2
|
||||||
|
- deps: depd@1.1.1
|
||||||
|
* deps: iconv-lite@0.4.18
|
||||||
|
- Add support for React Native
|
||||||
|
- Add a warning if not loaded as utf-8
|
||||||
|
- Fix CESU-8 decoding in Node.js 8
|
||||||
|
- Improve speed of ISO-8859-1 encoding
|
||||||
|
* deps: qs@6.5.0
|
||||||
|
* deps: raw-body@2.3.1
|
||||||
|
- Use `http-errors` for standard emitted errors
|
||||||
|
- deps: bytes@3.0.0
|
||||||
|
- deps: iconv-lite@0.4.18
|
||||||
|
- perf: skip buffer decoding on overage chunk
|
||||||
|
* perf: prevent internal `throw` when missing charset
|
||||||
|
|
||||||
|
1.17.2 / 2017-05-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.7
|
||||||
|
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||||
|
- deps: ms@2.0.0
|
||||||
|
* deps: type-is@~1.6.15
|
||||||
|
- deps: mime-types@~2.1.15
|
||||||
|
|
||||||
|
1.17.1 / 2017-03-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@6.4.0
|
||||||
|
- Fix regression parsing keys starting with `[`
|
||||||
|
|
||||||
|
1.17.0 / 2017-03-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.6.1
|
||||||
|
- Make `message` property enumerable for `HttpError`s
|
||||||
|
- deps: setprototypeof@1.0.3
|
||||||
|
* deps: qs@6.3.1
|
||||||
|
- Fix compacting nested arrays
|
||||||
|
|
||||||
|
1.16.1 / 2017-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.1
|
||||||
|
- Fix deprecation messages in WebStorm and other editors
|
||||||
|
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
||||||
|
|
||||||
|
1.16.0 / 2017-01-17
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@2.6.0
|
||||||
|
- Allow colors in workers
|
||||||
|
- Deprecated `DEBUG_FD` environment variable
|
||||||
|
- Fix error when running under React Native
|
||||||
|
- Use same color for same namespace
|
||||||
|
- deps: ms@0.7.2
|
||||||
|
* deps: http-errors@~1.5.1
|
||||||
|
- deps: inherits@2.0.3
|
||||||
|
- deps: setprototypeof@1.0.2
|
||||||
|
- deps: statuses@'>= 1.3.1 < 2'
|
||||||
|
* deps: iconv-lite@0.4.15
|
||||||
|
- Added encoding MS-31J
|
||||||
|
- Added encoding MS-932
|
||||||
|
- Added encoding MS-936
|
||||||
|
- Added encoding MS-949
|
||||||
|
- Added encoding MS-950
|
||||||
|
- Fix GBK/GB18030 handling of Euro character
|
||||||
|
* deps: qs@6.2.1
|
||||||
|
- Fix array parsing from skipping empty values
|
||||||
|
* deps: raw-body@~2.2.0
|
||||||
|
- deps: iconv-lite@0.4.15
|
||||||
|
* deps: type-is@~1.6.14
|
||||||
|
- deps: mime-types@~2.1.13
|
||||||
|
|
||||||
|
1.15.2 / 2016-06-19
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.4.0
|
||||||
|
* deps: content-type@~1.0.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: http-errors@~1.5.0
|
||||||
|
- Use `setprototypeof` module to replace `__proto__` setting
|
||||||
|
- deps: statuses@'>= 1.3.0 < 2'
|
||||||
|
- perf: enable strict mode
|
||||||
|
* deps: qs@6.2.0
|
||||||
|
* deps: raw-body@~2.1.7
|
||||||
|
- deps: bytes@2.4.0
|
||||||
|
- perf: remove double-cleanup on happy path
|
||||||
|
* deps: type-is@~1.6.13
|
||||||
|
- deps: mime-types@~2.1.11
|
||||||
|
|
||||||
|
1.15.1 / 2016-05-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.3.0
|
||||||
|
- Drop partial bytes on all parsed units
|
||||||
|
- Fix parsing byte string that looks like hex
|
||||||
|
* deps: raw-body@~2.1.6
|
||||||
|
- deps: bytes@2.3.0
|
||||||
|
* deps: type-is@~1.6.12
|
||||||
|
- deps: mime-types@~2.1.10
|
||||||
|
|
||||||
|
1.15.0 / 2016-02-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: http-errors@~1.4.0
|
||||||
|
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||||
|
- deps: inherits@2.0.1
|
||||||
|
- deps: statuses@'>= 1.2.1 < 2'
|
||||||
|
* deps: qs@6.1.0
|
||||||
|
* deps: type-is@~1.6.11
|
||||||
|
- deps: mime-types@~2.1.9
|
||||||
|
|
||||||
|
1.14.2 / 2015-12-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: bytes@2.2.0
|
||||||
|
* deps: iconv-lite@0.4.13
|
||||||
|
* deps: qs@5.2.0
|
||||||
|
* deps: raw-body@~2.1.5
|
||||||
|
- deps: bytes@2.2.0
|
||||||
|
- deps: iconv-lite@0.4.13
|
||||||
|
* deps: type-is@~1.6.10
|
||||||
|
- deps: mime-types@~2.1.8
|
||||||
|
|
||||||
|
1.14.1 / 2015-09-27
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix issue where invalid charset results in 400 when `verify` used
|
||||||
|
* deps: iconv-lite@0.4.12
|
||||||
|
- Fix CESU-8 decoding in Node.js 4.x
|
||||||
|
* deps: raw-body@~2.1.4
|
||||||
|
- Fix masking critical errors from `iconv-lite`
|
||||||
|
- deps: iconv-lite@0.4.12
|
||||||
|
* deps: type-is@~1.6.9
|
||||||
|
- deps: mime-types@~2.1.7
|
||||||
|
|
||||||
|
1.14.0 / 2015-09-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Fix JSON strict parse error to match syntax errors
|
||||||
|
* Provide static `require` analysis in `urlencoded` parser
|
||||||
|
* deps: depd@~1.1.0
|
||||||
|
- Support web browser loading
|
||||||
|
* deps: qs@5.1.0
|
||||||
|
* deps: raw-body@~2.1.3
|
||||||
|
- Fix sync callback when attaching data listener causes sync read
|
||||||
|
* deps: type-is@~1.6.8
|
||||||
|
- Fix type error when given invalid type to match against
|
||||||
|
- deps: mime-types@~2.1.6
|
||||||
|
|
||||||
|
1.13.3 / 2015-07-31
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: type-is@~1.6.6
|
||||||
|
- deps: mime-types@~2.1.4
|
||||||
|
|
||||||
|
1.13.2 / 2015-07-05
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.11
|
||||||
|
* deps: qs@4.0.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix user-visible incompatibilities from 3.1.0
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
* deps: raw-body@~2.1.2
|
||||||
|
- Fix error stack traces to skip `makeError`
|
||||||
|
- deps: iconv-lite@0.4.11
|
||||||
|
* deps: type-is@~1.6.4
|
||||||
|
- deps: mime-types@~2.1.2
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.13.1 / 2015-06-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
||||||
|
|
||||||
|
1.13.0 / 2015-06-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Add `statusCode` property on `Error`s, in addition to `status`
|
||||||
|
* Change `type` default to `application/json` for JSON parser
|
||||||
|
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
||||||
|
* Provide static `require` analysis
|
||||||
|
* Use the `http-errors` module to generate errors
|
||||||
|
* deps: bytes@2.1.0
|
||||||
|
- Slight optimizations
|
||||||
|
* deps: iconv-lite@0.4.10
|
||||||
|
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
||||||
|
- Leading BOM is now removed when decoding
|
||||||
|
* deps: on-finished@~2.3.0
|
||||||
|
- Add defined behavior for HTTP `CONNECT` requests
|
||||||
|
- Add defined behavior for HTTP `Upgrade` requests
|
||||||
|
- deps: ee-first@1.1.1
|
||||||
|
* deps: qs@3.1.0
|
||||||
|
- Fix dropping parameters like `hasOwnProperty`
|
||||||
|
- Fix various parsing edge cases
|
||||||
|
- Parsed object now has `null` prototype
|
||||||
|
* deps: raw-body@~2.1.1
|
||||||
|
- Use `unpipe` module for unpiping requests
|
||||||
|
- deps: iconv-lite@0.4.10
|
||||||
|
* deps: type-is@~1.6.3
|
||||||
|
- deps: mime-types@~2.1.1
|
||||||
|
- perf: reduce try block size
|
||||||
|
- perf: remove bitwise operations
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
* perf: remove delete call
|
||||||
|
|
||||||
|
1.12.4 / 2015-05-10
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.2.0
|
||||||
|
* deps: qs@2.4.2
|
||||||
|
- Fix allowing parameters like `constructor`
|
||||||
|
* deps: on-finished@~2.2.1
|
||||||
|
* deps: raw-body@~2.0.1
|
||||||
|
- Fix a false-positive when unpiping in Node.js 0.8
|
||||||
|
- deps: bytes@2.0.1
|
||||||
|
* deps: type-is@~1.6.2
|
||||||
|
- deps: mime-types@~2.0.11
|
||||||
|
|
||||||
|
1.12.3 / 2015-04-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Slight efficiency improvement when not debugging
|
||||||
|
* deps: depd@~1.0.1
|
||||||
|
* deps: iconv-lite@0.4.8
|
||||||
|
- Add encoding alias UNICODE-1-1-UTF-7
|
||||||
|
* deps: raw-body@1.3.4
|
||||||
|
- Fix hanging callback if request aborts during read
|
||||||
|
- deps: iconv-lite@0.4.8
|
||||||
|
|
||||||
|
1.12.2 / 2015-03-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: qs@2.4.1
|
||||||
|
- Fix error when parameter `hasOwnProperty` is present
|
||||||
|
|
||||||
|
1.12.1 / 2015-03-15
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: debug@~2.1.3
|
||||||
|
- Fix high intensity foreground color for bold
|
||||||
|
- deps: ms@0.7.0
|
||||||
|
* deps: type-is@~1.6.1
|
||||||
|
- deps: mime-types@~2.0.10
|
||||||
|
|
||||||
|
1.12.0 / 2015-02-13
|
||||||
|
===================
|
||||||
|
|
||||||
|
* add `debug` messages
|
||||||
|
* accept a function for the `type` option
|
||||||
|
* use `content-type` to parse `Content-Type` headers
|
||||||
|
* deps: iconv-lite@0.4.7
|
||||||
|
- Gracefully support enumerables on `Object.prototype`
|
||||||
|
* deps: raw-body@1.3.3
|
||||||
|
- deps: iconv-lite@0.4.7
|
||||||
|
* deps: type-is@~1.6.0
|
||||||
|
- fix argument reassignment
|
||||||
|
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
||||||
|
- support wildcard for both type and subtype (`*/*`)
|
||||||
|
- deps: mime-types@~2.0.9
|
||||||
|
|
||||||
|
1.11.0 / 2015-01-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` depth limit infinity
|
||||||
|
* deps: type-is@~1.5.6
|
||||||
|
- deps: mime-types@~2.0.8
|
||||||
|
|
||||||
|
1.10.2 / 2015-01-20
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.6
|
||||||
|
- Fix rare aliases of single-byte encodings
|
||||||
|
* deps: raw-body@1.3.2
|
||||||
|
- deps: iconv-lite@0.4.6
|
||||||
|
|
||||||
|
1.10.1 / 2015-01-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.2.0
|
||||||
|
* deps: type-is@~1.5.5
|
||||||
|
- deps: mime-types@~2.0.7
|
||||||
|
|
||||||
|
1.10.0 / 2014-12-02
|
||||||
|
===================
|
||||||
|
|
||||||
|
* make internal `extended: true` array limit dynamic
|
||||||
|
|
||||||
|
1.9.3 / 2014-11-21
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: iconv-lite@0.4.5
|
||||||
|
- Fix Windows-31J and X-SJIS encoding support
|
||||||
|
* deps: qs@2.3.3
|
||||||
|
- Fix `arrayLimit` behavior
|
||||||
|
* deps: raw-body@1.3.1
|
||||||
|
- deps: iconv-lite@0.4.5
|
||||||
|
* deps: type-is@~1.5.3
|
||||||
|
- deps: mime-types@~2.0.3
|
||||||
|
|
||||||
|
1.9.2 / 2014-10-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.3.2
|
||||||
|
- Fix parsing of mixed objects and values
|
||||||
|
|
||||||
|
1.9.1 / 2014-10-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@~2.1.1
|
||||||
|
- Fix handling of pipelined requests
|
||||||
|
* deps: qs@2.3.0
|
||||||
|
- Fix parsing of mixed implicit and explicit arrays
|
||||||
|
* deps: type-is@~1.5.2
|
||||||
|
- deps: mime-types@~2.0.2
|
||||||
|
|
||||||
|
1.9.0 / 2014-09-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* include the charset in "unsupported charset" error message
|
||||||
|
* include the encoding in "unsupported content encoding" error message
|
||||||
|
* deps: depd@~1.0.0
|
||||||
|
|
||||||
|
1.8.4 / 2014-09-23
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix content encoding to be case-insensitive
|
||||||
|
|
||||||
|
1.8.3 / 2014-09-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.4
|
||||||
|
- Fix issue with object keys starting with numbers truncated
|
||||||
|
|
||||||
|
1.8.2 / 2014-09-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.5
|
||||||
|
|
||||||
|
1.8.1 / 2014-09-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: media-typer@0.3.0
|
||||||
|
* deps: type-is@~1.5.1
|
||||||
|
|
||||||
|
1.8.0 / 2014-09-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make empty-body-handling consistent between chunked requests
|
||||||
|
- empty `json` produces `{}`
|
||||||
|
- empty `raw` produces `new Buffer(0)`
|
||||||
|
- empty `text` produces `''`
|
||||||
|
- empty `urlencoded` produces `{}`
|
||||||
|
* deps: qs@2.2.3
|
||||||
|
- Fix issue where first empty value in array is discarded
|
||||||
|
* deps: type-is@~1.5.0
|
||||||
|
- fix `hasbody` to be true for `content-length: 0`
|
||||||
|
|
||||||
|
1.7.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `parameterLimit` option to `urlencoded` parser
|
||||||
|
* change `urlencoded` extended array limit to 100
|
||||||
|
* respond with 413 when over `parameterLimit` in `urlencoded`
|
||||||
|
|
||||||
|
1.6.7 / 2014-08-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.2
|
||||||
|
- Remove unnecessary cloning
|
||||||
|
|
||||||
|
1.6.6 / 2014-08-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@2.2.0
|
||||||
|
- Array parsing fix
|
||||||
|
- Performance improvements
|
||||||
|
|
||||||
|
1.6.5 / 2014-08-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: on-finished@2.1.0
|
||||||
|
|
||||||
|
1.6.4 / 2014-08-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.2
|
||||||
|
|
||||||
|
1.6.3 / 2014-08-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.1
|
||||||
|
|
||||||
|
1.6.2 / 2014-08-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.2.0
|
||||||
|
- Fix parsing array of objects
|
||||||
|
|
||||||
|
1.6.1 / 2014-08-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.1.0
|
||||||
|
- Accept urlencoded square brackets
|
||||||
|
- Accept empty values in implicit array notation
|
||||||
|
|
||||||
|
1.6.0 / 2014-08-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: qs@1.0.2
|
||||||
|
- Complete rewrite
|
||||||
|
- Limits array length to 20
|
||||||
|
- Limits object depth to 5
|
||||||
|
- Limits parameters to 1,000
|
||||||
|
|
||||||
|
1.5.2 / 2014-07-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.4
|
||||||
|
- Work-around v8 generating empty stack traces
|
||||||
|
|
||||||
|
1.5.1 / 2014-07-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.3
|
||||||
|
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||||
|
|
||||||
|
1.5.0 / 2014-07-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: depd@0.4.2
|
||||||
|
- Add `TRACE_DEPRECATION` environment variable
|
||||||
|
- Remove non-standard grey color from color output
|
||||||
|
- Support `--no-deprecation` argument
|
||||||
|
- Support `--trace-deprecation` argument
|
||||||
|
* deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
* deps: raw-body@1.3.0
|
||||||
|
- deps: iconv-lite@0.4.4
|
||||||
|
- Added encoding UTF-7
|
||||||
|
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
||||||
|
* deps: type-is@~1.3.2
|
||||||
|
|
||||||
|
1.4.3 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.1
|
||||||
|
- fix global variable leak
|
||||||
|
|
||||||
|
1.4.2 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.3.0
|
||||||
|
- improve type parsing
|
||||||
|
|
||||||
|
1.4.1 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix urlencoded extended deprecation message
|
||||||
|
|
||||||
|
1.4.0 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `text` parser
|
||||||
|
* add `raw` parser
|
||||||
|
* check accepted charset in content-type (accepts utf-8)
|
||||||
|
* check accepted encoding in content-encoding (accepts identity)
|
||||||
|
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
||||||
|
* deprecate `urlencoded()` without provided `extended` option
|
||||||
|
* lazy-load urlencoded parsers
|
||||||
|
* parsers split into files for reduced mem usage
|
||||||
|
* support gzip and deflate bodies
|
||||||
|
- set `inflate: false` to turn off
|
||||||
|
* deps: raw-body@1.2.2
|
||||||
|
- Support all encodings from `iconv-lite`
|
||||||
|
|
||||||
|
1.3.1 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: type-is@1.2.1
|
||||||
|
- Switch dependency from mime to mime-types@1.0.0
|
||||||
|
|
||||||
|
1.3.0 / 2014-05-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `extended` option to urlencoded parser
|
||||||
|
|
||||||
|
1.2.2 / 2014-05-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: raw-body@1.1.6
|
||||||
|
- assert stream encoding on node.js 0.8
|
||||||
|
- assert stream encoding on node.js < 0.10.6
|
||||||
|
- deps: bytes@1
|
||||||
|
|
||||||
|
1.2.1 / 2014-05-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* invoke `next(err)` after request fully read
|
||||||
|
- prevents hung responses and socket hang ups
|
||||||
|
|
||||||
|
1.2.0 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `verify` option
|
||||||
|
* deps: type-is@1.2.0
|
||||||
|
- support suffix matching
|
||||||
|
|
||||||
|
1.1.2 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* improve json parser speed
|
||||||
|
|
||||||
|
1.1.1 / 2014-05-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix repeated limit parsing with every request
|
||||||
|
|
||||||
|
1.1.0 / 2014-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `type` option
|
||||||
|
* deps: pin for safety and consistency
|
||||||
|
|
||||||
|
1.0.2 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `type-is` module
|
||||||
|
|
||||||
|
1.0.1 / 2014-03-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* lower default limits to 100kb
|
23
code/code/node_modules/body-parser/LICENSE
generated
vendored
Normal file
23
code/code/node_modules/body-parser/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
443
code/code/node_modules/body-parser/README.md
generated
vendored
Normal file
443
code/code/node_modules/body-parser/README.md
generated
vendored
Normal file
@ -0,0 +1,443 @@
|
|||||||
|
# body-parser
|
||||||
|
|
||||||
|
[![NPM Version][npm-image]][npm-url]
|
||||||
|
[![NPM Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Node.js body parsing middleware.
|
||||||
|
|
||||||
|
Parse incoming request bodies in a middleware before your handlers, available
|
||||||
|
under the `req.body` property.
|
||||||
|
|
||||||
|
**Note** As `req.body`'s shape is based on user-controlled input, all
|
||||||
|
properties and values in this object are untrusted and should be validated
|
||||||
|
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
||||||
|
ways, for example the `foo` property may not be there or may not be a string,
|
||||||
|
and `toString` may not be a function and instead a string or other user input.
|
||||||
|
|
||||||
|
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
||||||
|
|
||||||
|
_This does not handle multipart bodies_, due to their complex and typically
|
||||||
|
large nature. For multipart bodies, you may be interested in the following
|
||||||
|
modules:
|
||||||
|
|
||||||
|
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
||||||
|
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
||||||
|
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
||||||
|
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
||||||
|
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
||||||
|
* [multer](https://www.npmjs.org/package/multer#readme)
|
||||||
|
|
||||||
|
This module provides the following parsers:
|
||||||
|
|
||||||
|
* [JSON body parser](#bodyparserjsonoptions)
|
||||||
|
* [Raw body parser](#bodyparserrawoptions)
|
||||||
|
* [Text body parser](#bodyparsertextoptions)
|
||||||
|
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
||||||
|
|
||||||
|
Other body parsers you might be interested in:
|
||||||
|
|
||||||
|
- [body](https://www.npmjs.org/package/body#readme)
|
||||||
|
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install body-parser
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
```
|
||||||
|
|
||||||
|
The `bodyParser` object exposes various factories to create middlewares. All
|
||||||
|
middlewares will populate the `req.body` property with the parsed body when
|
||||||
|
the `Content-Type` request header matches the `type` option, or an empty
|
||||||
|
object (`{}`) if there was no body to parse, the `Content-Type` was not matched,
|
||||||
|
or an error occurred.
|
||||||
|
|
||||||
|
The various errors returned by this module are described in the
|
||||||
|
[errors section](#errors).
|
||||||
|
|
||||||
|
### bodyParser.json([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `json` and only looks at requests where
|
||||||
|
the `Content-Type` header matches the `type` option. This parser accepts any
|
||||||
|
Unicode encoding of the body and supports automatic inflation of `gzip` and
|
||||||
|
`deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `json` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### reviver
|
||||||
|
|
||||||
|
The `reviver` option is passed directly to `JSON.parse` as the second
|
||||||
|
argument. You can find more information on this argument
|
||||||
|
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter).
|
||||||
|
|
||||||
|
##### strict
|
||||||
|
|
||||||
|
When set to `true`, will only accept arrays and objects; when `false` will
|
||||||
|
accept anything `JSON.parse` accepts. Defaults to `true`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not a
|
||||||
|
function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `json`), a mime type (like `application/json`), or
|
||||||
|
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
||||||
|
value. Defaults to `application/json`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.raw([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
||||||
|
of the body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `raw` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function.
|
||||||
|
If not a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
||||||
|
can be an extension name (like `bin`), a mime type (like
|
||||||
|
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
||||||
|
`application/*`). If a function, the `type` option is called as `fn(req)`
|
||||||
|
and the request is parsed if it returns a truthy value. Defaults to
|
||||||
|
`application/octet-stream`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.text([options])
|
||||||
|
|
||||||
|
Returns middleware that parses all bodies as a string and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` string containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This will be a string of the
|
||||||
|
body.
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `text` function takes an optional `options` object that may contain any of
|
||||||
|
the following keys:
|
||||||
|
|
||||||
|
##### defaultCharset
|
||||||
|
|
||||||
|
Specify the default character set for the text content if the charset is not
|
||||||
|
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
||||||
|
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
||||||
|
option is called as `fn(req)` and the request is parsed if it returns a
|
||||||
|
truthy value. Defaults to `text/plain`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
### bodyParser.urlencoded([options])
|
||||||
|
|
||||||
|
Returns middleware that only parses `urlencoded` bodies and only looks at
|
||||||
|
requests where the `Content-Type` header matches the `type` option. This
|
||||||
|
parser accepts only UTF-8 encoding of the body and supports automatic
|
||||||
|
inflation of `gzip` and `deflate` encodings.
|
||||||
|
|
||||||
|
A new `body` object containing the parsed data is populated on the `request`
|
||||||
|
object after the middleware (i.e. `req.body`). This object will contain
|
||||||
|
key-value pairs, where the value can be a string or array (when `extended` is
|
||||||
|
`false`), or any type (when `extended` is `true`).
|
||||||
|
|
||||||
|
#### Options
|
||||||
|
|
||||||
|
The `urlencoded` function takes an optional `options` object that may contain
|
||||||
|
any of the following keys:
|
||||||
|
|
||||||
|
##### extended
|
||||||
|
|
||||||
|
The `extended` option allows to choose between parsing the URL-encoded data
|
||||||
|
with the `querystring` library (when `false`) or the `qs` library (when
|
||||||
|
`true`). The "extended" syntax allows for rich objects and arrays to be
|
||||||
|
encoded into the URL-encoded format, allowing for a JSON-like experience
|
||||||
|
with URL-encoded. For more information, please
|
||||||
|
[see the qs library](https://www.npmjs.org/package/qs#readme).
|
||||||
|
|
||||||
|
Defaults to `true`, but using the default has been deprecated. Please
|
||||||
|
research into the difference between `qs` and `querystring` and choose the
|
||||||
|
appropriate setting.
|
||||||
|
|
||||||
|
##### inflate
|
||||||
|
|
||||||
|
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||||
|
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||||
|
|
||||||
|
##### limit
|
||||||
|
|
||||||
|
Controls the maximum request body size. If this is a number, then the value
|
||||||
|
specifies the number of bytes; if it is a string, the value is passed to the
|
||||||
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||||
|
to `'100kb'`.
|
||||||
|
|
||||||
|
##### parameterLimit
|
||||||
|
|
||||||
|
The `parameterLimit` option controls the maximum number of parameters that
|
||||||
|
are allowed in the URL-encoded data. If a request contains more parameters
|
||||||
|
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
||||||
|
|
||||||
|
##### type
|
||||||
|
|
||||||
|
The `type` option is used to determine what media type the middleware will
|
||||||
|
parse. This option can be a string, array of strings, or a function. If not
|
||||||
|
a function, `type` option is passed directly to the
|
||||||
|
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||||
|
be an extension name (like `urlencoded`), a mime type (like
|
||||||
|
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
||||||
|
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
||||||
|
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
||||||
|
to `application/x-www-form-urlencoded`.
|
||||||
|
|
||||||
|
##### verify
|
||||||
|
|
||||||
|
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||||
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||||
|
encoding of the request. The parsing can be aborted by throwing an error.
|
||||||
|
|
||||||
|
## Errors
|
||||||
|
|
||||||
|
The middlewares provided by this module create errors depending on the error
|
||||||
|
condition during parsing. The errors will typically have a `status`/`statusCode`
|
||||||
|
property that contains the suggested HTTP response code, an `expose` property
|
||||||
|
to determine if the `message` property should be displayed to the client, a
|
||||||
|
`type` property to determine the type of error without matching against the
|
||||||
|
`message`, and a `body` property containing the read body, if available.
|
||||||
|
|
||||||
|
The following are the common errors emitted, though any error can come through
|
||||||
|
for various reasons.
|
||||||
|
|
||||||
|
### content encoding unsupported
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an encoding but the "inflation" option was set to `false`. The
|
||||||
|
`status` property is set to `415`, the `type` property is set to
|
||||||
|
`'encoding.unsupported'`, and the `charset` property will be set to the
|
||||||
|
encoding that is unsupported.
|
||||||
|
|
||||||
|
### request aborted
|
||||||
|
|
||||||
|
This error will occur when the request is aborted by the client before reading
|
||||||
|
the body has finished. The `received` property will be set to the number of
|
||||||
|
bytes received before the request was aborted and the `expected` property is
|
||||||
|
set to the number of expected bytes. The `status` property is set to `400`
|
||||||
|
and `type` property is set to `'request.aborted'`.
|
||||||
|
|
||||||
|
### request entity too large
|
||||||
|
|
||||||
|
This error will occur when the request body's size is larger than the "limit"
|
||||||
|
option. The `limit` property will be set to the byte limit and the `length`
|
||||||
|
property will be set to the request body's length. The `status` property is
|
||||||
|
set to `413` and the `type` property is set to `'entity.too.large'`.
|
||||||
|
|
||||||
|
### request size did not match content length
|
||||||
|
|
||||||
|
This error will occur when the request's length did not match the length from
|
||||||
|
the `Content-Length` header. This typically occurs when the request is malformed,
|
||||||
|
typically when the `Content-Length` header was calculated based on characters
|
||||||
|
instead of bytes. The `status` property is set to `400` and the `type` property
|
||||||
|
is set to `'request.size.invalid'`.
|
||||||
|
|
||||||
|
### stream encoding should not be set
|
||||||
|
|
||||||
|
This error will occur when something called the `req.setEncoding` method prior
|
||||||
|
to this middleware. This module operates directly on bytes only and you cannot
|
||||||
|
call `req.setEncoding` when using this module. The `status` property is set to
|
||||||
|
`500` and the `type` property is set to `'stream.encoding.set'`.
|
||||||
|
|
||||||
|
### too many parameters
|
||||||
|
|
||||||
|
This error will occur when the content of the request exceeds the configured
|
||||||
|
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
||||||
|
`413` and the `type` property is set to `'parameters.too.many'`.
|
||||||
|
|
||||||
|
### unsupported charset "BOGUS"
|
||||||
|
|
||||||
|
This error will occur when the request had a charset parameter in the
|
||||||
|
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
||||||
|
parser does not support it. The charset is contained in the message as well
|
||||||
|
as in the `charset` property. The `status` property is set to `415`, the
|
||||||
|
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
||||||
|
is set to the charset that is unsupported.
|
||||||
|
|
||||||
|
### unsupported content encoding "bogus"
|
||||||
|
|
||||||
|
This error will occur when the request had a `Content-Encoding` header that
|
||||||
|
contained an unsupported encoding. The encoding is contained in the message
|
||||||
|
as well as in the `encoding` property. The `status` property is set to `415`,
|
||||||
|
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
||||||
|
property is set to the encoding that is unsupported.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Express/Connect top-level generic
|
||||||
|
|
||||||
|
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
||||||
|
top-level middleware, which will parse the bodies of all incoming requests.
|
||||||
|
This is the simplest setup.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse application/x-www-form-urlencoded
|
||||||
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||||||
|
|
||||||
|
// parse application/json
|
||||||
|
app.use(bodyParser.json())
|
||||||
|
|
||||||
|
app.use(function (req, res) {
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('you posted:\n')
|
||||||
|
res.end(JSON.stringify(req.body, null, 2))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Express route-specific
|
||||||
|
|
||||||
|
This example demonstrates adding body parsers specifically to the routes that
|
||||||
|
need them. In general, this is the most recommended way to use body-parser with
|
||||||
|
Express.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// create application/json parser
|
||||||
|
var jsonParser = bodyParser.json()
|
||||||
|
|
||||||
|
// create application/x-www-form-urlencoded parser
|
||||||
|
var urlencodedParser = bodyParser.urlencoded({ extended: false })
|
||||||
|
|
||||||
|
// POST /login gets urlencoded bodies
|
||||||
|
app.post('/login', urlencodedParser, function (req, res) {
|
||||||
|
res.send('welcome, ' + req.body.username)
|
||||||
|
})
|
||||||
|
|
||||||
|
// POST /api/users gets JSON bodies
|
||||||
|
app.post('/api/users', jsonParser, function (req, res) {
|
||||||
|
// create user in req.body
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Change accepted type for parsers
|
||||||
|
|
||||||
|
All the parsers accept a `type` option which allows you to change the
|
||||||
|
`Content-Type` that the middleware will parse.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var express = require('express')
|
||||||
|
var bodyParser = require('body-parser')
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
// parse various different custom JSON types as JSON
|
||||||
|
app.use(bodyParser.json({ type: 'application/*+json' }))
|
||||||
|
|
||||||
|
// parse some custom thing into a Buffer
|
||||||
|
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
||||||
|
|
||||||
|
// parse an HTML body into a string
|
||||||
|
app.use(bodyParser.text({ type: 'text/html' }))
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/body-parser.svg
|
||||||
|
[npm-url]: https://npmjs.org/package/body-parser
|
||||||
|
[travis-image]: https://img.shields.io/travis/expressjs/body-parser/master.svg
|
||||||
|
[travis-url]: https://travis-ci.org/expressjs/body-parser
|
||||||
|
[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg
|
||||||
|
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg
|
||||||
|
[downloads-url]: https://npmjs.org/package/body-parser
|
157
code/code/node_modules/body-parser/index.js
generated
vendored
Normal file
157
code/code/node_modules/body-parser/index.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of loaded parsers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef Parsers
|
||||||
|
* @type {function}
|
||||||
|
* @property {function} json
|
||||||
|
* @property {function} raw
|
||||||
|
* @property {function} text
|
||||||
|
* @property {function} urlencoded
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @type {Parsers}
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = deprecate.function(bodyParser,
|
||||||
|
'bodyParser: use individual json/urlencoded middlewares')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'json', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('json')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raw parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'raw', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('raw')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'text', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('text')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL-encoded parser.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object.defineProperty(exports, 'urlencoded', {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: createParserGetter('urlencoded')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse json and urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @deprecated
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function bodyParser (options) {
|
||||||
|
var opts = {}
|
||||||
|
|
||||||
|
// exclude type option
|
||||||
|
if (options) {
|
||||||
|
for (var prop in options) {
|
||||||
|
if (prop !== 'type') {
|
||||||
|
opts[prop] = options[prop]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _urlencoded = exports.urlencoded(opts)
|
||||||
|
var _json = exports.json(opts)
|
||||||
|
|
||||||
|
return function bodyParser (req, res, next) {
|
||||||
|
_json(req, res, function (err) {
|
||||||
|
if (err) return next(err)
|
||||||
|
_urlencoded(req, res, next)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a getter for loading a parser.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createParserGetter (name) {
|
||||||
|
return function get () {
|
||||||
|
return loadParser(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a parser module.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function loadParser (parserName) {
|
||||||
|
var parser = parsers[parserName]
|
||||||
|
|
||||||
|
if (parser !== undefined) {
|
||||||
|
return parser
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (parserName) {
|
||||||
|
case 'json':
|
||||||
|
parser = require('./lib/types/json')
|
||||||
|
break
|
||||||
|
case 'raw':
|
||||||
|
parser = require('./lib/types/raw')
|
||||||
|
break
|
||||||
|
case 'text':
|
||||||
|
parser = require('./lib/types/text')
|
||||||
|
break
|
||||||
|
case 'urlencoded':
|
||||||
|
parser = require('./lib/types/urlencoded')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
return (parsers[parserName] = parser)
|
||||||
|
}
|
181
code/code/node_modules/body-parser/lib/read.js
generated
vendored
Normal file
181
code/code/node_modules/body-parser/lib/read.js
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var getBody = require('raw-body')
|
||||||
|
var iconv = require('iconv-lite')
|
||||||
|
var onFinished = require('on-finished')
|
||||||
|
var zlib = require('zlib')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = read
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a request into a buffer and parse.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {object} res
|
||||||
|
* @param {function} next
|
||||||
|
* @param {function} parse
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {object} options
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function read (req, res, next, parse, debug, options) {
|
||||||
|
var length
|
||||||
|
var opts = options
|
||||||
|
var stream
|
||||||
|
|
||||||
|
// flag as parsed
|
||||||
|
req._body = true
|
||||||
|
|
||||||
|
// read options
|
||||||
|
var encoding = opts.encoding !== null
|
||||||
|
? opts.encoding
|
||||||
|
: null
|
||||||
|
var verify = opts.verify
|
||||||
|
|
||||||
|
try {
|
||||||
|
// get the content stream
|
||||||
|
stream = contentstream(req, debug, opts.inflate)
|
||||||
|
length = stream.length
|
||||||
|
stream.length = undefined
|
||||||
|
} catch (err) {
|
||||||
|
return next(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set raw-body options
|
||||||
|
opts.length = length
|
||||||
|
opts.encoding = verify
|
||||||
|
? null
|
||||||
|
: encoding
|
||||||
|
|
||||||
|
// assert charset is supported
|
||||||
|
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
||||||
|
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// read body
|
||||||
|
debug('read body')
|
||||||
|
getBody(stream, opts, function (error, body) {
|
||||||
|
if (error) {
|
||||||
|
var _error
|
||||||
|
|
||||||
|
if (error.type === 'encoding.unsupported') {
|
||||||
|
// echo back charset
|
||||||
|
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||||
|
charset: encoding.toLowerCase(),
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// set status code on error
|
||||||
|
_error = createError(400, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// read off entire request
|
||||||
|
stream.resume()
|
||||||
|
onFinished(req, function onfinished () {
|
||||||
|
next(createError(400, _error))
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify
|
||||||
|
if (verify) {
|
||||||
|
try {
|
||||||
|
debug('verify body')
|
||||||
|
verify(req, res, body, encoding)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(403, err, {
|
||||||
|
body: body,
|
||||||
|
type: err.type || 'entity.verify.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse
|
||||||
|
var str = body
|
||||||
|
try {
|
||||||
|
debug('parse body')
|
||||||
|
str = typeof body !== 'string' && encoding !== null
|
||||||
|
? iconv.decode(body, encoding)
|
||||||
|
: body
|
||||||
|
req.body = parse(str)
|
||||||
|
} catch (err) {
|
||||||
|
next(createError(400, err, {
|
||||||
|
body: str,
|
||||||
|
type: err.type || 'entity.parse.failed'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the content stream of the request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @param {function} debug
|
||||||
|
* @param {boolean} [inflate=true]
|
||||||
|
* @return {object}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function contentstream (req, debug, inflate) {
|
||||||
|
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
||||||
|
var length = req.headers['content-length']
|
||||||
|
var stream
|
||||||
|
|
||||||
|
debug('content-encoding "%s"', encoding)
|
||||||
|
|
||||||
|
if (inflate === false && encoding !== 'identity') {
|
||||||
|
throw createError(415, 'content encoding unsupported', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (encoding) {
|
||||||
|
case 'deflate':
|
||||||
|
stream = zlib.createInflate()
|
||||||
|
debug('inflate body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'gzip':
|
||||||
|
stream = zlib.createGunzip()
|
||||||
|
debug('gunzip body')
|
||||||
|
req.pipe(stream)
|
||||||
|
break
|
||||||
|
case 'identity':
|
||||||
|
stream = req
|
||||||
|
stream.length = length
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
||||||
|
encoding: encoding,
|
||||||
|
type: 'encoding.unsupported'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
230
code/code/node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
230
code/code/node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:json')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp to match the first non-space in a string.
|
||||||
|
*
|
||||||
|
* Allowed whitespace is defined in RFC 7159:
|
||||||
|
*
|
||||||
|
* ws = *(
|
||||||
|
* %x20 / ; Space
|
||||||
|
* %x09 / ; Horizontal tab
|
||||||
|
* %x0A / ; Line feed or New line
|
||||||
|
* %x0D ) ; Carriage return
|
||||||
|
*/
|
||||||
|
|
||||||
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse JSON bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function json (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var reviver = opts.reviver
|
||||||
|
var strict = opts.strict !== false
|
||||||
|
var type = opts.type || 'application/json'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
if (body.length === 0) {
|
||||||
|
// special-case empty json body, as it's a common client-side mistake
|
||||||
|
// TODO: maybe make this configurable or part of "strict" option
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strict) {
|
||||||
|
var first = firstchar(body)
|
||||||
|
|
||||||
|
if (first !== '{' && first !== '[') {
|
||||||
|
debug('strict violation')
|
||||||
|
throw createStrictSyntaxError(body, first)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
debug('parse json')
|
||||||
|
return JSON.parse(body, reviver)
|
||||||
|
} catch (e) {
|
||||||
|
throw normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message,
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function jsonParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset per RFC 7159 sec 8.1
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset.substr(0, 4) !== 'utf-') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create strict violation syntax error matching native error.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {string} char
|
||||||
|
* @return {Error}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createStrictSyntaxError (str, char) {
|
||||||
|
var index = str.indexOf(char)
|
||||||
|
var partial = str.substring(0, index) + '#'
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||||
|
} catch (e) {
|
||||||
|
return normalizeJsonSyntaxError(e, {
|
||||||
|
message: e.message.replace('#', char),
|
||||||
|
stack: e.stack
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the first non-whitespace character in a string.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {function}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function firstchar (str) {
|
||||||
|
return FIRST_CHAR_REGEXP.exec(str)[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a SyntaxError for JSON.parse.
|
||||||
|
*
|
||||||
|
* @param {SyntaxError} error
|
||||||
|
* @param {object} obj
|
||||||
|
* @return {SyntaxError}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizeJsonSyntaxError (error, obj) {
|
||||||
|
var keys = Object.getOwnPropertyNames(error)
|
||||||
|
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
var key = keys[i]
|
||||||
|
if (key !== 'stack' && key !== 'message') {
|
||||||
|
delete error[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace stack before message for Node.js 0.10 and below
|
||||||
|
error.stack = obj.stack.replace(error.message, obj.message)
|
||||||
|
error.message = obj.message
|
||||||
|
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
101
code/code/node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
101
code/code/node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var debug = require('debug')('body-parser:raw')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = raw
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse raw bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function raw (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/octet-stream'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function rawParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: null,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
121
code/code/node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
121
code/code/node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var debug = require('debug')('body-parser:text')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = text
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse text bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function text (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
var defaultCharset = opts.defaultCharset || 'utf-8'
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'text/plain'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (buf) {
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
return function textParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// get charset
|
||||||
|
var charset = getCharset(req) || defaultCharset
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
284
code/code/node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
284
code/code/node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
/*!
|
||||||
|
* body-parser
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var bytes = require('bytes')
|
||||||
|
var contentType = require('content-type')
|
||||||
|
var createError = require('http-errors')
|
||||||
|
var debug = require('debug')('body-parser:urlencoded')
|
||||||
|
var deprecate = require('depd')('body-parser')
|
||||||
|
var read = require('../read')
|
||||||
|
var typeis = require('type-is')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = urlencoded
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of parser modules.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var parsers = Object.create(null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a middleware to parse urlencoded bodies.
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @return {function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function urlencoded (options) {
|
||||||
|
var opts = options || {}
|
||||||
|
|
||||||
|
// notice because option default will flip in next major
|
||||||
|
if (opts.extended === undefined) {
|
||||||
|
deprecate('undefined extended: provide extended option')
|
||||||
|
}
|
||||||
|
|
||||||
|
var extended = opts.extended !== false
|
||||||
|
var inflate = opts.inflate !== false
|
||||||
|
var limit = typeof opts.limit !== 'number'
|
||||||
|
? bytes.parse(opts.limit || '100kb')
|
||||||
|
: opts.limit
|
||||||
|
var type = opts.type || 'application/x-www-form-urlencoded'
|
||||||
|
var verify = opts.verify || false
|
||||||
|
|
||||||
|
if (verify !== false && typeof verify !== 'function') {
|
||||||
|
throw new TypeError('option verify must be function')
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the appropriate query parser
|
||||||
|
var queryparse = extended
|
||||||
|
? extendedparser(opts)
|
||||||
|
: simpleparser(opts)
|
||||||
|
|
||||||
|
// create the appropriate type checking function
|
||||||
|
var shouldParse = typeof type !== 'function'
|
||||||
|
? typeChecker(type)
|
||||||
|
: type
|
||||||
|
|
||||||
|
function parse (body) {
|
||||||
|
return body.length
|
||||||
|
? queryparse(body)
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function urlencodedParser (req, res, next) {
|
||||||
|
if (req._body) {
|
||||||
|
debug('body already parsed')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req.body = req.body || {}
|
||||||
|
|
||||||
|
// skip requests without bodies
|
||||||
|
if (!typeis.hasBody(req)) {
|
||||||
|
debug('skip empty body')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('content-type %j', req.headers['content-type'])
|
||||||
|
|
||||||
|
// determine if request should be parsed
|
||||||
|
if (!shouldParse(req)) {
|
||||||
|
debug('skip parsing')
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert charset
|
||||||
|
var charset = getCharset(req) || 'utf-8'
|
||||||
|
if (charset !== 'utf-8') {
|
||||||
|
debug('invalid charset')
|
||||||
|
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||||
|
charset: charset,
|
||||||
|
type: 'charset.unsupported'
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
read(req, res, next, parse, debug, {
|
||||||
|
debug: debug,
|
||||||
|
encoding: charset,
|
||||||
|
inflate: inflate,
|
||||||
|
limit: limit,
|
||||||
|
verify: verify
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the extended query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extendedparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('qs')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var arrayLimit = Math.max(100, paramCount)
|
||||||
|
|
||||||
|
debug('parse extended urlencoding')
|
||||||
|
return parse(body, {
|
||||||
|
allowPrototypes: true,
|
||||||
|
arrayLimit: arrayLimit,
|
||||||
|
depth: Infinity,
|
||||||
|
parameterLimit: parameterLimit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the charset of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getCharset (req) {
|
||||||
|
try {
|
||||||
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the number of parameters, stopping once limit reached
|
||||||
|
*
|
||||||
|
* @param {string} body
|
||||||
|
* @param {number} limit
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parameterCount (body, limit) {
|
||||||
|
var count = 0
|
||||||
|
var index = 0
|
||||||
|
|
||||||
|
while ((index = body.indexOf('&', index)) !== -1) {
|
||||||
|
count++
|
||||||
|
index++
|
||||||
|
|
||||||
|
if (count === limit) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parser for module name dynamically.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @return {function}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parser (name) {
|
||||||
|
var mod = parsers[name]
|
||||||
|
|
||||||
|
if (mod !== undefined) {
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
// this uses a switch for static require analysis
|
||||||
|
switch (name) {
|
||||||
|
case 'qs':
|
||||||
|
mod = require('qs')
|
||||||
|
break
|
||||||
|
case 'querystring':
|
||||||
|
mod = require('querystring')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// store to prevent invoking require()
|
||||||
|
parsers[name] = mod
|
||||||
|
|
||||||
|
return mod.parse
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple query parser.
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
function simpleparser (options) {
|
||||||
|
var parameterLimit = options.parameterLimit !== undefined
|
||||||
|
? options.parameterLimit
|
||||||
|
: 1000
|
||||||
|
var parse = parser('querystring')
|
||||||
|
|
||||||
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||||
|
throw new TypeError('option parameterLimit must be a positive number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(parameterLimit)) {
|
||||||
|
parameterLimit = parameterLimit | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return function queryparse (body) {
|
||||||
|
var paramCount = parameterCount(body, parameterLimit)
|
||||||
|
|
||||||
|
if (paramCount === undefined) {
|
||||||
|
debug('too many parameters')
|
||||||
|
throw createError(413, 'too many parameters', {
|
||||||
|
type: 'parameters.too.many'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('parse urlencoding')
|
||||||
|
return parse(body, undefined, undefined, { maxKeys: parameterLimit })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the simple type checker.
|
||||||
|
*
|
||||||
|
* @param {string} type
|
||||||
|
* @return {function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function typeChecker (type) {
|
||||||
|
return function checkType (req) {
|
||||||
|
return Boolean(typeis(req, type))
|
||||||
|
}
|
||||||
|
}
|
1
code/code/node_modules/body-parser/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
1
code/code/node_modules/body-parser/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
11
code/code/node_modules/body-parser/node_modules/debug/.eslintrc
generated
vendored
Normal file
11
code/code/node_modules/body-parser/node_modules/debug/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0,
|
||||||
|
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended"
|
||||||
|
}
|
9
code/code/node_modules/body-parser/node_modules/debug/.npmignore
generated
vendored
Normal file
9
code/code/node_modules/body-parser/node_modules/debug/.npmignore
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
support
|
||||||
|
test
|
||||||
|
examples
|
||||||
|
example
|
||||||
|
*.sock
|
||||||
|
dist
|
||||||
|
yarn.lock
|
||||||
|
coverage
|
||||||
|
bower.json
|
14
code/code/node_modules/body-parser/node_modules/debug/.travis.yml
generated
vendored
Normal file
14
code/code/node_modules/body-parser/node_modules/debug/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "6"
|
||||||
|
- "5"
|
||||||
|
- "4"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- make node_modules
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make lint
|
||||||
|
- make test
|
||||||
|
- make coveralls
|
362
code/code/node_modules/body-parser/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
362
code/code/node_modules/body-parser/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
|
||||||
|
2.6.9 / 2017-09-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove ReDoS regexp in %o formatter (#504)
|
||||||
|
|
||||||
|
2.6.8 / 2017-05-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||||
|
|
||||||
|
2.6.7 / 2017-05-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||||
|
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||||
|
* Docs: Fix typo (#455, @msasad)
|
||||||
|
|
||||||
|
2.6.5 / 2017-04-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||||
|
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||||
|
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||||
|
|
||||||
|
|
||||||
|
2.6.4 / 2017-04-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||||
|
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||||
|
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||||
|
|
||||||
|
2.6.3 / 2017-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||||
|
* Docs: Changelog fix (@thebigredgeek)
|
||||||
|
|
||||||
|
2.6.2 / 2017-03-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||||
|
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||||
|
* Docs: Add Slackin invite badge (@tootallnate)
|
||||||
|
|
||||||
|
2.6.1 / 2017-02-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||||
|
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||||
|
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||||
|
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||||
|
|
||||||
|
2.6.0 / 2016-12-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||||
|
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||||
|
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||||
|
|
||||||
|
2.5.2 / 2016-12-25
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||||
|
* Docs: fixed README typo (#391, @lurch)
|
||||||
|
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||||
|
|
||||||
|
2.5.1 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: babel-core compatibility
|
||||||
|
|
||||||
|
2.5.0 / 2016-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||||
|
* Fix: webworker compatibility (@thebigredgeek)
|
||||||
|
* Fix: output formatting issue (#388, @kribblo)
|
||||||
|
* Fix: babel-loader compatibility (#383, @escwald)
|
||||||
|
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||||
|
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||||
|
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||||
|
* Test: coveralls integration (#378, @yamikuronue)
|
||||||
|
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.5 / 2016-12-17
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||||
|
* Fix: custom log function (#379, @hsiliev)
|
||||||
|
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||||
|
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||||
|
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||||
|
|
||||||
|
2.4.4 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||||
|
|
||||||
|
2.4.3 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||||
|
|
||||||
|
2.4.2 / 2016-12-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: browser colors (#367, @tootallnate)
|
||||||
|
* Misc: travis ci integration (@thebigredgeek)
|
||||||
|
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||||
|
|
||||||
|
2.4.1 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: typo that broke the package (#356)
|
||||||
|
|
||||||
|
2.4.0 / 2016-12-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||||
|
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||||
|
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||||
|
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||||
|
* Improvement: allow colors in workers (#335, @botverse)
|
||||||
|
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||||
|
|
||||||
|
2.3.3 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||||
|
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||||
|
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||||
|
|
||||||
|
2.3.2 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||||
|
* Fix: should check whether process exists (Tom Newby)
|
||||||
|
|
||||||
|
2.3.1 / 2016-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||||
|
* Improvement: Added performance optimizations (@tootallnate)
|
||||||
|
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||||
|
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||||
|
|
||||||
|
2.3.0 / 2016-11-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||||
|
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||||
|
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||||
|
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||||
|
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||||
|
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||||
|
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||||
|
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||||
|
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||||
|
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||||
|
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||||
|
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||||
|
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||||
|
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||||
|
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||||
|
* Misc: Updated contributors (@thebigredgeek)
|
||||||
|
|
||||||
|
2.2.0 / 2015-05-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||||
|
* README: add logging to file example (#193, @DanielOchoa)
|
||||||
|
* README: fixed a typo (#191, @amir-s)
|
||||||
|
* browser: expose `storage` (#190, @stephenmathieson)
|
||||||
|
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||||
|
|
||||||
|
2.1.3 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Updated stdout/stderr example (#186)
|
||||||
|
* Updated example/stdout.js to match debug current behaviour
|
||||||
|
* Renamed example/stderr.js to stdout.js
|
||||||
|
* Update Readme.md (#184)
|
||||||
|
* replace high intensity foreground color for bold (#182, #183)
|
||||||
|
|
||||||
|
2.1.2 / 2015-03-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* update "ms" to v0.7.0
|
||||||
|
* package: update "browserify" to v9.0.3
|
||||||
|
* component: fix "ms.js" repo location
|
||||||
|
* changed bower package name
|
||||||
|
* updated documentation about using debug in a browser
|
||||||
|
* fix: security error on safari (#167, #168, @yields)
|
||||||
|
|
||||||
|
2.1.1 / 2014-12-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `typeof` to check for `console` existence
|
||||||
|
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||||
|
* browser: add support for Chrome apps
|
||||||
|
* Readme: added Windows usage remarks
|
||||||
|
* Add `bower.json` to properly support bower install
|
||||||
|
|
||||||
|
2.1.0 / 2014-10-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* node: implement `DEBUG_FD` env variable support
|
||||||
|
* package: update "browserify" to v6.1.0
|
||||||
|
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||||
|
|
||||||
|
2.0.0 / 2014-09-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: update "browserify" to v5.11.0
|
||||||
|
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||||
|
|
||||||
|
1.0.4 / 2014-07-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* dist: recompile
|
||||||
|
* example: remove `console.info()` log usage
|
||||||
|
* example: add "Content-Type" UTF-8 header to browser example
|
||||||
|
* browser: place %c marker after the space character
|
||||||
|
* browser: reset the "content" color via `color: inherit`
|
||||||
|
* browser: add colors support for Firefox >= v31
|
||||||
|
* debug: prefer an instance `log()` function over the global one (#119)
|
||||||
|
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||||
|
|
||||||
|
1.0.3 / 2014-07-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||||
|
* browser: fix lint
|
||||||
|
|
||||||
|
1.0.2 / 2014-06-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: update color palette (#113, @gscottolson)
|
||||||
|
* common: make console logging function configurable (#108, @timoxley)
|
||||||
|
* node: fix %o colors on old node <= 0.8.x
|
||||||
|
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||||
|
|
||||||
|
1.0.1 / 2014-06-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* browser: use `removeItem()` to clear localStorage
|
||||||
|
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||||
|
* package: add "contributors" section
|
||||||
|
* node: fix comment typo
|
||||||
|
* README: list authors
|
||||||
|
|
||||||
|
1.0.0 / 2014-06-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* make ms diff be global, not be scope
|
||||||
|
* debug: ignore empty strings in enable()
|
||||||
|
* node: make DEBUG_COLORS able to disable coloring
|
||||||
|
* *: export the `colors` array
|
||||||
|
* npmignore: don't publish the `dist` dir
|
||||||
|
* Makefile: refactor to use browserify
|
||||||
|
* package: add "browserify" as a dev dependency
|
||||||
|
* Readme: add Web Inspector Colors section
|
||||||
|
* node: reset terminal color for the debug content
|
||||||
|
* node: map "%o" to `util.inspect()`
|
||||||
|
* browser: map "%j" to `JSON.stringify()`
|
||||||
|
* debug: add custom "formatters"
|
||||||
|
* debug: use "ms" module for humanizing the diff
|
||||||
|
* Readme: add "bash" syntax highlighting
|
||||||
|
* browser: add Firebug color support
|
||||||
|
* browser: add colors for WebKit browsers
|
||||||
|
* node: apply log to `console`
|
||||||
|
* rewrite: abstract common logic for Node & browsers
|
||||||
|
* add .jshintrc file
|
||||||
|
|
||||||
|
0.8.1 / 2014-04-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* package: re-add the "component" section
|
||||||
|
|
||||||
|
0.8.0 / 2014-03-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `enable()` method for nodejs. Closes #27
|
||||||
|
* change from stderr to stdout
|
||||||
|
* remove unnecessary index.js file
|
||||||
|
|
||||||
|
0.7.4 / 2013-11-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove "browserify" key from package.json (fixes something in browserify)
|
||||||
|
|
||||||
|
0.7.3 / 2013-10-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||||
|
* add debug(err) support. Closes #46
|
||||||
|
* add .browser prop to package.json. Closes #42
|
||||||
|
|
||||||
|
0.7.2 / 2013-02-06
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix package.json
|
||||||
|
* fix: Mobile Safari (private mode) is broken with debug
|
||||||
|
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||||
|
|
||||||
|
0.7.1 / 2013-02-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add repository URL to package.json
|
||||||
|
* add DEBUG_COLORED to force colored output
|
||||||
|
* add browserify support
|
||||||
|
* fix component. Closes #24
|
||||||
|
|
||||||
|
0.7.0 / 2012-05-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added .component to package.json
|
||||||
|
* Added debug.component.js build
|
||||||
|
|
||||||
|
0.6.0 / 2012-03-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||||
|
* Added `.enabled` flag to the node version [TooTallNate]
|
||||||
|
|
||||||
|
0.5.0 / 2012-02-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: humanize diffs. Closes #8
|
||||||
|
* Added `debug.disable()` to the CS variant
|
||||||
|
* Removed padding. Closes #10
|
||||||
|
* Fixed: persist client-side variant again. Closes #9
|
||||||
|
|
||||||
|
0.4.0 / 2012-02-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added browser variant support for older browsers [TooTallNate]
|
||||||
|
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||||
|
* Added padding to diff (moved it to the right)
|
||||||
|
|
||||||
|
0.3.0 / 2012-01-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added millisecond diff when isatty, otherwise UTC string
|
||||||
|
|
||||||
|
0.2.0 / 2012-01-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added wildcard support
|
||||||
|
|
||||||
|
0.1.0 / 2011-12-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||||
|
|
||||||
|
0.0.1 / 2010-01-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
19
code/code/node_modules/body-parser/node_modules/debug/LICENSE
generated
vendored
Normal file
19
code/code/node_modules/body-parser/node_modules/debug/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
50
code/code/node_modules/body-parser/node_modules/debug/Makefile
generated
vendored
Normal file
50
code/code/node_modules/body-parser/node_modules/debug/Makefile
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||||
|
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||||
|
|
||||||
|
# BIN directory
|
||||||
|
BIN := $(THIS_DIR)/node_modules/.bin
|
||||||
|
|
||||||
|
# Path
|
||||||
|
PATH := node_modules/.bin:$(PATH)
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
# applications
|
||||||
|
NODE ?= $(shell which node)
|
||||||
|
YARN ?= $(shell which yarn)
|
||||||
|
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||||
|
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||||
|
|
||||||
|
.FORCE:
|
||||||
|
|
||||||
|
install: node_modules
|
||||||
|
|
||||||
|
node_modules: package.json
|
||||||
|
@NODE_ENV= $(PKG) install
|
||||||
|
@touch node_modules
|
||||||
|
|
||||||
|
lint: .FORCE
|
||||||
|
eslint browser.js debug.js index.js node.js
|
||||||
|
|
||||||
|
test-node: .FORCE
|
||||||
|
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||||
|
|
||||||
|
test-browser: .FORCE
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
@$(BROWSERIFY) \
|
||||||
|
--standalone debug \
|
||||||
|
. > dist/debug.js
|
||||||
|
|
||||||
|
karma start --single-run
|
||||||
|
rimraf dist
|
||||||
|
|
||||||
|
test: .FORCE
|
||||||
|
concurrently \
|
||||||
|
"make test-node" \
|
||||||
|
"make test-browser"
|
||||||
|
|
||||||
|
coveralls:
|
||||||
|
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||||
|
|
||||||
|
.PHONY: all install clean distclean
|
312
code/code/node_modules/body-parser/node_modules/debug/README.md
generated
vendored
Normal file
312
code/code/node_modules/body-parser/node_modules/debug/README.md
generated
vendored
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
# debug
|
||||||
|
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
|
||||||
|
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||||
|
|
||||||
|
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||||
|
|
||||||
|
Example _app.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('http')
|
||||||
|
, http = require('http')
|
||||||
|
, name = 'My App';
|
||||||
|
|
||||||
|
// fake app
|
||||||
|
|
||||||
|
debug('booting %s', name);
|
||||||
|
|
||||||
|
http.createServer(function(req, res){
|
||||||
|
debug(req.method + ' ' + req.url);
|
||||||
|
res.end('hello\n');
|
||||||
|
}).listen(3000, function(){
|
||||||
|
debug('listening');
|
||||||
|
});
|
||||||
|
|
||||||
|
// fake worker of some kind
|
||||||
|
|
||||||
|
require('./worker');
|
||||||
|
```
|
||||||
|
|
||||||
|
Example _worker.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('worker');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
debug('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
```
|
||||||
|
|
||||||
|
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||||
|
|
||||||
|
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
|
||||||
|
|
||||||
|
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
|
||||||
|
|
||||||
|
#### Windows note
|
||||||
|
|
||||||
|
On Windows the environment variable is set using the `set` command.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
set DEBUG=*,-not_this
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that PowerShell uses different syntax to set environment variables.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$env:DEBUG = "*,-not_this"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the program to be debugged as usual.
|
||||||
|
|
||||||
|
## Millisecond diff
|
||||||
|
|
||||||
|
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||||
|
|
||||||
|
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
|
||||||
|
|
||||||
|
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||||
|
|
||||||
|
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||||
|
|
||||||
|
## Wildcards
|
||||||
|
|
||||||
|
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||||
|
|
||||||
|
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
When running through Node.js, you can set a few environment variables that will
|
||||||
|
change the behavior of the debug logging:
|
||||||
|
|
||||||
|
| Name | Purpose |
|
||||||
|
|-----------|-------------------------------------------------|
|
||||||
|
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||||
|
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||||
|
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||||
|
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||||
|
|
||||||
|
|
||||||
|
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||||
|
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||||
|
See the Node.js documentation for
|
||||||
|
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||||
|
for the complete list.
|
||||||
|
|
||||||
|
## Formatters
|
||||||
|
|
||||||
|
|
||||||
|
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||||
|
|
||||||
|
| Formatter | Representation |
|
||||||
|
|-----------|----------------|
|
||||||
|
| `%O` | Pretty-print an Object on multiple lines. |
|
||||||
|
| `%o` | Pretty-print an Object all on a single line. |
|
||||||
|
| `%s` | String. |
|
||||||
|
| `%d` | Number (both integer and float). |
|
||||||
|
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||||
|
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||||
|
|
||||||
|
### Custom formatters
|
||||||
|
|
||||||
|
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createDebug = require('debug')
|
||||||
|
createDebug.formatters.h = (v) => {
|
||||||
|
return v.toString('hex')
|
||||||
|
}
|
||||||
|
|
||||||
|
// …elsewhere
|
||||||
|
const debug = createDebug('foo')
|
||||||
|
debug('this is hex: %h', new Buffer('hello world'))
|
||||||
|
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||||
|
```
|
||||||
|
|
||||||
|
## Browser support
|
||||||
|
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||||
|
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||||
|
if you don't want to build it yourself.
|
||||||
|
|
||||||
|
Debug's enable state is currently persisted by `localStorage`.
|
||||||
|
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||||
|
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
localStorage.debug = 'worker:*'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then refresh the page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
a = debug('worker:a');
|
||||||
|
b = debug('worker:b');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
a('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
b('doing some work');
|
||||||
|
}, 1200);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Web Inspector Colors
|
||||||
|
|
||||||
|
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||||
|
option. These are WebKit web inspectors, Firefox ([since version
|
||||||
|
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||||
|
and the Firebug plugin for Firefox (any version).
|
||||||
|
|
||||||
|
Colored output looks something like:
|
||||||
|
|
||||||
|
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
|
||||||
|
|
||||||
|
|
||||||
|
## Output streams
|
||||||
|
|
||||||
|
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||||
|
|
||||||
|
Example _stdout.js_:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug');
|
||||||
|
var error = debug('app:error');
|
||||||
|
|
||||||
|
// by default stderr is used
|
||||||
|
error('goes to stderr!');
|
||||||
|
|
||||||
|
var log = debug('app:log');
|
||||||
|
// set this namespace to log via console.log
|
||||||
|
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||||
|
log('goes to stdout');
|
||||||
|
error('still goes to stderr!');
|
||||||
|
|
||||||
|
// set all output to go via console.info
|
||||||
|
// overrides all per-namespace log settings
|
||||||
|
debug.log = console.info.bind(console);
|
||||||
|
error('now goes to stdout via console.info');
|
||||||
|
log('still goes to stdout, but via console.info now');
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- TJ Holowaychuk
|
||||||
|
- Nathan Rajlich
|
||||||
|
- Andrew Rhyne
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
code/code/node_modules/body-parser/node_modules/debug/component.json
generated
vendored
Normal file
19
code/code/node_modules/body-parser/node_modules/debug/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"repo": "visionmedia/debug",
|
||||||
|
"description": "small debugging utility",
|
||||||
|
"version": "2.6.9",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"log",
|
||||||
|
"debugger"
|
||||||
|
],
|
||||||
|
"main": "src/browser.js",
|
||||||
|
"scripts": [
|
||||||
|
"src/browser.js",
|
||||||
|
"src/debug.js"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"rauchg/ms.js": "0.7.1"
|
||||||
|
}
|
||||||
|
}
|
70
code/code/node_modules/body-parser/node_modules/debug/karma.conf.js
generated
vendored
Normal file
70
code/code/node_modules/body-parser/node_modules/debug/karma.conf.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// Karma configuration
|
||||||
|
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
|
||||||
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
|
basePath: '',
|
||||||
|
|
||||||
|
|
||||||
|
// frameworks to use
|
||||||
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
|
frameworks: ['mocha', 'chai', 'sinon'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'dist/debug.js',
|
||||||
|
'test/*spec.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files to exclude
|
||||||
|
exclude: [
|
||||||
|
'src/node.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// preprocess matching files before serving them to the browser
|
||||||
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
|
preprocessors: {
|
||||||
|
},
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress'
|
||||||
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
|
||||||
|
// start these browsers
|
||||||
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
|
browsers: ['PhantomJS'],
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: false,
|
||||||
|
|
||||||
|
// Concurrency level
|
||||||
|
// how many browser should be started simultaneous
|
||||||
|
concurrency: Infinity
|
||||||
|
})
|
||||||
|
}
|
1
code/code/node_modules/body-parser/node_modules/debug/node.js
generated
vendored
Normal file
1
code/code/node_modules/body-parser/node_modules/debug/node.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./src/node');
|
88
code/code/node_modules/body-parser/node_modules/debug/package.json
generated
vendored
Normal file
88
code/code/node_modules/body-parser/node_modules/debug/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"_from": "debug@2.6.9",
|
||||||
|
"_id": "debug@2.6.9",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
|
"_location": "/body-parser/debug",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "debug@2.6.9",
|
||||||
|
"name": "debug",
|
||||||
|
"escapedName": "debug",
|
||||||
|
"rawSpec": "2.6.9",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.6.9"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/body-parser"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
|
"_shasum": "5d128515df134ff327e90a4c93f4e077a536341f",
|
||||||
|
"_spec": "debug@2.6.9",
|
||||||
|
"_where": "C:\\Users\\ittnerpa60944\\source\\repos\\MDTWebApp\\code\\code\\node_modules\\body-parser",
|
||||||
|
"author": {
|
||||||
|
"name": "TJ Holowaychuk",
|
||||||
|
"email": "tj@vision-media.ca"
|
||||||
|
},
|
||||||
|
"browser": "./src/browser.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/visionmedia/debug/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"component": {
|
||||||
|
"scripts": {
|
||||||
|
"debug/index.js": "browser.js",
|
||||||
|
"debug/debug.js": "debug.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Nathan Rajlich",
|
||||||
|
"email": "nathan@tootallnate.net",
|
||||||
|
"url": "http://n8.io"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andrew Rhyne",
|
||||||
|
"email": "rhyneandrew@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "small debugging utility",
|
||||||
|
"devDependencies": {
|
||||||
|
"browserify": "9.0.3",
|
||||||
|
"chai": "^3.5.0",
|
||||||
|
"concurrently": "^3.1.0",
|
||||||
|
"coveralls": "^2.11.15",
|
||||||
|
"eslint": "^3.12.1",
|
||||||
|
"istanbul": "^0.4.5",
|
||||||
|
"karma": "^1.3.0",
|
||||||
|
"karma-chai": "^0.1.0",
|
||||||
|
"karma-mocha": "^1.3.0",
|
||||||
|
"karma-phantomjs-launcher": "^1.0.2",
|
||||||
|
"karma-sinon": "^1.0.5",
|
||||||
|
"mocha": "^3.2.0",
|
||||||
|
"mocha-lcov-reporter": "^1.2.0",
|
||||||
|
"rimraf": "^2.5.4",
|
||||||
|
"sinon": "^1.17.6",
|
||||||
|
"sinon-chai": "^2.8.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"log",
|
||||||
|
"debugger"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./src/index.js",
|
||||||
|
"name": "debug",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/visionmedia/debug.git"
|
||||||
|
},
|
||||||
|
"version": "2.6.9"
|
||||||
|
}
|
185
code/code/node_modules/body-parser/node_modules/debug/src/browser.js
generated
vendored
Normal file
185
code/code/node_modules/body-parser/node_modules/debug/src/browser.js
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/**
|
||||||
|
* This is the web browser implementation of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = require('./debug');
|
||||||
|
exports.log = log;
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
exports.storage = 'undefined' != typeof chrome
|
||||||
|
&& 'undefined' != typeof chrome.storage
|
||||||
|
? chrome.storage.local
|
||||||
|
: localstorage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [
|
||||||
|
'lightseagreen',
|
||||||
|
'forestgreen',
|
||||||
|
'goldenrod',
|
||||||
|
'dodgerblue',
|
||||||
|
'darkorchid',
|
||||||
|
'crimson'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||||
|
* and the Firebug extension (any Firefox version) are known
|
||||||
|
* to support "%c" CSS customizations.
|
||||||
|
*
|
||||||
|
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useColors() {
|
||||||
|
// NB: In an Electron preload script, document will be defined but not fully
|
||||||
|
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||||
|
// explicitly
|
||||||
|
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||||
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||||
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||||
|
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||||
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||||
|
// is firefox >= v31?
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||||
|
// double check webkit in userAgent just in case we are in a worker
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.j = function(v) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(v);
|
||||||
|
} catch (err) {
|
||||||
|
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colorize log arguments if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
var useColors = this.useColors;
|
||||||
|
|
||||||
|
args[0] = (useColors ? '%c' : '')
|
||||||
|
+ this.namespace
|
||||||
|
+ (useColors ? ' %c' : ' ')
|
||||||
|
+ args[0]
|
||||||
|
+ (useColors ? '%c ' : ' ')
|
||||||
|
+ '+' + exports.humanize(this.diff);
|
||||||
|
|
||||||
|
if (!useColors) return;
|
||||||
|
|
||||||
|
var c = 'color: ' + this.color;
|
||||||
|
args.splice(1, 0, c, 'color: inherit')
|
||||||
|
|
||||||
|
// the final "%c" is somewhat tricky, because there could be other
|
||||||
|
// arguments passed either before or after the %c, so we need to
|
||||||
|
// figure out the correct index to insert the CSS into
|
||||||
|
var index = 0;
|
||||||
|
var lastC = 0;
|
||||||
|
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||||
|
if ('%%' === match) return;
|
||||||
|
index++;
|
||||||
|
if ('%c' === match) {
|
||||||
|
// we only are interested in the *last* %c
|
||||||
|
// (the user may have provided their own)
|
||||||
|
lastC = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
args.splice(lastC, 0, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `console.log()` when available.
|
||||||
|
* No-op when `console.log` is not a "function".
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
// this hackery is required for IE8/9, where
|
||||||
|
// the `console.log` function doesn't have 'apply'
|
||||||
|
return 'object' === typeof console
|
||||||
|
&& console.log
|
||||||
|
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function save(namespaces) {
|
||||||
|
try {
|
||||||
|
if (null == namespaces) {
|
||||||
|
exports.storage.removeItem('debug');
|
||||||
|
} else {
|
||||||
|
exports.storage.debug = namespaces;
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
var r;
|
||||||
|
try {
|
||||||
|
r = exports.storage.debug;
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||||
|
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||||
|
r = process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable namespaces listed in `localStorage.debug` initially.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.enable(load());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localstorage attempts to return the localstorage.
|
||||||
|
*
|
||||||
|
* This is necessary because safari throws
|
||||||
|
* when a user disables cookies/localstorage
|
||||||
|
* and you attempt to access it.
|
||||||
|
*
|
||||||
|
* @return {LocalStorage}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function localstorage() {
|
||||||
|
try {
|
||||||
|
return window.localStorage;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
202
code/code/node_modules/body-parser/node_modules/debug/src/debug.js
generated
vendored
Normal file
202
code/code/node_modules/body-parser/node_modules/debug/src/debug.js
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* This is the common logic for both the Node.js and web browser
|
||||||
|
* implementations of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||||
|
exports.coerce = coerce;
|
||||||
|
exports.disable = disable;
|
||||||
|
exports.enable = enable;
|
||||||
|
exports.enabled = enabled;
|
||||||
|
exports.humanize = require('ms');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently active debug mode names, and names to skip.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.names = [];
|
||||||
|
exports.skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||||
|
*
|
||||||
|
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Previous log timestamp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var prevTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a color.
|
||||||
|
* @param {String} namespace
|
||||||
|
* @return {Number}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function selectColor(namespace) {
|
||||||
|
var hash = 0, i;
|
||||||
|
|
||||||
|
for (i in namespace) {
|
||||||
|
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||||
|
hash |= 0; // Convert to 32bit integer
|
||||||
|
}
|
||||||
|
|
||||||
|
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a debugger with the given `namespace`.
|
||||||
|
*
|
||||||
|
* @param {String} namespace
|
||||||
|
* @return {Function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createDebug(namespace) {
|
||||||
|
|
||||||
|
function debug() {
|
||||||
|
// disabled?
|
||||||
|
if (!debug.enabled) return;
|
||||||
|
|
||||||
|
var self = debug;
|
||||||
|
|
||||||
|
// set `diff` timestamp
|
||||||
|
var curr = +new Date();
|
||||||
|
var ms = curr - (prevTime || curr);
|
||||||
|
self.diff = ms;
|
||||||
|
self.prev = prevTime;
|
||||||
|
self.curr = curr;
|
||||||
|
prevTime = curr;
|
||||||
|
|
||||||
|
// turn the `arguments` into a proper Array
|
||||||
|
var args = new Array(arguments.length);
|
||||||
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
args[i] = arguments[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
args[0] = exports.coerce(args[0]);
|
||||||
|
|
||||||
|
if ('string' !== typeof args[0]) {
|
||||||
|
// anything else let's inspect with %O
|
||||||
|
args.unshift('%O');
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply any `formatters` transformations
|
||||||
|
var index = 0;
|
||||||
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||||
|
// if we encounter an escaped % then don't increase the array index
|
||||||
|
if (match === '%%') return match;
|
||||||
|
index++;
|
||||||
|
var formatter = exports.formatters[format];
|
||||||
|
if ('function' === typeof formatter) {
|
||||||
|
var val = args[index];
|
||||||
|
match = formatter.call(self, val);
|
||||||
|
|
||||||
|
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||||
|
args.splice(index, 1);
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
|
||||||
|
// apply env-specific formatting (colors, etc.)
|
||||||
|
exports.formatArgs.call(self, args);
|
||||||
|
|
||||||
|
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||||
|
logFn.apply(self, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.namespace = namespace;
|
||||||
|
debug.enabled = exports.enabled(namespace);
|
||||||
|
debug.useColors = exports.useColors();
|
||||||
|
debug.color = selectColor(namespace);
|
||||||
|
|
||||||
|
// env-specific initialization logic for debug instances
|
||||||
|
if ('function' === typeof exports.init) {
|
||||||
|
exports.init(debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables a debug mode by namespaces. This can include modes
|
||||||
|
* separated by a colon and wildcards.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enable(namespaces) {
|
||||||
|
exports.save(namespaces);
|
||||||
|
|
||||||
|
exports.names = [];
|
||||||
|
exports.skips = [];
|
||||||
|
|
||||||
|
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||||
|
var len = split.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
if (!split[i]) continue; // ignore empty strings
|
||||||
|
namespaces = split[i].replace(/\*/g, '.*?');
|
||||||
|
if (namespaces[0] === '-') {
|
||||||
|
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||||
|
} else {
|
||||||
|
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable debug output.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function disable() {
|
||||||
|
exports.enable('');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given mode name is enabled, false otherwise.
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @return {Boolean}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enabled(name) {
|
||||||
|
var i, len;
|
||||||
|
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||||
|
if (exports.skips[i].test(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||||
|
if (exports.names[i].test(name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coerce `val`.
|
||||||
|
*
|
||||||
|
* @param {Mixed} val
|
||||||
|
* @return {Mixed}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function coerce(val) {
|
||||||
|
if (val instanceof Error) return val.stack || val.message;
|
||||||
|
return val;
|
||||||
|
}
|
10
code/code/node_modules/body-parser/node_modules/debug/src/index.js
generated
vendored
Normal file
10
code/code/node_modules/body-parser/node_modules/debug/src/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Detect Electron renderer process, which is node, but we should
|
||||||
|
* treat as a browser.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||||
|
module.exports = require('./browser.js');
|
||||||
|
} else {
|
||||||
|
module.exports = require('./node.js');
|
||||||
|
}
|
15
code/code/node_modules/body-parser/node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
15
code/code/node_modules/body-parser/node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = inspectorLog;
|
||||||
|
|
||||||
|
// black hole
|
||||||
|
const nullStream = new (require('stream').Writable)();
|
||||||
|
nullStream._write = () => {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outputs a `console.log()` to the Node.js Inspector console *only*.
|
||||||
|
*/
|
||||||
|
function inspectorLog() {
|
||||||
|
const stdout = console._stdout;
|
||||||
|
console._stdout = nullStream;
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
console._stdout = stdout;
|
||||||
|
}
|
248
code/code/node_modules/body-parser/node_modules/debug/src/node.js
generated
vendored
Normal file
248
code/code/node_modules/body-parser/node_modules/debug/src/node.js
generated
vendored
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var tty = require('tty');
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the Node.js implementation of `debug()`.
|
||||||
|
*
|
||||||
|
* Expose `debug()` as the module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = module.exports = require('./debug');
|
||||||
|
exports.init = init;
|
||||||
|
exports.log = log;
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build up the default `inspectOpts` object from the environment variables.
|
||||||
|
*
|
||||||
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||||
|
return /^debug_/i.test(key);
|
||||||
|
}).reduce(function (obj, key) {
|
||||||
|
// camel-case
|
||||||
|
var prop = key
|
||||||
|
.substring(6)
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||||
|
|
||||||
|
// coerce string value into JS value
|
||||||
|
var val = process.env[key];
|
||||||
|
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||||
|
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||||
|
else if (val === 'null') val = null;
|
||||||
|
else val = Number(val);
|
||||||
|
|
||||||
|
obj[prop] = val;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The file descriptor to write the `debug()` calls to.
|
||||||
|
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||||
|
*
|
||||||
|
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||||
|
*/
|
||||||
|
|
||||||
|
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||||
|
|
||||||
|
if (1 !== fd && 2 !== fd) {
|
||||||
|
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
||||||
|
}
|
||||||
|
|
||||||
|
var stream = 1 === fd ? process.stdout :
|
||||||
|
2 === fd ? process.stderr :
|
||||||
|
createWritableStdioStream(fd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useColors() {
|
||||||
|
return 'colors' in exports.inspectOpts
|
||||||
|
? Boolean(exports.inspectOpts.colors)
|
||||||
|
: tty.isatty(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %o to `util.inspect()`, all on a single line.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.o = function(v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts)
|
||||||
|
.split('\n').map(function(str) {
|
||||||
|
return str.trim()
|
||||||
|
}).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatters.O = function(v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds ANSI color escape codes if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
var name = this.namespace;
|
||||||
|
var useColors = this.useColors;
|
||||||
|
|
||||||
|
if (useColors) {
|
||||||
|
var c = this.color;
|
||||||
|
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
||||||
|
|
||||||
|
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||||
|
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||||
|
} else {
|
||||||
|
args[0] = new Date().toUTCString()
|
||||||
|
+ ' ' + name + ' ' + args[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
return stream.write(util.format.apply(util, arguments) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function save(namespaces) {
|
||||||
|
if (null == namespaces) {
|
||||||
|
// If you set a process.env field to null or undefined, it gets cast to the
|
||||||
|
// string 'null' or 'undefined'. Just delete instead.
|
||||||
|
delete process.env.DEBUG;
|
||||||
|
} else {
|
||||||
|
process.env.DEBUG = namespaces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
return process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copied from `node/src/node.js`.
|
||||||
|
*
|
||||||
|
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||||
|
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createWritableStdioStream (fd) {
|
||||||
|
var stream;
|
||||||
|
var tty_wrap = process.binding('tty_wrap');
|
||||||
|
|
||||||
|
// Note stream._type is used for test-module-load-list.js
|
||||||
|
|
||||||
|
switch (tty_wrap.guessHandleType(fd)) {
|
||||||
|
case 'TTY':
|
||||||
|
stream = new tty.WriteStream(fd);
|
||||||
|
stream._type = 'tty';
|
||||||
|
|
||||||
|
// Hack to have stream not keep the event loop alive.
|
||||||
|
// See https://github.com/joyent/node/issues/1726
|
||||||
|
if (stream._handle && stream._handle.unref) {
|
||||||
|
stream._handle.unref();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'FILE':
|
||||||
|
var fs = require('fs');
|
||||||
|
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||||
|
stream._type = 'fs';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'PIPE':
|
||||||
|
case 'TCP':
|
||||||
|
var net = require('net');
|
||||||
|
stream = new net.Socket({
|
||||||
|
fd: fd,
|
||||||
|
readable: false,
|
||||||
|
writable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// FIXME Should probably have an option in net.Socket to create a
|
||||||
|
// stream from an existing fd which is writable only. But for now
|
||||||
|
// we'll just add this hack and set the `readable` member to false.
|
||||||
|
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||||
|
stream.readable = false;
|
||||||
|
stream.read = null;
|
||||||
|
stream._type = 'pipe';
|
||||||
|
|
||||||
|
// FIXME Hack to have stream not keep the event loop alive.
|
||||||
|
// See https://github.com/joyent/node/issues/1726
|
||||||
|
if (stream._handle && stream._handle.unref) {
|
||||||
|
stream._handle.unref();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Probably an error on in uv_guess_handle()
|
||||||
|
throw new Error('Implement me. Unknown stream file type!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// For supporting legacy API we put the FD here.
|
||||||
|
stream.fd = fd;
|
||||||
|
|
||||||
|
stream._isStdio = true;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init logic for `debug` instances.
|
||||||
|
*
|
||||||
|
* Create a new `inspectOpts` object in case `useColors` is set
|
||||||
|
* differently for a particular `debug` instance.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function init (debug) {
|
||||||
|
debug.inspectOpts = {};
|
||||||
|
|
||||||
|
var keys = Object.keys(exports.inspectOpts);
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.enable(load());
|
152
code/code/node_modules/body-parser/node_modules/ms/index.js
generated
vendored
Normal file
152
code/code/node_modules/body-parser/node_modules/ms/index.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* Helpers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var s = 1000;
|
||||||
|
var m = s * 60;
|
||||||
|
var h = m * 60;
|
||||||
|
var d = h * 24;
|
||||||
|
var y = d * 365.25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse or format the given `val`.
|
||||||
|
*
|
||||||
|
* Options:
|
||||||
|
*
|
||||||
|
* - `long` verbose formatting [false]
|
||||||
|
*
|
||||||
|
* @param {String|Number} val
|
||||||
|
* @param {Object} [options]
|
||||||
|
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||||
|
* @return {String|Number}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = function(val, options) {
|
||||||
|
options = options || {};
|
||||||
|
var type = typeof val;
|
||||||
|
if (type === 'string' && val.length > 0) {
|
||||||
|
return parse(val);
|
||||||
|
} else if (type === 'number' && isNaN(val) === false) {
|
||||||
|
return options.long ? fmtLong(val) : fmtShort(val);
|
||||||
|
}
|
||||||
|
throw new Error(
|
||||||
|
'val is not a non-empty string or a valid number. val=' +
|
||||||
|
JSON.stringify(val)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given `str` and return milliseconds.
|
||||||
|
*
|
||||||
|
* @param {String} str
|
||||||
|
* @return {Number}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parse(str) {
|
||||||
|
str = String(str);
|
||||||
|
if (str.length > 100) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
||||||
|
str
|
||||||
|
);
|
||||||
|
if (!match) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var n = parseFloat(match[1]);
|
||||||
|
var type = (match[2] || 'ms').toLowerCase();
|
||||||
|
switch (type) {
|
||||||
|
case 'years':
|
||||||
|
case 'year':
|
||||||
|
case 'yrs':
|
||||||
|
case 'yr':
|
||||||
|
case 'y':
|
||||||
|
return n * y;
|
||||||
|
case 'days':
|
||||||
|
case 'day':
|
||||||
|
case 'd':
|
||||||
|
return n * d;
|
||||||
|
case 'hours':
|
||||||
|
case 'hour':
|
||||||
|
case 'hrs':
|
||||||
|
case 'hr':
|
||||||
|
case 'h':
|
||||||
|
return n * h;
|
||||||
|
case 'minutes':
|
||||||
|
case 'minute':
|
||||||
|
case 'mins':
|
||||||
|
case 'min':
|
||||||
|
case 'm':
|
||||||
|
return n * m;
|
||||||
|
case 'seconds':
|
||||||
|
case 'second':
|
||||||
|
case 'secs':
|
||||||
|
case 'sec':
|
||||||
|
case 's':
|
||||||
|
return n * s;
|
||||||
|
case 'milliseconds':
|
||||||
|
case 'millisecond':
|
||||||
|
case 'msecs':
|
||||||
|
case 'msec':
|
||||||
|
case 'ms':
|
||||||
|
return n;
|
||||||
|
default:
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Short format for `ms`.
|
||||||
|
*
|
||||||
|
* @param {Number} ms
|
||||||
|
* @return {String}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function fmtShort(ms) {
|
||||||
|
if (ms >= d) {
|
||||||
|
return Math.round(ms / d) + 'd';
|
||||||
|
}
|
||||||
|
if (ms >= h) {
|
||||||
|
return Math.round(ms / h) + 'h';
|
||||||
|
}
|
||||||
|
if (ms >= m) {
|
||||||
|
return Math.round(ms / m) + 'm';
|
||||||
|
}
|
||||||
|
if (ms >= s) {
|
||||||
|
return Math.round(ms / s) + 's';
|
||||||
|
}
|
||||||
|
return ms + 'ms';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Long format for `ms`.
|
||||||
|
*
|
||||||
|
* @param {Number} ms
|
||||||
|
* @return {String}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function fmtLong(ms) {
|
||||||
|
return plural(ms, d, 'day') ||
|
||||||
|
plural(ms, h, 'hour') ||
|
||||||
|
plural(ms, m, 'minute') ||
|
||||||
|
plural(ms, s, 'second') ||
|
||||||
|
ms + ' ms';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pluralization helper.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function plural(ms, n, name) {
|
||||||
|
if (ms < n) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ms < n * 1.5) {
|
||||||
|
return Math.floor(ms / n) + ' ' + name;
|
||||||
|
}
|
||||||
|
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||||
|
}
|
21
code/code/node_modules/body-parser/node_modules/ms/license.md
generated
vendored
Normal file
21
code/code/node_modules/body-parser/node_modules/ms/license.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Zeit, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
69
code/code/node_modules/body-parser/node_modules/ms/package.json
generated
vendored
Normal file
69
code/code/node_modules/body-parser/node_modules/ms/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"_from": "ms@2.0.0",
|
||||||
|
"_id": "ms@2.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||||
|
"_location": "/body-parser/ms",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ms@2.0.0",
|
||||||
|
"name": "ms",
|
||||||
|
"escapedName": "ms",
|
||||||
|
"rawSpec": "2.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/body-parser/debug"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8",
|
||||||
|
"_spec": "ms@2.0.0",
|
||||||
|
"_where": "C:\\Users\\ittnerpa60944\\source\\repos\\MDTWebApp\\code\\code\\node_modules\\body-parser\\node_modules\\debug",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/zeit/ms/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Tiny milisecond conversion utility",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "3.19.0",
|
||||||
|
"expect.js": "0.3.1",
|
||||||
|
"husky": "0.13.3",
|
||||||
|
"lint-staged": "3.4.1",
|
||||||
|
"mocha": "3.4.1"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/zeit/ms#readme",
|
||||||
|
"license": "MIT",
|
||||||
|
"lint-staged": {
|
||||||
|
"*.js": [
|
||||||
|
"npm run lint",
|
||||||
|
"prettier --single-quote --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"main": "./index",
|
||||||
|
"name": "ms",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/zeit/ms.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint lib/* bin/*",
|
||||||
|
"precommit": "lint-staged",
|
||||||
|
"test": "mocha tests.js"
|
||||||
|
},
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
51
code/code/node_modules/body-parser/node_modules/ms/readme.md
generated
vendored
Normal file
51
code/code/node_modules/body-parser/node_modules/ms/readme.md
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# ms
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
|
||||||
|
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
|
||||||
|
|
||||||
|
Use this package to easily convert various time formats to milliseconds.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
ms('2 days') // 172800000
|
||||||
|
ms('1d') // 86400000
|
||||||
|
ms('10h') // 36000000
|
||||||
|
ms('2.5 hrs') // 9000000
|
||||||
|
ms('2h') // 7200000
|
||||||
|
ms('1m') // 60000
|
||||||
|
ms('5s') // 5000
|
||||||
|
ms('1y') // 31557600000
|
||||||
|
ms('100') // 100
|
||||||
|
```
|
||||||
|
|
||||||
|
### Convert from milliseconds
|
||||||
|
|
||||||
|
```js
|
||||||
|
ms(60000) // "1m"
|
||||||
|
ms(2 * 60000) // "2m"
|
||||||
|
ms(ms('10 hours')) // "10h"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Time format written-out
|
||||||
|
|
||||||
|
```js
|
||||||
|
ms(60000, { long: true }) // "1 minute"
|
||||||
|
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||||
|
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Works both in [node](https://nodejs.org) and in the browser.
|
||||||
|
- If a number is supplied to `ms`, a string with a unit is returned.
|
||||||
|
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
|
||||||
|
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
|
||||||
|
|
||||||
|
## Caught a bug?
|
||||||
|
|
||||||
|
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||||
|
2. Link the package to the global module directory: `npm link`
|
||||||
|
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
||||||
|
|
||||||
|
As always, you can run the tests using: `npm test`
|
30
code/code/node_modules/body-parser/node_modules/qs/.editorconfig
generated
vendored
Normal file
30
code/code/node_modules/body-parser/node_modules/qs/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 160
|
||||||
|
|
||||||
|
[test/*]
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
|
[CHANGELOG.md]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[LICENSE]
|
||||||
|
indent_size = 2
|
||||||
|
max_line_length = off
|
1
code/code/node_modules/body-parser/node_modules/qs/.eslintignore
generated
vendored
Normal file
1
code/code/node_modules/body-parser/node_modules/qs/.eslintignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
dist
|
21
code/code/node_modules/body-parser/node_modules/qs/.eslintrc
generated
vendored
Normal file
21
code/code/node_modules/body-parser/node_modules/qs/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"complexity": 0,
|
||||||
|
"consistent-return": 1,
|
||||||
|
"func-name-matching": 0,
|
||||||
|
"id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
|
||||||
|
"indent": [2, 4],
|
||||||
|
"max-lines-per-function": [2, { "max": 150 }],
|
||||||
|
"max-params": [2, 14],
|
||||||
|
"max-statements": [2, 52],
|
||||||
|
"multiline-comment-style": 0,
|
||||||
|
"no-continue": 1,
|
||||||
|
"no-magic-numbers": 0,
|
||||||
|
"no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
|
||||||
|
"operator-linebreak": [2, "before"],
|
||||||
|
}
|
||||||
|
}
|
256
code/code/node_modules/body-parser/node_modules/qs/CHANGELOG.md
generated
vendored
Normal file
256
code/code/node_modules/body-parser/node_modules/qs/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
## **6.7.0**
|
||||||
|
- [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219)
|
||||||
|
- [Fix] correctly parse nested arrays (#212)
|
||||||
|
- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source, also with an array source
|
||||||
|
- [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty`
|
||||||
|
- [Refactor] `utils`: `isBuffer`: small tweak; add tests
|
||||||
|
- [Refactor] use cached `Array.isArray`
|
||||||
|
- [Refactor] `parse`/`stringify`: make a function to normalize the options
|
||||||
|
- [Refactor] `utils`: reduce observable [[Get]]s
|
||||||
|
- [Refactor] `stringify`/`utils`: cache `Array.isArray`
|
||||||
|
- [Tests] always use `String(x)` over `x.toString()`
|
||||||
|
- [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10
|
||||||
|
- [Tests] temporarily allow coverage to fail
|
||||||
|
|
||||||
|
## **6.6.0**
|
||||||
|
- [New] Add support for iso-8859-1, utf8 "sentinel" and numeric entities (#268)
|
||||||
|
- [New] move two-value combine to a `utils` function (#189)
|
||||||
|
- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279)
|
||||||
|
- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` (#260)
|
||||||
|
- [Fix] `stringify`: do not crash in an obscure combo of `interpretNumericEntities`, a bad custom `decoder`, & `iso-8859-1`
|
||||||
|
- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided
|
||||||
|
- [refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269)
|
||||||
|
- [Refactor] `parse`: only need to reassign the var once
|
||||||
|
- [Refactor] `parse`/`stringify`: clean up `charset` options checking; fix defaults
|
||||||
|
- [Refactor] add missing defaults
|
||||||
|
- [Refactor] `parse`: one less `concat` call
|
||||||
|
- [Refactor] `utils`: `compactQueue`: make it explicitly side-effecting
|
||||||
|
- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `iconv-lite`, `safe-publish-latest`, `tape`
|
||||||
|
- [Tests] up to `node` `v10.10`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; pin included builds to LTS
|
||||||
|
|
||||||
|
## **6.5.2**
|
||||||
|
- [Fix] use `safer-buffer` instead of `Buffer` constructor
|
||||||
|
- [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230)
|
||||||
|
- [Dev Deps] update `browserify`, `eslint`, `iconv-lite`, `safer-buffer`, `tape`, `browserify`
|
||||||
|
|
||||||
|
## **6.5.1**
|
||||||
|
- [Fix] Fix parsing & compacting very deep objects (#224)
|
||||||
|
- [Refactor] name utils functions
|
||||||
|
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`
|
||||||
|
- [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node
|
||||||
|
- [Tests] Use precise dist for Node.js 0.6 runtime (#225)
|
||||||
|
- [Tests] make 0.6 required, now that it’s passing
|
||||||
|
- [Tests] on `node` `v8.2`; fix npm on node 0.6
|
||||||
|
|
||||||
|
## **6.5.0**
|
||||||
|
- [New] add `utils.assign`
|
||||||
|
- [New] pass default encoder/decoder to custom encoder/decoder functions (#206)
|
||||||
|
- [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213)
|
||||||
|
- [Fix] Handle stringifying empty objects with addQueryPrefix (#217)
|
||||||
|
- [Fix] do not mutate `options` argument (#207)
|
||||||
|
- [Refactor] `parse`: cache index to reuse in else statement (#182)
|
||||||
|
- [Docs] add various badges to readme (#208)
|
||||||
|
- [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape`
|
||||||
|
- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4
|
||||||
|
- [Tests] add `editorconfig-tools`
|
||||||
|
|
||||||
|
## **6.4.0**
|
||||||
|
- [New] `qs.stringify`: add `encodeValuesOnly` option
|
||||||
|
- [Fix] follow `allowPrototypes` option during merge (#201, #201)
|
||||||
|
- [Fix] support keys starting with brackets (#202, #200)
|
||||||
|
- [Fix] chmod a-x
|
||||||
|
- [Dev Deps] update `eslint`
|
||||||
|
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
|
||||||
|
- [eslint] reduce warnings
|
||||||
|
|
||||||
|
## **6.3.2**
|
||||||
|
- [Fix] follow `allowPrototypes` option during merge (#201, #200)
|
||||||
|
- [Dev Deps] update `eslint`
|
||||||
|
- [Fix] chmod a-x
|
||||||
|
- [Fix] support keys starting with brackets (#202, #200)
|
||||||
|
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
|
||||||
|
|
||||||
|
## **6.3.1**
|
||||||
|
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!)
|
||||||
|
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape`
|
||||||
|
- [Tests] on all node minors; improve test matrix
|
||||||
|
- [Docs] document stringify option `allowDots` (#195)
|
||||||
|
- [Docs] add empty object and array values example (#195)
|
||||||
|
- [Docs] Fix minor inconsistency/typo (#192)
|
||||||
|
- [Docs] document stringify option `sort` (#191)
|
||||||
|
- [Refactor] `stringify`: throw faster with an invalid encoder
|
||||||
|
- [Refactor] remove unnecessary escapes (#184)
|
||||||
|
- Remove contributing.md, since `qs` is no longer part of `hapi` (#183)
|
||||||
|
|
||||||
|
## **6.3.0**
|
||||||
|
- [New] Add support for RFC 1738 (#174, #173)
|
||||||
|
- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159)
|
||||||
|
- [Fix] ensure `utils.merge` handles merging two arrays
|
||||||
|
- [Refactor] only constructors should be capitalized
|
||||||
|
- [Refactor] capitalized var names are for constructors only
|
||||||
|
- [Refactor] avoid using a sparse array
|
||||||
|
- [Robustness] `formats`: cache `String#replace`
|
||||||
|
- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest`
|
||||||
|
- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix
|
||||||
|
- [Tests] flesh out arrayLimit/arrayFormat tests (#107)
|
||||||
|
- [Tests] skip Object.create tests when null objects are not available
|
||||||
|
- [Tests] Turn on eslint for test files (#175)
|
||||||
|
|
||||||
|
## **6.2.3**
|
||||||
|
- [Fix] follow `allowPrototypes` option during merge (#201, #200)
|
||||||
|
- [Fix] chmod a-x
|
||||||
|
- [Fix] support keys starting with brackets (#202, #200)
|
||||||
|
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
|
||||||
|
|
||||||
|
## **6.2.2**
|
||||||
|
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties
|
||||||
|
|
||||||
|
## **6.2.1**
|
||||||
|
- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values
|
||||||
|
- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call`
|
||||||
|
- [Tests] remove `parallelshell` since it does not reliably report failures
|
||||||
|
- [Tests] up to `node` `v6.3`, `v5.12`
|
||||||
|
- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv`
|
||||||
|
|
||||||
|
## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed)
|
||||||
|
- [New] pass Buffers to the encoder/decoder directly (#161)
|
||||||
|
- [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160)
|
||||||
|
- [Fix] fix compacting of nested sparse arrays (#150)
|
||||||
|
|
||||||
|
## **6.1.2
|
||||||
|
- [Fix] follow `allowPrototypes` option during merge (#201, #200)
|
||||||
|
- [Fix] chmod a-x
|
||||||
|
- [Fix] support keys starting with brackets (#202, #200)
|
||||||
|
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
|
||||||
|
|
||||||
|
## **6.1.1**
|
||||||
|
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties
|
||||||
|
|
||||||
|
## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed)
|
||||||
|
- [New] allowDots option for `stringify` (#151)
|
||||||
|
- [Fix] "sort" option should work at a depth of 3 or more (#151)
|
||||||
|
- [Fix] Restore `dist` directory; will be removed in v7 (#148)
|
||||||
|
|
||||||
|
## **6.0.4**
|
||||||
|
- [Fix] follow `allowPrototypes` option during merge (#201, #200)
|
||||||
|
- [Fix] chmod a-x
|
||||||
|
- [Fix] support keys starting with brackets (#202, #200)
|
||||||
|
- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
|
||||||
|
|
||||||
|
## **6.0.3**
|
||||||
|
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties
|
||||||
|
- [Fix] Restore `dist` directory; will be removed in v7 (#148)
|
||||||
|
|
||||||
|
## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed)
|
||||||
|
- Revert ES6 requirement and restore support for node down to v0.8.
|
||||||
|
|
||||||
|
## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed)
|
||||||
|
- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json
|
||||||
|
|
||||||
|
## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed)
|
||||||
|
- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4
|
||||||
|
|
||||||
|
## **5.2.1**
|
||||||
|
- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values
|
||||||
|
|
||||||
|
## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed)
|
||||||
|
- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string
|
||||||
|
|
||||||
|
## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed)
|
||||||
|
- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional
|
||||||
|
- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify
|
||||||
|
|
||||||
|
## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed)
|
||||||
|
- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false
|
||||||
|
- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm
|
||||||
|
|
||||||
|
## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed)
|
||||||
|
- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional
|
||||||
|
|
||||||
|
## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed)
|
||||||
|
- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation"
|
||||||
|
|
||||||
|
## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed)
|
||||||
|
- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties
|
||||||
|
- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost
|
||||||
|
- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing
|
||||||
|
- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object
|
||||||
|
- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option
|
||||||
|
- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects.
|
||||||
|
- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47
|
||||||
|
- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986
|
||||||
|
- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign
|
||||||
|
- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute
|
||||||
|
|
||||||
|
## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed)
|
||||||
|
- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object #<Object> is not a function
|
||||||
|
|
||||||
|
## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed)
|
||||||
|
- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option
|
||||||
|
|
||||||
|
## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed)
|
||||||
|
- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57
|
||||||
|
- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader
|
||||||
|
|
||||||
|
## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed)
|
||||||
|
- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object
|
||||||
|
|
||||||
|
## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed)
|
||||||
|
- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError".
|
||||||
|
|
||||||
|
## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed)
|
||||||
|
- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46
|
||||||
|
|
||||||
|
## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed)
|
||||||
|
- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer?
|
||||||
|
- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45
|
||||||
|
- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39
|
||||||
|
|
||||||
|
## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed)
|
||||||
|
- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number
|
||||||
|
|
||||||
|
## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed)
|
||||||
|
- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array
|
||||||
|
- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x
|
||||||
|
|
||||||
|
## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed)
|
||||||
|
- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value
|
||||||
|
- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty
|
||||||
|
- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver?
|
||||||
|
|
||||||
|
## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed)
|
||||||
|
- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31
|
||||||
|
- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects
|
||||||
|
|
||||||
|
## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed)
|
||||||
|
- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present
|
||||||
|
- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays
|
||||||
|
- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge
|
||||||
|
- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters?
|
||||||
|
|
||||||
|
## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed)
|
||||||
|
- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter
|
||||||
|
|
||||||
|
## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed)
|
||||||
|
- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit?
|
||||||
|
- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit
|
||||||
|
- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20
|
||||||
|
|
||||||
|
## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed)
|
||||||
|
- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values
|
||||||
|
|
||||||
|
## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed)
|
||||||
|
- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters
|
||||||
|
- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block
|
||||||
|
|
||||||
|
## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed)
|
||||||
|
- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument
|
||||||
|
- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed
|
||||||
|
|
||||||
|
## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed)
|
||||||
|
- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted
|
||||||
|
- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null
|
||||||
|
- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README
|
||||||
|
|
||||||
|
## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed)
|
||||||
|
- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index
|
28
code/code/node_modules/body-parser/node_modules/qs/LICENSE
generated
vendored
Normal file
28
code/code/node_modules/body-parser/node_modules/qs/LICENSE
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Copyright (c) 2014 Nathan LaFreniere and other contributors.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* The names of any contributors may not be used to endorse or promote
|
||||||
|
products derived from this software without specific prior written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
The complete list of contributors can be found at: https://github.com/hapijs/qs/graphs/contributors
|
570
code/code/node_modules/body-parser/node_modules/qs/README.md
generated
vendored
Normal file
570
code/code/node_modules/body-parser/node_modules/qs/README.md
generated
vendored
Normal file
@ -0,0 +1,570 @@
|
|||||||
|
# qs <sup>[![Version Badge][2]][1]</sup>
|
||||||
|
|
||||||
|
[![Build Status][3]][4]
|
||||||
|
[![dependency status][5]][6]
|
||||||
|
[![dev dependency status][7]][8]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][11]][1]
|
||||||
|
|
||||||
|
A querystring parsing and stringifying library with some added security.
|
||||||
|
|
||||||
|
Lead Maintainer: [Jordan Harband](https://github.com/ljharb)
|
||||||
|
|
||||||
|
The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var qs = require('qs');
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var obj = qs.parse('a=c');
|
||||||
|
assert.deepEqual(obj, { a: 'c' });
|
||||||
|
|
||||||
|
var str = qs.stringify(obj);
|
||||||
|
assert.equal(str, 'a=c');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parsing Objects
|
||||||
|
|
||||||
|
[](#preventEval)
|
||||||
|
```javascript
|
||||||
|
qs.parse(string, [options]);
|
||||||
|
```
|
||||||
|
|
||||||
|
**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`.
|
||||||
|
For example, the string `'foo[bar]=baz'` converts to:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.deepEqual(qs.parse('foo[bar]=baz'), {
|
||||||
|
foo: {
|
||||||
|
bar: 'baz'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true });
|
||||||
|
assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true });
|
||||||
|
assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
URI encoded strings work too:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.deepEqual(qs.parse('a%5Bb%5D=c'), {
|
||||||
|
a: { b: 'c' }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), {
|
||||||
|
foo: {
|
||||||
|
bar: {
|
||||||
|
baz: 'foobarbaz'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like
|
||||||
|
`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var expected = {
|
||||||
|
a: {
|
||||||
|
b: {
|
||||||
|
c: {
|
||||||
|
d: {
|
||||||
|
e: {
|
||||||
|
f: {
|
||||||
|
'[g][h][i]': 'j'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var string = 'a[b][c][d][e][f][g][h][i]=j';
|
||||||
|
assert.deepEqual(qs.parse(string), expected);
|
||||||
|
```
|
||||||
|
|
||||||
|
This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 });
|
||||||
|
assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } });
|
||||||
|
```
|
||||||
|
|
||||||
|
The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number.
|
||||||
|
|
||||||
|
For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var limited = qs.parse('a=b&c=d', { parameterLimit: 1 });
|
||||||
|
assert.deepEqual(limited, { a: 'b' });
|
||||||
|
```
|
||||||
|
|
||||||
|
To bypass the leading question mark, use `ignoreQueryPrefix`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true });
|
||||||
|
assert.deepEqual(prefixed, { a: 'b', c: 'd' });
|
||||||
|
```
|
||||||
|
|
||||||
|
An optional delimiter can also be passed:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var delimited = qs.parse('a=b;c=d', { delimiter: ';' });
|
||||||
|
assert.deepEqual(delimited, { a: 'b', c: 'd' });
|
||||||
|
```
|
||||||
|
|
||||||
|
Delimiters can be a regular expression too:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ });
|
||||||
|
assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' });
|
||||||
|
```
|
||||||
|
|
||||||
|
Option `allowDots` can be used to enable dot notation:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withDots = qs.parse('a.b=c', { allowDots: true });
|
||||||
|
assert.deepEqual(withDots, { a: { b: 'c' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have to deal with legacy browsers or services, there's
|
||||||
|
also support for decoding percent-encoded octets as iso-8859-1:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var oldCharset = qs.parse('a=%A7', { charset: 'iso-8859-1' });
|
||||||
|
assert.deepEqual(oldCharset, { a: '§' });
|
||||||
|
```
|
||||||
|
|
||||||
|
Some services add an initial `utf8=✓` value to forms so that old
|
||||||
|
Internet Explorer versions are more likely to submit the form as
|
||||||
|
utf-8. Additionally, the server can check the value against wrong
|
||||||
|
encodings of the checkmark character and detect that a query string
|
||||||
|
or `application/x-www-form-urlencoded` body was *not* sent as
|
||||||
|
utf-8, eg. if the form had an `accept-charset` parameter or the
|
||||||
|
containing page had a different character set.
|
||||||
|
|
||||||
|
**qs** supports this mechanism via the `charsetSentinel` option.
|
||||||
|
If specified, the `utf8` parameter will be omitted from the
|
||||||
|
returned object. It will be used to switch to `iso-8859-1`/`utf-8`
|
||||||
|
mode depending on how the checkmark is encoded.
|
||||||
|
|
||||||
|
**Important**: When you specify both the `charset` option and the
|
||||||
|
`charsetSentinel` option, the `charset` will be overridden when
|
||||||
|
the request contains a `utf8` parameter from which the actual
|
||||||
|
charset can be deduced. In that sense the `charset` will behave
|
||||||
|
as the default charset rather than the authoritative charset.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var detectedAsUtf8 = qs.parse('utf8=%E2%9C%93&a=%C3%B8', {
|
||||||
|
charset: 'iso-8859-1',
|
||||||
|
charsetSentinel: true
|
||||||
|
});
|
||||||
|
assert.deepEqual(detectedAsUtf8, { a: 'ø' });
|
||||||
|
|
||||||
|
// Browsers encode the checkmark as ✓ when submitting as iso-8859-1:
|
||||||
|
var detectedAsIso8859_1 = qs.parse('utf8=%26%2310003%3B&a=%F8', {
|
||||||
|
charset: 'utf-8',
|
||||||
|
charsetSentinel: true
|
||||||
|
});
|
||||||
|
assert.deepEqual(detectedAsIso8859_1, { a: 'ø' });
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to decode the `&#...;` syntax to the actual character,
|
||||||
|
you can specify the `interpretNumericEntities` option as well:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var detectedAsIso8859_1 = qs.parse('a=%26%239786%3B', {
|
||||||
|
charset: 'iso-8859-1',
|
||||||
|
interpretNumericEntities: true
|
||||||
|
});
|
||||||
|
assert.deepEqual(detectedAsIso8859_1, { a: '☺' });
|
||||||
|
```
|
||||||
|
|
||||||
|
It also works when the charset has been detected in `charsetSentinel`
|
||||||
|
mode.
|
||||||
|
|
||||||
|
### Parsing Arrays
|
||||||
|
|
||||||
|
**qs** can also parse arrays using a similar `[]` notation:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withArray = qs.parse('a[]=b&a[]=c');
|
||||||
|
assert.deepEqual(withArray, { a: ['b', 'c'] });
|
||||||
|
```
|
||||||
|
|
||||||
|
You may specify an index as well:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withIndexes = qs.parse('a[1]=c&a[0]=b');
|
||||||
|
assert.deepEqual(withIndexes, { a: ['b', 'c'] });
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number
|
||||||
|
to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving
|
||||||
|
their order:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var noSparse = qs.parse('a[1]=b&a[15]=c');
|
||||||
|
assert.deepEqual(noSparse, { a: ['b', 'c'] });
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that an empty string is also a value, and will be preserved:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withEmptyString = qs.parse('a[]=&a[]=b');
|
||||||
|
assert.deepEqual(withEmptyString, { a: ['', 'b'] });
|
||||||
|
|
||||||
|
var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c');
|
||||||
|
assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] });
|
||||||
|
```
|
||||||
|
|
||||||
|
**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will
|
||||||
|
instead be converted to an object with the index as the key. This is needed to handle cases when someone sent, for example, `a[999999999]` and it will take significant time to iterate over this huge array.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withMaxIndex = qs.parse('a[100]=b');
|
||||||
|
assert.deepEqual(withMaxIndex, { a: { '100': 'b' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
This limit can be overridden by passing an `arrayLimit` option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 });
|
||||||
|
assert.deepEqual(withArrayLimit, { a: { '1': 'b' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
To disable array parsing entirely, set `parseArrays` to `false`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var noParsingArrays = qs.parse('a[]=b', { parseArrays: false });
|
||||||
|
assert.deepEqual(noParsingArrays, { a: { '0': 'b' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
If you mix notations, **qs** will merge the two items into an object:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var mixedNotation = qs.parse('a[0]=b&a[b]=c');
|
||||||
|
assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } });
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also create arrays of objects:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var arraysOfObjects = qs.parse('a[][b]=c');
|
||||||
|
assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] });
|
||||||
|
```
|
||||||
|
|
||||||
|
Some people use comma to join array, **qs** can parse it:
|
||||||
|
```javascript
|
||||||
|
var arraysOfObjects = qs.parse('a=b,c', { comma: true })
|
||||||
|
assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] })
|
||||||
|
```
|
||||||
|
(_this cannot convert nested objects, such as `a={b:1},{c:d}`_)
|
||||||
|
|
||||||
|
### Stringifying
|
||||||
|
|
||||||
|
[](#preventEval)
|
||||||
|
```javascript
|
||||||
|
qs.stringify(object, [options]);
|
||||||
|
```
|
||||||
|
|
||||||
|
When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: 'b' }), 'a=b');
|
||||||
|
assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c');
|
||||||
|
```
|
||||||
|
|
||||||
|
This encoding can be disabled by setting the `encode` option to `false`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false });
|
||||||
|
assert.equal(unencoded, 'a[b]=c');
|
||||||
|
```
|
||||||
|
|
||||||
|
Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`:
|
||||||
|
```javascript
|
||||||
|
var encodedValues = qs.stringify(
|
||||||
|
{ a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] },
|
||||||
|
{ encodeValuesOnly: true }
|
||||||
|
);
|
||||||
|
assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h');
|
||||||
|
```
|
||||||
|
|
||||||
|
This encoding can also be replaced by a custom encoding method set as `encoder` option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) {
|
||||||
|
// Passed in values `a`, `b`, `c`
|
||||||
|
return // Return encoded string
|
||||||
|
}})
|
||||||
|
```
|
||||||
|
|
||||||
|
_(Note: the `encoder` option does not apply if `encode` is `false`)_
|
||||||
|
|
||||||
|
Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var decoded = qs.parse('x=z', { decoder: function (str) {
|
||||||
|
// Passed in values `x`, `z`
|
||||||
|
return // Return decoded string
|
||||||
|
}})
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage.
|
||||||
|
|
||||||
|
When arrays are stringified, by default they are given explicit indices:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
qs.stringify({ a: ['b', 'c', 'd'] });
|
||||||
|
// 'a[0]=b&a[1]=c&a[2]=d'
|
||||||
|
```
|
||||||
|
|
||||||
|
You may override this by setting the `indices` option to `false`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false });
|
||||||
|
// 'a=b&a=c&a=d'
|
||||||
|
```
|
||||||
|
|
||||||
|
You may use the `arrayFormat` option to specify the format of the output array:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' })
|
||||||
|
// 'a[0]=b&a[1]=c'
|
||||||
|
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' })
|
||||||
|
// 'a[]=b&a[]=c'
|
||||||
|
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' })
|
||||||
|
// 'a=b&a=c'
|
||||||
|
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' })
|
||||||
|
// 'a=b,c'
|
||||||
|
```
|
||||||
|
|
||||||
|
When objects are stringified, by default they use bracket notation:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
qs.stringify({ a: { b: { c: 'd', e: 'f' } } });
|
||||||
|
// 'a[b][c]=d&a[b][e]=f'
|
||||||
|
```
|
||||||
|
|
||||||
|
You may override this to use dot notation by setting the `allowDots` option to `true`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true });
|
||||||
|
// 'a.b.c=d&a.b.e=f'
|
||||||
|
```
|
||||||
|
|
||||||
|
Empty strings and null values will omit the value, but the equals sign (=) remains in place:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: '' }), 'a=');
|
||||||
|
```
|
||||||
|
|
||||||
|
Key with no values (such as an empty object or array) will return nothing:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: [] }), '');
|
||||||
|
assert.equal(qs.stringify({ a: {} }), '');
|
||||||
|
assert.equal(qs.stringify({ a: [{}] }), '');
|
||||||
|
assert.equal(qs.stringify({ a: { b: []} }), '');
|
||||||
|
assert.equal(qs.stringify({ a: { b: {}} }), '');
|
||||||
|
```
|
||||||
|
|
||||||
|
Properties that are set to `undefined` will be omitted entirely:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: null, b: undefined }), 'a=');
|
||||||
|
```
|
||||||
|
|
||||||
|
The query string may optionally be prepended with a question mark:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d');
|
||||||
|
```
|
||||||
|
|
||||||
|
The delimiter may be overridden with stringify as well:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d');
|
||||||
|
```
|
||||||
|
|
||||||
|
If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var date = new Date(7);
|
||||||
|
assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A'));
|
||||||
|
assert.equal(
|
||||||
|
qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }),
|
||||||
|
'a=7'
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
You may use the `sort` option to affect the order of parameter keys:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
function alphabeticalSort(a, b) {
|
||||||
|
return a.localeCompare(b);
|
||||||
|
}
|
||||||
|
assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y');
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, you can use the `filter` option to restrict which keys will be included in the stringified output.
|
||||||
|
If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you
|
||||||
|
pass an array, it will be used to select properties and array indices for stringification:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
function filterFunc(prefix, value) {
|
||||||
|
if (prefix == 'b') {
|
||||||
|
// Return an `undefined` value to omit a property.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (prefix == 'e[f]') {
|
||||||
|
return value.getTime();
|
||||||
|
}
|
||||||
|
if (prefix == 'e[g][0]') {
|
||||||
|
return value * 2;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc });
|
||||||
|
// 'a=b&c=d&e[f]=123&e[g][0]=4'
|
||||||
|
qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] });
|
||||||
|
// 'a=b&e=f'
|
||||||
|
qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] });
|
||||||
|
// 'a[0]=b&a[2]=d'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Handling of `null` values
|
||||||
|
|
||||||
|
By default, `null` values are treated like empty strings:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var withNull = qs.stringify({ a: null, b: '' });
|
||||||
|
assert.equal(withNull, 'a=&b=');
|
||||||
|
```
|
||||||
|
|
||||||
|
Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var equalsInsensitive = qs.parse('a&b=');
|
||||||
|
assert.deepEqual(equalsInsensitive, { a: '', b: '' });
|
||||||
|
```
|
||||||
|
|
||||||
|
To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null`
|
||||||
|
values have no `=` sign:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true });
|
||||||
|
assert.equal(strictNull, 'a&b=');
|
||||||
|
```
|
||||||
|
|
||||||
|
To parse values without `=` back to `null` use the `strictNullHandling` flag:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true });
|
||||||
|
assert.deepEqual(parsedStrictNull, { a: null, b: '' });
|
||||||
|
```
|
||||||
|
|
||||||
|
To completely skip rendering keys with `null` values, use the `skipNulls` flag:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true });
|
||||||
|
assert.equal(nullsSkipped, 'a=b');
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're communicating with legacy systems, you can switch to `iso-8859-1`
|
||||||
|
using the `charset` option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var iso = qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' });
|
||||||
|
assert.equal(iso, '%E6=%E6');
|
||||||
|
```
|
||||||
|
|
||||||
|
Characters that don't exist in `iso-8859-1` will be converted to numeric
|
||||||
|
entities, similar to what browsers do:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var numeric = qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' });
|
||||||
|
assert.equal(numeric, 'a=%26%239786%3B');
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use the `charsetSentinel` option to announce the character by
|
||||||
|
including an `utf8=✓` parameter with the proper encoding if the checkmark,
|
||||||
|
similar to what Ruby on Rails and others do when submitting forms.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var sentinel = qs.stringify({ a: '☺' }, { charsetSentinel: true });
|
||||||
|
assert.equal(sentinel, 'utf8=%E2%9C%93&a=%E2%98%BA');
|
||||||
|
|
||||||
|
var isoSentinel = qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' });
|
||||||
|
assert.equal(isoSentinel, 'utf8=%26%2310003%3B&a=%E6');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dealing with special character sets
|
||||||
|
|
||||||
|
By default the encoding and decoding of characters is done in `utf-8`,
|
||||||
|
and `iso-8859-1` support is also built in via the `charset` parameter.
|
||||||
|
|
||||||
|
If you wish to encode querystrings to a different character set (i.e.
|
||||||
|
[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the
|
||||||
|
[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var encoder = require('qs-iconv/encoder')('shift_jis');
|
||||||
|
var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder });
|
||||||
|
assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I');
|
||||||
|
```
|
||||||
|
|
||||||
|
This also works for decoding of query strings:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var decoder = require('qs-iconv/decoder')('shift_jis');
|
||||||
|
var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder });
|
||||||
|
assert.deepEqual(obj, { a: 'こんにちは!' });
|
||||||
|
```
|
||||||
|
|
||||||
|
### RFC 3986 and RFC 1738 space encoding
|
||||||
|
|
||||||
|
RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible.
|
||||||
|
In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'.
|
||||||
|
|
||||||
|
```
|
||||||
|
assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c');
|
||||||
|
assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c');
|
||||||
|
assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c');
|
||||||
|
```
|
||||||
|
|
||||||
|
[1]: https://npmjs.org/package/qs
|
||||||
|
[2]: http://versionbadg.es/ljharb/qs.svg
|
||||||
|
[3]: https://api.travis-ci.org/ljharb/qs.svg
|
||||||
|
[4]: https://travis-ci.org/ljharb/qs
|
||||||
|
[5]: https://david-dm.org/ljharb/qs.svg
|
||||||
|
[6]: https://david-dm.org/ljharb/qs
|
||||||
|
[7]: https://david-dm.org/ljharb/qs/dev-status.svg
|
||||||
|
[8]: https://david-dm.org/ljharb/qs?type=dev
|
||||||
|
[9]: https://ci.testling.com/ljharb/qs.png
|
||||||
|
[10]: https://ci.testling.com/ljharb/qs
|
||||||
|
[11]: https://nodei.co/npm/qs.png?downloads=true&stars=true
|
||||||
|
[license-image]: http://img.shields.io/npm/l/qs.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: http://img.shields.io/npm/dm/qs.svg
|
||||||
|
[downloads-url]: http://npm-stat.com/charts.html?package=qs
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user