Erste Funktionalität der Menükarte per GET/POST, keine API; Umstrukturierung der Tabelle als Bootstrap-div; HTML/CSS-Cleanup
This commit is contained in:
286
data/menu.json
Normal file
286
data/menu.json
Normal file
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"food": [
|
||||
{
|
||||
"name": "Vorspeisen",
|
||||
"anchor": "vorspeise",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reis-alat",
|
||||
"price": 5.50,
|
||||
"desc": "Frischer Blattsalat mit Basmati-Reis und würzigem Balsamico"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bauernfrühstück",
|
||||
"price": 6.40,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse"
|
||||
},
|
||||
{
|
||||
"name": "Thailändisches Arbeiterfrühstück",
|
||||
"price": 7.40,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse und Hähnchen"
|
||||
},
|
||||
{
|
||||
"name": "Viatnamesisches Denkerfrühstück",
|
||||
"price": 7.90,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse und Ente"
|
||||
},
|
||||
{
|
||||
"name": "90er-Reis-Plattenscheibe",
|
||||
"price": 51.90,
|
||||
"desc": "Für Retrofreunde die seltene Platte \"Blue Eyes\" von \"Brooky Ryes\" bestückt mit 5 verschiedenen Reissorten dazu etwas Gemüse in Vinyl-Optik"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Suppen",
|
||||
"anchor": "suppe",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reis-uppe",
|
||||
"price": 3.90,
|
||||
"desc": "Köstliche, klare Hühnerbrühe mit einem Schuss Soja und Reis"
|
||||
},
|
||||
{
|
||||
"name": "Tomatensuppe",
|
||||
"price": 4.20,
|
||||
"desc": "Cremige Tomatensuppe mit frischen Tomaten, Rahm und Reis sowie einer leckeren Petersilie als Dekör"
|
||||
},
|
||||
{
|
||||
"name": "Üppige Suppe",
|
||||
"price": 2.20,
|
||||
"desc": "Üppige Suppe mit üppigem Gemüse gewuppt mit zerruppten Gestrüpp"
|
||||
},
|
||||
{
|
||||
"name": "Henker's Mahlzeit",
|
||||
"price": 6.80,
|
||||
"desc": "Roter Reis mit scharfem Chili mit tomaten und roter Paprika"
|
||||
},
|
||||
{
|
||||
"name": "Nudelsuppe",
|
||||
"price": 3.30,
|
||||
"desc": "Leissuppe mit liesigel Poltion klingliger Knödel"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Hauptspeisen",
|
||||
"anchor": "hauptspeise",
|
||||
"items": [
|
||||
{
|
||||
"name": "Grillplatte \"China\"",
|
||||
"price": 11.20,
|
||||
"desc": "Ein großes, paniertes Schnitzel in Form des Landes china dazu Tibet-formender Reis, Ente im Pazifik und Kähnchen als Peking geformt"
|
||||
},
|
||||
{
|
||||
"name": "Reis mit Reis",
|
||||
"price": 14.80,
|
||||
"desc": "Reis mit Reis dazu Reis als Beilage in Kombination mit Reis und Reis"
|
||||
},
|
||||
{
|
||||
"name": "O'jeh-gerl-schnitzel",
|
||||
"price": 13.50,
|
||||
"desc": "Deutsches Jägerschnitzel nach Art des Hauses mit Reis als Beilage"
|
||||
},
|
||||
{
|
||||
"name": "RisiBisi",
|
||||
"price": 17.30,
|
||||
"desc": "Lila Reis aus kontrolliertem Bio-Anbau mit knallgrünen erbsen, orangene Paprika und gelber Mais als Beilage mit sauerstoffarmem, blauem Schweinefleisch von glücklichen Tieren"
|
||||
},
|
||||
{
|
||||
"name": "Burger Duck",
|
||||
"price": 14.20,
|
||||
"desc": "Saftiger Burger mit aufregenden Gewürzen, Gewürzgurken, Gurken, Tomaten, BBQ-Sauce und knusprig überbackenem Entenfleisch, dazu Reis"
|
||||
},
|
||||
{
|
||||
"name": "Money Boy",
|
||||
"price": 95.90,
|
||||
"desc": "Goldfarbener Reis mit mit in Gold überzogener Hähnchenbrust in Champagner-Soße dazu goldfarbenes Brot aus Provìnce de uberteuereé"
|
||||
},
|
||||
{
|
||||
"name": "Reis-otto",
|
||||
"price": 11.60,
|
||||
"desc": "Risotto mit Brokkoli und Schinken, dazu etwas Parmesan und Thymian"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Junior-Reisesser",
|
||||
"anchor": "junior",
|
||||
"items": [
|
||||
{
|
||||
"name": "\"Chinesischer Seeräuber\"-Teller",
|
||||
"price": 0,
|
||||
"desc": "Ein Messer, eine Gabel, ein Teller und nur eine Aufgabe: Das Essen des Nachbars! (auf Wunsch mit Seeräuber-Hut)"
|
||||
},
|
||||
{
|
||||
"name": "Käpt'n Reisbart",
|
||||
"price": 7.70,
|
||||
"desc": "Süß-Sauer-Soße mit Hähnchenschiffchen in Reis gebadet"
|
||||
},
|
||||
{
|
||||
"name": "Spagetti Reisonese",
|
||||
"price": 5.60,
|
||||
"desc": "Spaghetti mit Tomatensoße und Reis"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Desserts",
|
||||
"anchor": "dessert",
|
||||
"items": [
|
||||
{
|
||||
"name": "Milchreis",
|
||||
"price": 6.30,
|
||||
"desc": "Leckerer Milchreis aus der Tüte vom Großhändler mit heißen Sauerkirschen aus der Konservenbüchse"
|
||||
},
|
||||
{
|
||||
"name": "R-Eis",
|
||||
"price": 4.10,
|
||||
"desc": "Gemischtes Eis mit Kokos-reis-Streumaterial; 3 Kugeln nach Wahl"
|
||||
},
|
||||
{
|
||||
"name": "Eierreiskuchen",
|
||||
"price": 5.00,
|
||||
"desc": "2 köstliche Palatschinken (regional auch Eierkuchen genannt) mit im Teig eingearbeitetetem Reis, dazu feinster Powidl (regional auch Pflaumenmuß) genannt"
|
||||
},
|
||||
{
|
||||
"name": "Süßes Reisotto",
|
||||
"price": 8.70,
|
||||
"desc": "Reis mit bunten Früchten und viel Joghurt, angerichtet mit etweas Zimt und einem Schuss Honig"
|
||||
},
|
||||
{
|
||||
"name": "Reisstrudel",
|
||||
"price": 5.60,
|
||||
"desc": "In Blätterteil gewickelter Reis mit Milchcreme und Minze, dazu Vanillesoße und eine Kugel Vanilleeis"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"drinks": [
|
||||
{
|
||||
"name": "Auf Art des Hauses",
|
||||
"anchor": "haus",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reiswein",
|
||||
"price": 3.90,
|
||||
"desc": "Exquisiter Reiswein mit leiter gelblicher Färbung aus eigener Herstellung mit über 1337 Jahren Erfahrung (Alkoholgehalt 13,37%)"
|
||||
},
|
||||
{
|
||||
"name": "Reisschnaps",
|
||||
"price": 2.10,
|
||||
"desc": "Starker Reisschnaps als Absacker geeignet mit feiner Süße im Abgang (Alkoholgehalt 69%)"
|
||||
},
|
||||
{
|
||||
"name": "Reisbier",
|
||||
"price": 3.50,
|
||||
"desc": "Aus der Reispflanze gewonnenes Bier mit Hopfen nach chinesischem Reinheitsgebot (Alkoholgehalt 4,2%)"
|
||||
},
|
||||
{
|
||||
"name": "Reissud",
|
||||
"price": 1.20,
|
||||
"desc": "Heißer beim Reis kochen entstandener Sud; alkoholfrei, warm und jedes Mal je nach Reissorte ein individueller, neuer Geschmack"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Alkoholfrei",
|
||||
"anchor": "alkoholfrei",
|
||||
"items": [
|
||||
{
|
||||
"name": "Softdrinks (0,5l)",
|
||||
"price": 3.40,
|
||||
"desc": "Verschidene Sorten nur diesen Framstag im Angebot!"
|
||||
},
|
||||
{
|
||||
"name": "Softdrinks (0,3l)",
|
||||
"price": 2.90,
|
||||
"desc": "Verschidene Sorten nur diesen Framstag im Angebot!"
|
||||
},
|
||||
{
|
||||
"name": "Wasser (1l)",
|
||||
"price": 4.10,
|
||||
"desc": "Das Wasser trüb, die Luft ist rein, Franz-Josef muss ertrunken sein."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Alkohol",
|
||||
"anchor": "alkohol",
|
||||
"items": [
|
||||
{
|
||||
"name": "Bier vom Fass (0,5l)",
|
||||
"price": 3.50,
|
||||
"desc": "Wählen sie zwischen Becks, Sternburg und Berliner Kindl"
|
||||
},
|
||||
{
|
||||
"name": "Bier vom Fass (0,3l)",
|
||||
"price": 3.00,
|
||||
"desc": "Wählen sie zwischen Becks, Sternburg und Berliner Kindl"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bier (0,69l)",
|
||||
"price": 2.40,
|
||||
"desc": "Tsingtao-Exportbier"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bier (0,42l)",
|
||||
"price": 1.90,
|
||||
"desc": "Tsingtao-Exportbier"
|
||||
},
|
||||
{
|
||||
"name": "Rislinger Wein (0,2l)",
|
||||
"price": 4.20,
|
||||
"desc": "Asiatischer Wein mit unbekanntem Ursprung aus gezüchteten, von Monsanto genmanipulierten Weintrauben"
|
||||
},
|
||||
{
|
||||
"name": "Radler (0,5l)",
|
||||
"price": 13.20,
|
||||
"desc": "Für echte Vampire"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Spriritus",
|
||||
"anchor": "spirituose",
|
||||
"items": [
|
||||
{
|
||||
"name": "Asiatische Freude",
|
||||
"price": 1.50,
|
||||
"desc": "Auf 45 Grad erwärmter Reisschnaps mit Raucharoma für natürliches Pekinger Stadtklima"
|
||||
},
|
||||
{
|
||||
"name": "Sprit-Tussi",
|
||||
"price": 1.60,
|
||||
"desc": "Diesel (Cola-Bier-Gemisch) in einem 0,1cl-Glas, um es teurer verkaufen zu können"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cocktails",
|
||||
"anchor": "cocktails",
|
||||
"items": [
|
||||
{
|
||||
"name": "Beste Freundschaft",
|
||||
"price": 9.30,
|
||||
"desc": "Lila Livo-Liva mit weißem Rohrzucker und Limettensaft mit frischer, grüner Limette"
|
||||
},
|
||||
{
|
||||
"name": "Schwanz-Schwanz",
|
||||
"price": 5.60,
|
||||
"desc": "Ausgefuchste Kombination von Schwanz und Schwanz des Hans und Franz"
|
||||
},
|
||||
{
|
||||
"name": "Der Reisende",
|
||||
"price": 8.90,
|
||||
"desc": "Du schmeckst eh nichts anderes mehr, so viel Alk ist hier drin, und nach einem davon reist du durch die ganze Welt (zumindest im Kopf)"
|
||||
},
|
||||
{
|
||||
"name": "Pina Reisolada",
|
||||
"price": 6.10,
|
||||
"desc": "Mit Ananas und Kokos aufgemixte Mixtur in Reisschaum, mit Reisschnaps und fast dem ganzen Glas voller Eis"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
286
data/menu.json.example
Normal file
286
data/menu.json.example
Normal file
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"food": [
|
||||
{
|
||||
"name": "Vorspeisen",
|
||||
"anchor": "vorspeise",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reis-alat",
|
||||
"price": 5.50,
|
||||
"desc": "Frischer Blattsalat mit Basmati-Reis und würzigem Balsamico"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bauernfrühstück",
|
||||
"price": 6.40,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse"
|
||||
},
|
||||
{
|
||||
"name": "Thailändisches Arbeiterfrühstück",
|
||||
"price": 7.40,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse und Hähnchen"
|
||||
},
|
||||
{
|
||||
"name": "Viatnamesisches Denkerfrühstück",
|
||||
"price": 7.90,
|
||||
"desc": "Feuriges Chili in gedämpftem, kaltem Reis mit heißem Gemüse und Ente"
|
||||
},
|
||||
{
|
||||
"name": "90er-Reis-Plattenscheibe",
|
||||
"price": 51.90,
|
||||
"desc": "Für Retrofreunde die seltene Platte \"Blue Eyes\" von \"Brooky Ryes\" bestückt mit 5 verschiedenen Reissorten dazu etwas Gemüse in Vinyl-Optik"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Suppen",
|
||||
"anchor": "suppe",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reis-uppe",
|
||||
"price": 3.90,
|
||||
"desc": "Köstliche, klare Hühnerbrühe mit einem Schuss Soja und Reis"
|
||||
},
|
||||
{
|
||||
"name": "Tomatensuppe",
|
||||
"price": 4.20,
|
||||
"desc": "Cremige Tomatensuppe mit frischen Tomaten, Rahm und Reis sowie einer leckeren Petersilie als Dekör"
|
||||
},
|
||||
{
|
||||
"name": "Üppige Suppe",
|
||||
"price": 2.20,
|
||||
"desc": "Üppige Suppe mit üppigem Gemüse gewuppt mit zerruppten Gestrüpp"
|
||||
},
|
||||
{
|
||||
"name": "Henker's Mahlzeit",
|
||||
"price": 6.80,
|
||||
"desc": "Roter Reis mit scharfem Chili mit tomaten und roter Paprika"
|
||||
},
|
||||
{
|
||||
"name": "Nudelsuppe",
|
||||
"price": 3.30,
|
||||
"desc": "Leissuppe mit liesigel Poltion klingliger Knödel"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Hauptspeisen",
|
||||
"anchor": "hauptspeise",
|
||||
"items": [
|
||||
{
|
||||
"name": "Grillplatte \"China\"",
|
||||
"price": 11.20,
|
||||
"desc": "Ein großes, paniertes Schnitzel in Form des Landes china dazu Tibet-formender Reis, Ente im Pazifik und Kähnchen als Peking geformt"
|
||||
},
|
||||
{
|
||||
"name": "Reis mit Reis",
|
||||
"price": 14.80,
|
||||
"desc": "Reis mit Reis dazu Reis als Beilage in Kombination mit Reis und Reis"
|
||||
},
|
||||
{
|
||||
"name": "O'jeh-gerl-schnitzel",
|
||||
"price": 13.50,
|
||||
"desc": "Deutsches Jägerschnitzel nach Art des Hauses mit Reis als Beilage"
|
||||
},
|
||||
{
|
||||
"name": "RisiBisi",
|
||||
"price": 17.30,
|
||||
"desc": "Lila Reis aus kontrolliertem Bio-Anbau mit knallgrünen erbsen, orangene Paprika und gelber Mais als Beilage mit sauerstoffarmem, blauem Schweinefleisch von glücklichen Tieren"
|
||||
},
|
||||
{
|
||||
"name": "Burger Duck",
|
||||
"price": 14.20,
|
||||
"desc": "Saftiger Burger mit aufregenden Gewürzen, Gewürzgurken, Gurken, Tomaten, BBQ-Sauce und knusprig überbackenem Entenfleisch, dazu Reis"
|
||||
},
|
||||
{
|
||||
"name": "Money Boy",
|
||||
"price": 95.90,
|
||||
"desc": "Goldfarbener Reis mit mit in Gold überzogener Hähnchenbrust in Champagner-Soße dazu goldfarbenes Brot aus Provìnce de uberteuereé"
|
||||
},
|
||||
{
|
||||
"name": "Reis-otto",
|
||||
"price": 11.60,
|
||||
"desc": "Risotto mit Brokkoli und Schinken, dazu etwas Parmesan und Thymian"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Junior-Reisesser",
|
||||
"anchor": "junior",
|
||||
"items": [
|
||||
{
|
||||
"name": "\"Chinesischer Seeräuber\"-Teller",
|
||||
"price": 0,
|
||||
"desc": "Ein Messer, eine Gabel, ein Teller und nur eine Aufgabe: Das Essen des Nachbars! (auf Wunsch mit Seeräuber-Hut)"
|
||||
},
|
||||
{
|
||||
"name": "Käpt'n Reisbart",
|
||||
"price": 7.70,
|
||||
"desc": "Süß-Sauer-Soße mit Hähnchenschiffchen in Reis gebadet"
|
||||
},
|
||||
{
|
||||
"name": "Spagetti Reisonese",
|
||||
"price": 5.60,
|
||||
"desc": "Spaghetti mit Tomatensoße und Reis"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Desserts",
|
||||
"anchor": "dessert",
|
||||
"items": [
|
||||
{
|
||||
"name": "Milchreis",
|
||||
"price": 6.30,
|
||||
"desc": "Leckerer Milchreis aus der Tüte vom Großhändler mit heißen Sauerkirschen aus der Konservenbüchse"
|
||||
},
|
||||
{
|
||||
"name": "R-Eis",
|
||||
"price": 4.10,
|
||||
"desc": "Gemischtes Eis mit Kokos-reis-Streumaterial; 3 Kugeln nach Wahl"
|
||||
},
|
||||
{
|
||||
"name": "Eierreiskuchen",
|
||||
"price": 5.00,
|
||||
"desc": "2 köstliche Palatschinken (regional auch Eierkuchen genannt) mit im Teig eingearbeitetetem Reis, dazu feinster Powidl (regional auch Pflaumenmuß) genannt"
|
||||
},
|
||||
{
|
||||
"name": "Süßes Reisotto",
|
||||
"price": 8.70,
|
||||
"desc": "Reis mit bunten Früchten und viel Joghurt, angerichtet mit etweas Zimt und einem Schuss Honig"
|
||||
},
|
||||
{
|
||||
"name": "Reisstrudel",
|
||||
"price": 5.60,
|
||||
"desc": "In Blätterteil gewickelter Reis mit Milchcreme und Minze, dazu Vanillesoße und eine Kugel Vanilleeis"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"drinks": [
|
||||
{
|
||||
"name": "Auf Art des Hauses",
|
||||
"anchor": "haus",
|
||||
"items": [
|
||||
{
|
||||
"name": "Reiswein",
|
||||
"price": 3.90,
|
||||
"desc": "Exquisiter Reiswein mit leiter gelblicher Färbung aus eigener Herstellung mit über 1337 Jahren Erfahrung (Alkoholgehalt 13,37%)"
|
||||
},
|
||||
{
|
||||
"name": "Reisschnaps",
|
||||
"price": 2.10,
|
||||
"desc": "Starker Reisschnaps als Absacker geeignet mit feiner Süße im Abgang (Alkoholgehalt 69%)"
|
||||
},
|
||||
{
|
||||
"name": "Reisbier",
|
||||
"price": 3.50,
|
||||
"desc": "Aus der Reispflanze gewonnenes Bier mit Hopfen nach chinesischem Reinheitsgebot (Alkoholgehalt 4,2%)"
|
||||
},
|
||||
{
|
||||
"name": "Reissud",
|
||||
"price": 1.20,
|
||||
"desc": "Heißer beim Reis kochen entstandener Sud; alkoholfrei, warm und jedes Mal je nach Reissorte ein individueller, neuer Geschmack"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Alkoholfrei",
|
||||
"anchor": "alkoholfrei",
|
||||
"items": [
|
||||
{
|
||||
"name": "Softdrinks (0,5l)",
|
||||
"price": 3.40,
|
||||
"desc": "Verschidene Sorten nur diesen Framstag im Angebot!"
|
||||
},
|
||||
{
|
||||
"name": "Softdrinks (0,3l)",
|
||||
"price": 2.90,
|
||||
"desc": "Verschidene Sorten nur diesen Framstag im Angebot!"
|
||||
},
|
||||
{
|
||||
"name": "Wasser (1l)",
|
||||
"price": 4.10,
|
||||
"desc": "Das Wasser trüb, die Luft ist rein, Franz-Josef muss ertrunken sein."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Alkohol",
|
||||
"anchor": "alkohol",
|
||||
"items": [
|
||||
{
|
||||
"name": "Bier vom Fass (0,5l)",
|
||||
"price": 3.50,
|
||||
"desc": "Wählen sie zwischen Becks, Sternburg und Berliner Kindl"
|
||||
},
|
||||
{
|
||||
"name": "Bier vom Fass (0,3l)",
|
||||
"price": 3.00,
|
||||
"desc": "Wählen sie zwischen Becks, Sternburg und Berliner Kindl"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bier (0,69l)",
|
||||
"price": 2.40,
|
||||
"desc": "Tsingtao-Exportbier"
|
||||
},
|
||||
{
|
||||
"name": "Chinesisches Bier (0,42l)",
|
||||
"price": 1.90,
|
||||
"desc": "Tsingtao-Exportbier"
|
||||
},
|
||||
{
|
||||
"name": "Rislinger Wein (0,2l)",
|
||||
"price": 4.20,
|
||||
"desc": "Asiatischer Wein mit unbekanntem Ursprung aus gezüchteten, von Monsanto genmanipulierten Weintrauben"
|
||||
},
|
||||
{
|
||||
"name": "Radler (0,5l)",
|
||||
"price": 13.20,
|
||||
"desc": "Für echte Vampire"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Spriritus",
|
||||
"anchor": "spirituose",
|
||||
"items": [
|
||||
{
|
||||
"name": "Asiatische Freude",
|
||||
"price": 1.50,
|
||||
"desc": "Auf 45 Grad erwärmter Reisschnaps mit Raucharoma für natürliches Pekinger Stadtklima"
|
||||
},
|
||||
{
|
||||
"name": "Sprit-Tussi",
|
||||
"price": 1.60,
|
||||
"desc": "Diesel (Cola-Bier-Gemisch) in einem 0,1cl-Glas, um es teurer verkaufen zu können"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cocktails",
|
||||
"anchor": "cocktails",
|
||||
"items": [
|
||||
{
|
||||
"name": "Beste Freundschaft",
|
||||
"price": 9.30,
|
||||
"desc": "Lila Livo-Liva mit weißem Rohrzucker und Limettensaft mit frischer, grüner Limette"
|
||||
},
|
||||
{
|
||||
"name": "Schwanz-Schwanz",
|
||||
"price": 5.60,
|
||||
"desc": "Ausgefuchste Kombination von Schwanz und Schwanz des Hans und Franz"
|
||||
},
|
||||
{
|
||||
"name": "Der Reisende",
|
||||
"price": 8.90,
|
||||
"desc": "Du schmeckst eh nichts anderes mehr, so viel Alk ist hier drin, und nach einem davon reist du durch die ganze Welt (zumindest im Kopf)"
|
||||
},
|
||||
{
|
||||
"name": "Pina Reisolada",
|
||||
"price": 6.10,
|
||||
"desc": "Mit Ananas und Kokos aufgemixte Mixtur in Reisschaum, mit Reisschnaps und fast dem ganzen Glas voller Eis"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
126
main.js
126
main.js
@@ -1,31 +1,151 @@
|
||||
var express = require('express');
|
||||
var jade = require('jade');
|
||||
var bodyParser = require('body-parser');
|
||||
var session = require('express-session');
|
||||
var loginMod = require('./modules/login');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var menuJSON;
|
||||
|
||||
var app = express();
|
||||
|
||||
app.set('view engine', 'jade');
|
||||
app.set('rundir', '.');
|
||||
app.set('views', app.get('rundir') + '/views');
|
||||
|
||||
app.use(session({
|
||||
secret: 'Jk0Z850cD2MXkcIRXDg1M4X6c1VKkJTb6VYQfbWUKw2XwqaBmqqaKu7K0Q8WlGZVqupF2fzXaavt1hNf',
|
||||
resave: true,
|
||||
saveUninitialized: true}));
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({
|
||||
extended: true
|
||||
}));
|
||||
|
||||
app.use('/bin', express.static(app.get('rundir') + '/public'));
|
||||
|
||||
fs.readFile(app.get('rundir') + '/data/menu.json', 'utf8', function (err, data) {
|
||||
if (err) throw err;
|
||||
menuJSON = JSON.parse(data);
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.render('index', {
|
||||
title: 'Restaurant Reiskorn | Home',
|
||||
message: 'Hello there!'
|
||||
loginName: loginMod.getName(req),
|
||||
menuJSON: menuJSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/speisekarte', function(req, res) {
|
||||
res.render('menu', {
|
||||
title: 'Restaurant Reiskorn | Speisekarte',
|
||||
message: 'Hello there!'
|
||||
loginName: loginMod.getName(req),
|
||||
isAdmin: loginMod.hasAccess(req, loginMod.AdminRight.MENU),
|
||||
menuJSON: menuJSON
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/speisekarte', function(req, res) {
|
||||
var del = req.body.del;
|
||||
var item = req.body.nametag;
|
||||
var name = req.body.name;
|
||||
var desc = req.body.desc;
|
||||
var price = req.body.price;
|
||||
if (item && /^[fd]-[0-9]+-new$/.test(item)) { // new
|
||||
var splitArr = item.split("-");
|
||||
if (splitArr[0] == "f") {
|
||||
splitArr[0] = "food";
|
||||
} else {
|
||||
splitArr[0] = "drinks";
|
||||
}
|
||||
price = parseInt(price);
|
||||
menuJSON[splitArr[0]][parseInt(splitArr[1])]["items"].push({
|
||||
name: name,
|
||||
desc: desc,
|
||||
price: price
|
||||
});
|
||||
} else if (item && /^[fd]-[0-9]+-[0-9]+$/.test(item)) { // edit
|
||||
var splitArr = item.split("-");
|
||||
if (splitArr[0] == "f") {
|
||||
splitArr[0] = "food";
|
||||
} else {
|
||||
splitArr[0] = "drinks";
|
||||
}
|
||||
price = parseInt(price);
|
||||
menuJSON[splitArr[0]][parseInt(splitArr[1])]["items"][parseInt(splitArr[2])] = {
|
||||
name: name,
|
||||
desc: desc,
|
||||
price: price
|
||||
};
|
||||
} else if (del && /^[fd]-[0-9]+-[0-9]+$/.test(del)) { // delete
|
||||
var splitArr = del.split("-");
|
||||
if (splitArr[0] == "f") {
|
||||
splitArr[0] = "food";
|
||||
} else {
|
||||
splitArr[0] = "drinks";
|
||||
}
|
||||
menuJSON[splitArr[0]][parseInt(splitArr[1])]["items"].splice(parseInt(splitArr[2]), 1);
|
||||
}
|
||||
|
||||
res.render('menu', {
|
||||
title: 'Restaurant Reiskorn | Speisekarte',
|
||||
loginName: loginMod.getName(req),
|
||||
isAdmin: loginMod.hasAccess(req, loginMod.AdminRight.MENU),
|
||||
menuJSON: menuJSON
|
||||
});
|
||||
|
||||
fs.writeFile(app.get('rundir') + '/data/menu.json', JSON.stringify(menuJSON, null, 4), function(err) {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/kontakt', function(req, res) {
|
||||
res.render('contact', {
|
||||
title: 'Restaurant Reiskorn | Kontakt',
|
||||
message: 'Hello there!'
|
||||
loginName: loginMod.getName(req),
|
||||
menuJSON: menuJSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/login', function(req, res) {
|
||||
res.render('login', {
|
||||
title: 'Restaurant Reiskorn | Login',
|
||||
loginName: loginMod.getName(req),
|
||||
isAdmin: loginMod.hasAccess(req, loginMod.AdminRight.ADMIN),
|
||||
menuJSON: menuJSON
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/login', function(req, res) {
|
||||
var name = req.body.username;
|
||||
var pwd = req.body.password;
|
||||
var targetLogout = req.body.targetLogout;
|
||||
var action;
|
||||
// login
|
||||
if (name && pwd) {
|
||||
if (loginMod.doLogin(req, name, pwd)) {
|
||||
action = "login-success";
|
||||
} else {
|
||||
action = "login-fail";
|
||||
}
|
||||
}
|
||||
// logout
|
||||
if (targetLogout) {
|
||||
loginMod.doLogout(req);
|
||||
action = "logout";
|
||||
}
|
||||
|
||||
res.render('login', {
|
||||
title: 'Restaurant Reiskorn | Login',
|
||||
loginName: loginMod.getName(req),
|
||||
isAdmin: loginMod.hasAccess(req, loginMod.AdminRight.ADMIN),
|
||||
menuJSON: menuJSON,
|
||||
loginAction: action
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
61
modules/login.js
Normal file
61
modules/login.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var admins = {
|
||||
"Richard Reis": {
|
||||
pwd: "secret",
|
||||
rights: {
|
||||
1: true,
|
||||
2: true,
|
||||
3: true
|
||||
}
|
||||
},
|
||||
"Ursula Ulstein": {
|
||||
pwd: "ultimativ",
|
||||
rights: {
|
||||
1: true,
|
||||
2: true,
|
||||
3: false
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
module.exports.AdminRight = {
|
||||
ADMIN: 1,
|
||||
MENU: 2,
|
||||
RESERVATION: 3
|
||||
}
|
||||
|
||||
module.exports.checkCredentials = function(name, pwd) {
|
||||
if (name && pwd && (name in admins) && pwd==admins[name].pwd) {
|
||||
// valid
|
||||
return true;
|
||||
} else {
|
||||
// invalid
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.hasAccess = function(req, section) {
|
||||
var name = module.exports.getName(req);
|
||||
return (name && admins[name] && admins[name].rights && admins[name].rights[section] && admins[name].rights[module.exports.AdminRight.ADMIN]);
|
||||
};
|
||||
|
||||
module.exports.getName = function(req) {
|
||||
if ((typeof req.session === 'undefined') || (typeof req.session.name === 'undefined'))
|
||||
return false;
|
||||
else
|
||||
return req.session.name;
|
||||
}
|
||||
|
||||
module.exports.doLogin = function(req, name, pwd) {
|
||||
if (module.exports.checkCredentials(name, pwd) && !(typeof req.session === 'undefined')) {
|
||||
req.session.name = name;
|
||||
}
|
||||
return module.exports.getName(req);
|
||||
}
|
||||
|
||||
module.exports.doLogout = function(req) {
|
||||
if (!(typeof req.session === 'undefined')) {
|
||||
req.session.destroy();
|
||||
}
|
||||
return module.exports.getName(req);
|
||||
}
|
||||
|
||||
50
node_modules/align-text/package.json
generated
vendored
50
node_modules/align-text/package.json
generated
vendored
@@ -1,39 +1,43 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"align-text@^0.1.0",
|
||||
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\center-align"
|
||||
"align-text@^0.1.3",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\center-align"
|
||||
]
|
||||
],
|
||||
"_from": "align-text@>=0.1.0 <0.2.0",
|
||||
"_id": "align-text@0.1.3",
|
||||
"_from": "align-text@>=0.1.3 <0.2.0",
|
||||
"_id": "align-text@0.1.4",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/align-text",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
"_nodeVersion": "5.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/align-text-0.1.4.tgz_1454377856920_0.9624228512402624"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_npmUser": {
|
||||
"email": "snnskwtnb@gmail.com",
|
||||
"name": "shinnn"
|
||||
},
|
||||
"_npmVersion": "3.6.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "align-text",
|
||||
"raw": "align-text@^0.1.0",
|
||||
"rawSpec": "^0.1.0",
|
||||
"raw": "align-text@^0.1.3",
|
||||
"rawSpec": "^0.1.3",
|
||||
"scope": null,
|
||||
"spec": ">=0.1.0 <0.2.0",
|
||||
"spec": ">=0.1.3 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/center-align",
|
||||
"/right-align"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz",
|
||||
"_shasum": "72db3983872eec2313919c9426a993a41afe93f7",
|
||||
"_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
|
||||
"_shasum": "0cd90a561093f35d0a99256c22b7069433fad117",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "align-text@^0.1.0",
|
||||
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\center-align",
|
||||
"_spec": "align-text@^0.1.3",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\center-align",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
@@ -42,7 +46,7 @@
|
||||
"url": "https://github.com/jonschlinkert/align-text/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": "^2.0.0",
|
||||
"kind-of": "^3.0.2",
|
||||
"longest": "^1.0.1",
|
||||
"repeat-string": "^1.5.2"
|
||||
},
|
||||
@@ -54,8 +58,8 @@
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "72db3983872eec2313919c9426a993a41afe93f7",
|
||||
"tarball": "http://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz"
|
||||
"shasum": "0cd90a561093f35d0a99256c22b7069433fad117",
|
||||
"tarball": "http://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -63,7 +67,7 @@
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "11c2e834ff2c63f9844bddf189fea5cab921e44d",
|
||||
"gitHead": "7f08e823a54c6bda319d875895813537a66a4c5e",
|
||||
"homepage": "https://github.com/jonschlinkert/align-text",
|
||||
"keywords": [
|
||||
"align",
|
||||
@@ -85,6 +89,10 @@
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
},
|
||||
{
|
||||
"name": "shinnn",
|
||||
"email": "snnskwtnb@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "align-text",
|
||||
@@ -97,5 +105,5 @@
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.1.3"
|
||||
"version": "0.1.4"
|
||||
}
|
||||
|
||||
15
node_modules/base64-url/LICENSE
generated
vendored
Normal file
15
node_modules/base64-url/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2014, Joaquim José F. Serafim
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
53
node_modules/base64-url/README.md
generated
vendored
Normal file
53
node_modules/base64-url/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# base64-url
|
||||
|
||||
Base64 encode, decode, escape and unescape for URL applications.
|
||||
|
||||
<a href="https://nodei.co/npm/base64-url/"><img src="https://nodei.co/npm/base64-url.png?downloads=true"></a>
|
||||
|
||||
[](https://travis-ci.org/joaquimserafim/base64-url)
|
||||
|
||||
|
||||
## API
|
||||
|
||||
> base64url.encode('Node.js is awesome.');
|
||||
Tm9kZS5qcyBpcyBhd2Vzb21lLg
|
||||
|
||||
> base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');
|
||||
Node.js is awesome.
|
||||
|
||||
> base64url.escape('This+is/goingto+escape==');
|
||||
This-is_goingto-escape
|
||||
|
||||
> base64url.unescape('This-is_goingto-escape');
|
||||
This+is/goingto+escape==
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
**this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit**
|
||||
|
||||
|
||||
to run test
|
||||
``` js
|
||||
npm test
|
||||
```
|
||||
|
||||
to run jshint
|
||||
``` js
|
||||
npm run jshint
|
||||
```
|
||||
|
||||
to run code style
|
||||
``` js
|
||||
npm run code-style
|
||||
```
|
||||
|
||||
to check code coverage
|
||||
``` js
|
||||
npm run check-coverage
|
||||
```
|
||||
|
||||
to open the code coverage report
|
||||
``` js
|
||||
npm run open-coverage
|
||||
```
|
||||
24
node_modules/base64-url/index.js
generated
vendored
Normal file
24
node_modules/base64-url/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var base64url = module.exports;
|
||||
|
||||
base64url.unescape = function unescape (str) {
|
||||
return (str + Array(5 - str.length % 4)
|
||||
.join('='))
|
||||
.replace(/\-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
};
|
||||
|
||||
base64url.escape = function escape (str) {
|
||||
return str.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
};
|
||||
|
||||
base64url.encode = function encode (str) {
|
||||
return this.escape(new Buffer(str).toString('base64'));
|
||||
};
|
||||
|
||||
base64url.decode = function decode (str) {
|
||||
return new Buffer(this.unescape(str), 'base64').toString();
|
||||
};
|
||||
96
node_modules/base64-url/package.json
generated
vendored
Normal file
96
node_modules/base64-url/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"base64-url@1.2.1",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\uid-safe"
|
||||
]
|
||||
],
|
||||
"_from": "base64-url@1.2.1",
|
||||
"_id": "base64-url@1.2.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/base64-url",
|
||||
"_npmUser": {
|
||||
"email": "joaquim.serafim@gmail.com",
|
||||
"name": "quim"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "base64-url",
|
||||
"raw": "base64-url@1.2.1",
|
||||
"rawSpec": "1.2.1",
|
||||
"scope": null,
|
||||
"spec": "1.2.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/uid-safe"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/base64-url/-/base64-url-1.2.1.tgz",
|
||||
"_shasum": "199fd661702a0e7b7dcae6e0698bb089c52f6d78",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "base64-url@1.2.1",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\uid-safe",
|
||||
"author": {
|
||||
"name": "@joaquimserafim"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/joaquimserafim/base64-url/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Base64 encode, decode, escape and unescape for URL applications",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.3.5",
|
||||
"jscs": "^1.9.0",
|
||||
"jshint": "^2.5.11",
|
||||
"pre-commit": "0.0.9",
|
||||
"tape": "^3.0.3",
|
||||
"which": "^1.0.8"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "199fd661702a0e7b7dcae6e0698bb089c52f6d78",
|
||||
"tarball": "http://registry.npmjs.org/base64-url/-/base64-url-1.2.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "a548396819f17b1fb1529791ab8a2c1934d03f3e",
|
||||
"homepage": "https://github.com/joaquimserafim/base64-url",
|
||||
"keywords": [
|
||||
"base64",
|
||||
"base64url"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "quim",
|
||||
"email": "joaquim.serafim@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "base64-url",
|
||||
"optionalDependencies": {},
|
||||
"pre-commit": [
|
||||
"check-coverage",
|
||||
"code-style",
|
||||
"jshint",
|
||||
"test"
|
||||
],
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/joaquimserafim/base64-url.git"
|
||||
},
|
||||
"scripts": {
|
||||
"check-coverage": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
|
||||
"code-style": "jscs -p google *.js",
|
||||
"coverage": "open coverage/lcov-report/index.html",
|
||||
"jshint": "jshint -c .jshintrc *.js",
|
||||
"test": "istanbul cover tape test.js"
|
||||
},
|
||||
"version": "1.2.1"
|
||||
}
|
||||
436
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
436
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,436 @@
|
||||
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
node_modules/body-parser/LICENSE
generated
vendored
Normal file
23
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.
|
||||
404
node_modules/body-parser/README.md
generated
vendored
Normal file
404
node_modules/body-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
# 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]
|
||||
[![Gratipay][gratipay-image]][gratipay-url]
|
||||
|
||||
Node.js body parsing middleware.
|
||||
|
||||
_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
|
||||
|
||||
```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, or an
|
||||
empty object (`{}`) if there was no body to parse (or an error was returned).
|
||||
|
||||
The various errors returned by this module are described in the
|
||||
[errors section](#errors).
|
||||
|
||||
### bodyParser.json(options)
|
||||
|
||||
Returns middleware that only parses `json`. 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 option `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 function or a string. If a string, `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`. 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 option `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 function or a string. If a string, `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. 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 option `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 function or a string. If a string, `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. 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 option `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 function or a string. If a string, `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` property
|
||||
that contains the suggested HTTP response code 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
### 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`.
|
||||
|
||||
## 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 recommend 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) {
|
||||
if (!req.body) return res.sendStatus(400)
|
||||
res.send('welcome, ' + req.body.username)
|
||||
})
|
||||
|
||||
// POST /api/users gets JSON bodies
|
||||
app.post('/api/users', jsonParser, function (req, res) {
|
||||
if (!req.body) return res.sendStatus(400)
|
||||
// create user in req.body
|
||||
})
|
||||
```
|
||||
|
||||
### change content-type for parsers
|
||||
|
||||
All the parsers accept a `type` option which allows you to change the
|
||||
`Content-Type` that the middleware will parse.
|
||||
|
||||
```js
|
||||
// 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
|
||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
||||
[gratipay-url]: https://www.gratipay.com/dougwilson/
|
||||
157
node_modules/body-parser/index.js
generated
vendored
Normal file
157
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 ('type' !== prop) {
|
||||
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
|
||||
}
|
||||
188
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
188
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/*!
|
||||
* 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]
|
||||
* @api 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 || 'utf-8'
|
||||
: 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()
|
||||
}))
|
||||
}
|
||||
|
||||
// read body
|
||||
debug('read body')
|
||||
getBody(stream, opts, function (err, body) {
|
||||
if (err) {
|
||||
// default to 400
|
||||
setErrorStatus(err, 400)
|
||||
|
||||
// echo back charset
|
||||
if (err.type === 'encoding.unsupported') {
|
||||
err = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||
charset: encoding.toLowerCase()
|
||||
})
|
||||
}
|
||||
|
||||
// read off entire request
|
||||
stream.resume()
|
||||
onFinished(req, function onfinished() {
|
||||
next(err)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// verify
|
||||
if (verify) {
|
||||
try {
|
||||
debug('verify body')
|
||||
verify(req, res, body, encoding)
|
||||
} catch (err) {
|
||||
// default to 403
|
||||
setErrorStatus(err, 403)
|
||||
next(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// parse
|
||||
var str
|
||||
try {
|
||||
debug('parse body')
|
||||
str = typeof body !== 'string' && encoding !== null
|
||||
? iconv.decode(body, encoding)
|
||||
: body
|
||||
req.body = parse(str)
|
||||
} catch (err) {
|
||||
err.body = str === undefined
|
||||
? body
|
||||
: str
|
||||
|
||||
// default to 400
|
||||
setErrorStatus(err, 400)
|
||||
|
||||
next(err)
|
||||
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')
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a status on an error object, if ones does not exist
|
||||
* @private
|
||||
*/
|
||||
|
||||
function setErrorStatus(error, status) {
|
||||
if (!error.status && !error.statusCode) {
|
||||
error.status = status
|
||||
error.statusCode = status
|
||||
}
|
||||
}
|
||||
170
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
170
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/*!
|
||||
* 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 firstcharRegExp = /^[\x20\x09\x0a\x0d]*(.)/
|
||||
|
||||
/**
|
||||
* 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 new SyntaxError('Unexpected token ' + first)
|
||||
}
|
||||
}
|
||||
|
||||
debug('parse json')
|
||||
return JSON.parse(body, reviver)
|
||||
}
|
||||
|
||||
return function jsonParser(req, res, next) {
|
||||
if (req._body) {
|
||||
return debug('body already parsed'), next()
|
||||
}
|
||||
|
||||
req.body = req.body || {}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
return debug('skip empty body'), next()
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
return debug('skip parsing'), next()
|
||||
}
|
||||
|
||||
// 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
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
// read
|
||||
read(req, res, next, parse, debug, {
|
||||
encoding: charset,
|
||||
inflate: inflate,
|
||||
limit: limit,
|
||||
verify: verify
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first non-whitespace character in a string.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function firstchar(str) {
|
||||
var match = firstcharRegExp.exec(str)
|
||||
return match ? match[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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the simple type checker.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {function}
|
||||
*/
|
||||
|
||||
function typeChecker(type) {
|
||||
return function checkType(req) {
|
||||
return Boolean(typeis(req, type))
|
||||
}
|
||||
}
|
||||
95
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
95
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* 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) {
|
||||
return debug('body already parsed'), next()
|
||||
}
|
||||
|
||||
req.body = req.body || {}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
return debug('skip empty body'), next()
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
return debug('skip parsing'), next()
|
||||
}
|
||||
|
||||
// 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))
|
||||
}
|
||||
}
|
||||
115
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
115
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/*!
|
||||
* 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) {
|
||||
return debug('body already parsed'), next()
|
||||
}
|
||||
|
||||
req.body = req.body || {}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
return debug('skip empty body'), next()
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
return debug('skip parsing'), next()
|
||||
}
|
||||
|
||||
// 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))
|
||||
}
|
||||
}
|
||||
273
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
273
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
/*!
|
||||
* 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) {
|
||||
return debug('body already parsed'), next()
|
||||
}
|
||||
|
||||
req.body = req.body || {}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
return debug('skip empty body'), next()
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
return debug('skip parsing'), next()
|
||||
}
|
||||
|
||||
// assert charset
|
||||
var charset = getCharset(req) || 'utf-8'
|
||||
if (charset !== 'utf-8') {
|
||||
debug('invalid charset')
|
||||
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||
charset: charset
|
||||
}))
|
||||
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')
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
||||
85
node_modules/body-parser/node_modules/http-errors/HISTORY.md
generated
vendored
Normal file
85
node_modules/body-parser/node_modules/http-errors/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
2016-01-28 / 1.4.0
|
||||
==================
|
||||
|
||||
* Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||
* deps: inherits@2.0.1
|
||||
* deps: statuses@'>= 1.2.1 < 2'
|
||||
- Fix message for status 451
|
||||
- Remove incorrect nginx status code
|
||||
|
||||
2015-02-02 / 1.3.1
|
||||
==================
|
||||
|
||||
* Fix regression where status can be overwritten in `createError` `props`
|
||||
|
||||
2015-02-01 / 1.3.0
|
||||
==================
|
||||
|
||||
* Construct errors using defined constructors from `createError`
|
||||
* Fix error names that are not identifiers
|
||||
- `createError["I'mateapot"]` is now `createError.ImATeapot`
|
||||
* Set a meaningful `name` property on constructed errors
|
||||
|
||||
2014-12-09 / 1.2.8
|
||||
==================
|
||||
|
||||
* Fix stack trace from exported function
|
||||
* Remove `arguments.callee` usage
|
||||
|
||||
2014-10-14 / 1.2.7
|
||||
==================
|
||||
|
||||
* Remove duplicate line
|
||||
|
||||
2014-10-02 / 1.2.6
|
||||
==================
|
||||
|
||||
* Fix `expose` to be `true` for `ClientError` constructor
|
||||
|
||||
2014-09-28 / 1.2.5
|
||||
==================
|
||||
|
||||
* deps: statuses@1
|
||||
|
||||
2014-09-21 / 1.2.4
|
||||
==================
|
||||
|
||||
* Fix dependency version to work with old `npm`s
|
||||
|
||||
2014-09-21 / 1.2.3
|
||||
==================
|
||||
|
||||
* deps: statuses@~1.1.0
|
||||
|
||||
2014-09-21 / 1.2.2
|
||||
==================
|
||||
|
||||
* Fix publish error
|
||||
|
||||
2014-09-21 / 1.2.1
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* Use `inherits` instead of `util`
|
||||
|
||||
2014-09-09 / 1.2.0
|
||||
==================
|
||||
|
||||
* Fix the way inheriting functions
|
||||
* Support `expose` being provided in properties argument
|
||||
|
||||
2014-09-08 / 1.1.0
|
||||
==================
|
||||
|
||||
* Default status to 500
|
||||
* Support provided `error` to extend
|
||||
|
||||
2014-09-08 / 1.0.1
|
||||
==================
|
||||
|
||||
* Fix accepting string message
|
||||
|
||||
2014-09-08 / 1.0.0
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.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
|
||||
66
node_modules/body-parser/node_modules/http-errors/README.md
generated
vendored
Normal file
66
node_modules/body-parser/node_modules/http-errors/README.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# http-errors
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Create HTTP errors for Express, Koa, Connect, etc. with ease.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var createError = require('http-errors');
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (!req.user) return next(createError(401, 'Please login to view this page.'));
|
||||
next();
|
||||
})
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This is the current API, currently extracted from Koa and subject to change.
|
||||
|
||||
All errors inherit from JavaScript `Error` and the exported `createError.HttpError`.
|
||||
|
||||
### Error Properties
|
||||
|
||||
- `expose` - can be used to signal if `message` should be sent to the client, defaulting to `false` when `status` >= 500
|
||||
- `message`
|
||||
- `status` and `statusCode` - the status code of the error, defaulting to `500`
|
||||
|
||||
### createError([status], [message], [properties])
|
||||
|
||||
```js
|
||||
var err = createError(404, 'This video does not exist!');
|
||||
```
|
||||
|
||||
- `status: 500` - the status code as a number
|
||||
- `message` - the message of the error, defaulting to node's text for that status code.
|
||||
- `properties` - custom properties to attach to the object
|
||||
|
||||
### new createError\[code || name\](\[msg]\))
|
||||
|
||||
```js
|
||||
var err = new createError.NotFound();
|
||||
```
|
||||
|
||||
- `code` - the status code as a number
|
||||
- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/http-errors
|
||||
[node-version-image]: https://img.shields.io/node/v/http-errors.svg?style=flat
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/http-errors
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/http-errors
|
||||
[downloads-image]: https://img.shields.io/npm/dm/http-errors.svg?style=flat
|
||||
[downloads-url]: https://npmjs.org/package/http-errors
|
||||
126
node_modules/body-parser/node_modules/http-errors/index.js
generated
vendored
Normal file
126
node_modules/body-parser/node_modules/http-errors/index.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
|
||||
var statuses = require('statuses');
|
||||
var inherits = require('inherits');
|
||||
|
||||
function toIdentifier(str) {
|
||||
return str.split(' ').map(function (token) {
|
||||
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
||||
}).join('').replace(/[^ _0-9a-z]/gi, '')
|
||||
}
|
||||
|
||||
exports = module.exports = function httpError() {
|
||||
// so much arity going on ~_~
|
||||
var err;
|
||||
var msg;
|
||||
var status = 500;
|
||||
var props = {};
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var arg = arguments[i];
|
||||
if (arg instanceof Error) {
|
||||
err = arg;
|
||||
status = err.status || err.statusCode || status;
|
||||
continue;
|
||||
}
|
||||
switch (typeof arg) {
|
||||
case 'string':
|
||||
msg = arg;
|
||||
break;
|
||||
case 'number':
|
||||
status = arg;
|
||||
break;
|
||||
case 'object':
|
||||
props = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof status !== 'number' || !statuses[status]) {
|
||||
status = 500
|
||||
}
|
||||
|
||||
// constructor
|
||||
var HttpError = exports[status]
|
||||
|
||||
if (!err) {
|
||||
// create error
|
||||
err = HttpError
|
||||
? new HttpError(msg)
|
||||
: new Error(msg || statuses[status])
|
||||
Error.captureStackTrace(err, httpError)
|
||||
}
|
||||
|
||||
if (!HttpError || !(err instanceof HttpError)) {
|
||||
// add properties to generic error
|
||||
err.expose = status < 500
|
||||
err.status = err.statusCode = status
|
||||
}
|
||||
|
||||
for (var key in props) {
|
||||
if (key !== 'status' && key !== 'statusCode') {
|
||||
err[key] = props[key]
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
var HttpError = exports.HttpError = function HttpError() {
|
||||
throw new TypeError('cannot construct abstract class');
|
||||
};
|
||||
|
||||
inherits(HttpError, Error);
|
||||
|
||||
// create generic error objects
|
||||
var codes = statuses.codes.filter(function (num) {
|
||||
return num >= 400;
|
||||
});
|
||||
|
||||
codes.forEach(function (code) {
|
||||
var name = toIdentifier(statuses[code])
|
||||
var className = name.match(/Error$/) ? name : name + 'Error'
|
||||
|
||||
if (code >= 500) {
|
||||
var ServerError = function ServerError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, ServerError)
|
||||
self.__proto__ = ServerError.prototype
|
||||
Object.defineProperty(self, 'name', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: className,
|
||||
writable: true
|
||||
})
|
||||
return self
|
||||
}
|
||||
inherits(ServerError, HttpError);
|
||||
ServerError.prototype.status =
|
||||
ServerError.prototype.statusCode = code;
|
||||
ServerError.prototype.expose = false;
|
||||
exports[code] =
|
||||
exports[name] = ServerError
|
||||
return;
|
||||
}
|
||||
|
||||
var ClientError = function ClientError(msg) {
|
||||
var self = new Error(msg != null ? msg : statuses[code])
|
||||
Error.captureStackTrace(self, ClientError)
|
||||
self.__proto__ = ClientError.prototype
|
||||
Object.defineProperty(self, 'name', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: className,
|
||||
writable: true
|
||||
})
|
||||
return self
|
||||
}
|
||||
inherits(ClientError, HttpError);
|
||||
ClientError.prototype.status =
|
||||
ClientError.prototype.statusCode = code;
|
||||
ClientError.prototype.expose = true;
|
||||
exports[code] =
|
||||
exports[name] = ClientError
|
||||
return;
|
||||
});
|
||||
|
||||
// backwards-compatibility
|
||||
exports["I'mateapot"] = exports.ImATeapot
|
||||
111
node_modules/body-parser/node_modules/http-errors/package.json
generated
vendored
Normal file
111
node_modules/body-parser/node_modules/http-errors/package.json
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"http-errors@~1.4.0",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser"
|
||||
]
|
||||
],
|
||||
"_from": "http-errors@>=1.4.0 <1.5.0",
|
||||
"_id": "http-errors@1.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser/http-errors",
|
||||
"_nodeVersion": "4.2.3",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "http-errors",
|
||||
"raw": "http-errors@~1.4.0",
|
||||
"rawSpec": "~1.4.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.4.0 <1.5.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.4.0.tgz",
|
||||
"_shasum": "6c0242dea6b3df7afda153c71089b31c6e82aabf",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "http-errors@~1.4.0",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser",
|
||||
"author": {
|
||||
"email": "me@jongleberry.com",
|
||||
"name": "Jonathan Ong",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/http-errors/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Alan Plum",
|
||||
"email": "me@pluma.io"
|
||||
},
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"inherits": "2.0.1",
|
||||
"statuses": ">= 1.2.1 < 2"
|
||||
},
|
||||
"description": "Create HTTP error objects",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "6c0242dea6b3df7afda153c71089b31c6e82aabf",
|
||||
"tarball": "http://registry.npmjs.org/http-errors/-/http-errors-1.4.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "3d49066ba40bd7f512bc4cf367bbe650c5f2191f",
|
||||
"homepage": "https://github.com/jshttp/http-errors#readme",
|
||||
"keywords": [
|
||||
"error",
|
||||
"http"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "egeste",
|
||||
"email": "npm@egeste.net"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "http-errors",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/http-errors.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
||||
320
node_modules/body-parser/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
320
node_modules/body-parser/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,320 @@
|
||||
1.22.0 / 2016-02-15
|
||||
===================
|
||||
|
||||
* Add `application/ppsp-tracker+json`
|
||||
* Add `application/problem+json`
|
||||
* Add `application/problem+xml`
|
||||
* Add `application/vnd.hdt`
|
||||
* Add `application/vnd.ms-printschematicket+xml`
|
||||
* Add `model/vnd.rosette.annotated-data-model`
|
||||
* Add `text/slim`
|
||||
* Add extension `.rng` to `application/xml`
|
||||
* Fix extension of `application/dash+xml` to be `.mpd`
|
||||
* Update primary extension to `.m4a` for `audio/mp4`
|
||||
|
||||
1.21.0 / 2016-01-06
|
||||
===================
|
||||
|
||||
* Add `application/emergencycalldata.comment+xml`
|
||||
* Add `application/emergencycalldata.deviceinfo+xml`
|
||||
* Add `application/emergencycalldata.providerinfo+xml`
|
||||
* Add `application/emergencycalldata.serviceinfo+xml`
|
||||
* Add `application/emergencycalldata.subscriberinfo+xml`
|
||||
* Add `application/vnd.filmit.zfc`
|
||||
* Add `application/vnd.google-apps.document`
|
||||
* Add `application/vnd.google-apps.presentation`
|
||||
* Add `application/vnd.google-apps.spreadsheet`
|
||||
* Add `application/vnd.mapbox-vector-tile`
|
||||
* Add `application/vnd.ms-printdevicecapabilities+xml`
|
||||
* Add `application/vnd.ms-windows.devicepairing`
|
||||
* Add `application/vnd.ms-windows.nwprinting.oob`
|
||||
* Add `application/vnd.tml`
|
||||
* Add `audio/evs`
|
||||
|
||||
1.20.0 / 2015-11-10
|
||||
===================
|
||||
|
||||
* Add `application/cdni`
|
||||
* Add `application/csvm+json`
|
||||
* Add `application/rfc+xml`
|
||||
* Add `application/vnd.3gpp.access-transfer-events+xml`
|
||||
* Add `application/vnd.3gpp.srvcc-ext+xml`
|
||||
* Add `application/vnd.ms-windows.wsd.oob`
|
||||
* Add `application/vnd.oxli.countgraph`
|
||||
* Add `application/vnd.pagerduty+json`
|
||||
* Add `text/x-suse-ymp`
|
||||
|
||||
1.19.0 / 2015-09-17
|
||||
===================
|
||||
|
||||
* Add `application/vnd.3gpp-prose-pc3ch+xml`
|
||||
* Add `application/vnd.3gpp.srvcc-info+xml`
|
||||
* Add `application/vnd.apple.pkpass`
|
||||
* Add `application/vnd.drive+json`
|
||||
|
||||
1.18.0 / 2015-09-03
|
||||
===================
|
||||
|
||||
* Add `application/pkcs12`
|
||||
* Add `application/vnd.3gpp-prose+xml`
|
||||
* Add `application/vnd.3gpp.mid-call+xml`
|
||||
* Add `application/vnd.3gpp.state-and-event-info+xml`
|
||||
* Add `application/vnd.anki`
|
||||
* Add `application/vnd.firemonkeys.cloudcell`
|
||||
* Add `application/vnd.openblox.game+xml`
|
||||
* Add `application/vnd.openblox.game-binary`
|
||||
|
||||
1.17.0 / 2015-08-13
|
||||
===================
|
||||
|
||||
* Add `application/x-msdos-program`
|
||||
* Add `audio/g711-0`
|
||||
* Add `image/vnd.mozilla.apng`
|
||||
* Add extension `.exe` to `application/x-msdos-program`
|
||||
|
||||
1.16.0 / 2015-07-29
|
||||
===================
|
||||
|
||||
* Add `application/vnd.uri-map`
|
||||
|
||||
1.15.0 / 2015-07-13
|
||||
===================
|
||||
|
||||
* Add `application/x-httpd-php`
|
||||
|
||||
1.14.0 / 2015-06-25
|
||||
===================
|
||||
|
||||
* Add `application/scim+json`
|
||||
* Add `application/vnd.3gpp.ussd+xml`
|
||||
* Add `application/vnd.biopax.rdf+xml`
|
||||
* Add `text/x-processing`
|
||||
|
||||
1.13.0 / 2015-06-07
|
||||
===================
|
||||
|
||||
* Add nginx as a source
|
||||
* Add `application/x-cocoa`
|
||||
* Add `application/x-java-archive-diff`
|
||||
* Add `application/x-makeself`
|
||||
* Add `application/x-perl`
|
||||
* Add `application/x-pilot`
|
||||
* Add `application/x-redhat-package-manager`
|
||||
* Add `application/x-sea`
|
||||
* Add `audio/x-m4a`
|
||||
* Add `audio/x-realaudio`
|
||||
* Add `image/x-jng`
|
||||
* Add `text/mathml`
|
||||
|
||||
1.12.0 / 2015-06-05
|
||||
===================
|
||||
|
||||
* Add `application/bdoc`
|
||||
* Add `application/vnd.hyperdrive+json`
|
||||
* Add `application/x-bdoc`
|
||||
* Add extension `.rtf` to `text/rtf`
|
||||
|
||||
1.11.0 / 2015-05-31
|
||||
===================
|
||||
|
||||
* Add `audio/wav`
|
||||
* Add `audio/wave`
|
||||
* Add extension `.litcoffee` to `text/coffeescript`
|
||||
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
|
||||
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
|
||||
|
||||
1.10.0 / 2015-05-19
|
||||
===================
|
||||
|
||||
* Add `application/vnd.balsamiq.bmpr`
|
||||
* Add `application/vnd.microsoft.portable-executable`
|
||||
* Add `application/x-ns-proxy-autoconfig`
|
||||
|
||||
1.9.1 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Remove `.json` extension from `application/manifest+json`
|
||||
- This is causing bugs downstream
|
||||
|
||||
1.9.0 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Add `application/manifest+json`
|
||||
* Add `application/vnd.micro+json`
|
||||
* Add `image/vnd.zbrush.pcx`
|
||||
* Add `image/x-ms-bmp`
|
||||
|
||||
1.8.0 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Add `application/vnd.citationstyles.style+xml`
|
||||
* Add `application/vnd.fastcopy-disk-image`
|
||||
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
|
||||
* Add extension `.jsonld` to `application/ld+json`
|
||||
|
||||
1.7.0 / 2015-02-08
|
||||
==================
|
||||
|
||||
* Add `application/vnd.gerber`
|
||||
* Add `application/vnd.msa-disk-image`
|
||||
|
||||
1.6.1 / 2015-02-05
|
||||
==================
|
||||
|
||||
* Community extensions ownership transferred from `node-mime`
|
||||
|
||||
1.6.0 / 2015-01-29
|
||||
==================
|
||||
|
||||
* Add `application/jose`
|
||||
* Add `application/jose+json`
|
||||
* Add `application/json-seq`
|
||||
* Add `application/jwk+json`
|
||||
* Add `application/jwk-set+json`
|
||||
* Add `application/jwt`
|
||||
* Add `application/rdap+json`
|
||||
* Add `application/vnd.gov.sk.e-form+xml`
|
||||
* Add `application/vnd.ims.imsccv1p3`
|
||||
|
||||
1.5.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* Add `application/vnd.oracle.resource+json`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/mbox+xml`
|
||||
- `application/oscp-response`
|
||||
- `application/vwg-multiplexed`
|
||||
- `audio/g721`
|
||||
|
||||
1.4.0 / 2014-12-21
|
||||
==================
|
||||
|
||||
* Add `application/vnd.ims.imsccv1p2`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/vnd-acucobol`
|
||||
- `application/vnd-curl`
|
||||
- `application/vnd-dart`
|
||||
- `application/vnd-dxr`
|
||||
- `application/vnd-fdf`
|
||||
- `application/vnd-mif`
|
||||
- `application/vnd-sema`
|
||||
- `application/vnd-wap-wmlc`
|
||||
- `application/vnd.adobe.flash-movie`
|
||||
- `application/vnd.dece-zip`
|
||||
- `application/vnd.dvb_service`
|
||||
- `application/vnd.micrografx-igx`
|
||||
- `application/vnd.sealed-doc`
|
||||
- `application/vnd.sealed-eml`
|
||||
- `application/vnd.sealed-mht`
|
||||
- `application/vnd.sealed-ppt`
|
||||
- `application/vnd.sealed-tiff`
|
||||
- `application/vnd.sealed-xls`
|
||||
- `application/vnd.sealedmedia.softseal-html`
|
||||
- `application/vnd.sealedmedia.softseal-pdf`
|
||||
- `application/vnd.wap-slc`
|
||||
- `application/vnd.wap-wbxml`
|
||||
- `audio/vnd.sealedmedia.softseal-mpeg`
|
||||
- `image/vnd-djvu`
|
||||
- `image/vnd-svf`
|
||||
- `image/vnd-wap-wbmp`
|
||||
- `image/vnd.sealed-png`
|
||||
- `image/vnd.sealedmedia.softseal-gif`
|
||||
- `image/vnd.sealedmedia.softseal-jpg`
|
||||
- `model/vnd-dwf`
|
||||
- `model/vnd.parasolid.transmit-binary`
|
||||
- `model/vnd.parasolid.transmit-text`
|
||||
- `text/vnd-a`
|
||||
- `text/vnd-curl`
|
||||
- `text/vnd.wap-wml`
|
||||
* Remove example template MIME types
|
||||
- `application/example`
|
||||
- `audio/example`
|
||||
- `image/example`
|
||||
- `message/example`
|
||||
- `model/example`
|
||||
- `multipart/example`
|
||||
- `text/example`
|
||||
- `video/example`
|
||||
|
||||
1.3.1 / 2014-12-16
|
||||
==================
|
||||
|
||||
* Fix missing extensions
|
||||
- `application/json5`
|
||||
- `text/hjson`
|
||||
|
||||
1.3.0 / 2014-12-07
|
||||
==================
|
||||
|
||||
* Add `application/a2l`
|
||||
* Add `application/aml`
|
||||
* Add `application/atfx`
|
||||
* Add `application/atxml`
|
||||
* Add `application/cdfx+xml`
|
||||
* Add `application/dii`
|
||||
* Add `application/json5`
|
||||
* Add `application/lxf`
|
||||
* Add `application/mf4`
|
||||
* Add `application/vnd.apache.thrift.compact`
|
||||
* Add `application/vnd.apache.thrift.json`
|
||||
* Add `application/vnd.coffeescript`
|
||||
* Add `application/vnd.enphase.envoy`
|
||||
* Add `application/vnd.ims.imsccv1p1`
|
||||
* Add `text/csv-schema`
|
||||
* Add `text/hjson`
|
||||
* Add `text/markdown`
|
||||
* Add `text/yaml`
|
||||
|
||||
1.2.0 / 2014-11-09
|
||||
==================
|
||||
|
||||
* Add `application/cea`
|
||||
* Add `application/dit`
|
||||
* Add `application/vnd.gov.sk.e-form+zip`
|
||||
* Add `application/vnd.tmd.mediaflex.api+xml`
|
||||
* Type `application/epub+zip` is now IANA-registered
|
||||
|
||||
1.1.2 / 2014-10-23
|
||||
==================
|
||||
|
||||
* Rebuild database for `application/x-www-form-urlencoded` change
|
||||
|
||||
1.1.1 / 2014-10-20
|
||||
==================
|
||||
|
||||
* Mark `application/x-www-form-urlencoded` as compressible.
|
||||
|
||||
1.1.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `application/font-woff2`
|
||||
|
||||
1.0.3 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Fix engine requirement in package
|
||||
|
||||
1.0.2 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Add `application/coap-group+json`
|
||||
* Add `application/dcd`
|
||||
* Add `application/vnd.apache.thrift.binary`
|
||||
* Add `image/vnd.tencent.tap`
|
||||
* Mark all JSON-derived types as compressible
|
||||
* Update `text/vtt` data
|
||||
|
||||
1.0.1 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Fix extension ordering
|
||||
|
||||
1.0.0 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Add `application/atf`
|
||||
* Add `application/merge-patch+json`
|
||||
* Add `multipart/x-mixed-replace`
|
||||
* Add `source: 'apache'` metadata
|
||||
* Add `source: 'iana'` metadata
|
||||
* Remove badly-assumed charset data
|
||||
22
node_modules/body-parser/node_modules/mime-db/LICENSE
generated
vendored
Normal file
22
node_modules/body-parser/node_modules/mime-db/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.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.
|
||||
82
node_modules/body-parser/node_modules/mime-db/README.md
generated
vendored
Normal file
82
node_modules/body-parser/node_modules/mime-db/README.md
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
# mime-db
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
This is a database of all mime types.
|
||||
It consists of a single, public JSON file and does not include any logic,
|
||||
allowing it to remain as un-opinionated as possible with an API.
|
||||
It aggregates data from the following sources:
|
||||
|
||||
- http://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install mime-db
|
||||
```
|
||||
|
||||
### Database Download
|
||||
|
||||
If you're crazy enough to use this in the browser, you can just grab the
|
||||
JSON file using [RawGit](https://rawgit.com/). It is recommended to replace
|
||||
`master` with [a release tag](https://github.com/jshttp/mime-db/tags) as the
|
||||
JSON format may change in the future.
|
||||
|
||||
```
|
||||
https://cdn.rawgit.com/jshttp/mime-db/master/db.json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var db = require('mime-db');
|
||||
|
||||
// grab data on .js files
|
||||
var data = db['application/javascript'];
|
||||
```
|
||||
|
||||
## Data Structure
|
||||
|
||||
The JSON file is a map lookup for lowercased mime types.
|
||||
Each mime type has the following properties:
|
||||
|
||||
- `.source` - where the mime type is defined.
|
||||
If not set, it's probably a custom media type.
|
||||
- `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
|
||||
- `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)
|
||||
- `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types)
|
||||
- `.extensions[]` - known extensions associated with this mime type.
|
||||
- `.compressible` - whether a file of this type can be gzipped.
|
||||
- `.charset` - the default charset associated with this type, if any.
|
||||
|
||||
If unknown, every property could be `undefined`.
|
||||
|
||||
## Contributing
|
||||
|
||||
To edit the database, only make PRs against `src/custom.json` or
|
||||
`src/custom-suffix.json`.
|
||||
|
||||
To update the build, run `npm run build`.
|
||||
|
||||
## Adding Custom Media Types
|
||||
|
||||
The best way to get new media types included in this library is to register
|
||||
them with the IANA. The community registration procedure is outlined in
|
||||
[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types
|
||||
registered with the IANA are automatically pulled into this library.
|
||||
|
||||
[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg
|
||||
[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg
|
||||
[npm-url]: https://npmjs.org/package/mime-db
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-db
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
|
||||
[node-image]: https://img.shields.io/node/v/mime-db.svg
|
||||
[node-url]: http://nodejs.org/download/
|
||||
6575
node_modules/body-parser/node_modules/mime-db/db.json
generated
vendored
Normal file
6575
node_modules/body-parser/node_modules/mime-db/db.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/body-parser/node_modules/mime-db/index.js
generated
vendored
Normal file
11
node_modules/body-parser/node_modules/mime-db/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* mime-db
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = require('./db.json')
|
||||
125
node_modules/body-parser/node_modules/mime-db/package.json
generated
vendored
Normal file
125
node_modules/body-parser/node_modules/mime-db/package.json
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"mime-db@~1.22.0",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser\\node_modules\\mime-types"
|
||||
]
|
||||
],
|
||||
"_from": "mime-db@>=1.22.0 <1.23.0",
|
||||
"_id": "mime-db@1.22.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser/mime-db",
|
||||
"_nodeVersion": "4.2.3",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/mime-db-1.22.0.tgz_1455558813990_0.7830642955377698"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "mime-db",
|
||||
"raw": "mime-db@~1.22.0",
|
||||
"rawSpec": "~1.22.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.22.0 <1.23.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser/mime-types"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.22.0.tgz",
|
||||
"_shasum": "ab23a6372dc9d86d3dc9121bd0ebd38105a1904a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime-db@~1.22.0",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser\\node_modules\\mime-types",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-db/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
{
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Media Type Database",
|
||||
"devDependencies": {
|
||||
"bluebird": "3.3.1",
|
||||
"co": "4.6.0",
|
||||
"cogent": "1.0.1",
|
||||
"csv-parse": "1.0.1",
|
||||
"gnode": "0.1.2",
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "1.21.5",
|
||||
"raw-body": "2.1.5",
|
||||
"stream-to-array": "2.2.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ab23a6372dc9d86d3dc9121bd0ebd38105a1904a",
|
||||
"tarball": "http://registry.npmjs.org/mime-db/-/mime-db-1.22.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"db.json",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "ed88d32405582a5aaff6225d1210005d6be2623e",
|
||||
"homepage": "https://github.com/jshttp/mime-db#readme",
|
||||
"keywords": [
|
||||
"charset",
|
||||
"charsets",
|
||||
"database",
|
||||
"db",
|
||||
"mime",
|
||||
"type",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "mime-db",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/mime-db.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build",
|
||||
"fetch": "gnode scripts/fetch-apache && gnode scripts/fetch-iana && gnode scripts/fetch-nginx",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"update": "npm run fetch && npm run build"
|
||||
},
|
||||
"version": "1.22.0"
|
||||
}
|
||||
191
node_modules/body-parser/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
191
node_modules/body-parser/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
2.1.10 / 2016-02-15
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.22.0
|
||||
- Add new mime types
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
|
||||
2.1.9 / 2016-01-06
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.21.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.8 / 2015-11-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.20.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.7 / 2015-09-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.19.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.6 / 2015-09-03
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.18.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.5 / 2015-08-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.17.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.4 / 2015-07-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.16.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.3 / 2015-07-13
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.15.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.2 / 2015-06-25
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.14.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.1 / 2015-06-08
|
||||
==================
|
||||
|
||||
* perf: fix deopt during mapping
|
||||
|
||||
2.1.0 / 2015-06-07
|
||||
==================
|
||||
|
||||
* Fix incorrectly treating extension-less file name as extension
|
||||
- i.e. `'path/to/json'` will no longer return `application/json`
|
||||
* Fix `.charset(type)` to accept parameters
|
||||
* Fix `.charset(type)` to match case-insensitive
|
||||
* Improve generation of extension to MIME mapping
|
||||
* Refactor internals for readability and no argument reassignment
|
||||
* Prefer `application/*` MIME types from the same source
|
||||
* Prefer any type over `application/octet-stream`
|
||||
* deps: mime-db@~1.13.0
|
||||
- Add nginx as a source
|
||||
- Add new mime types
|
||||
|
||||
2.0.14 / 2015-06-06
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.12.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.13 / 2015-05-31
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.11.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.12 / 2015-05-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.10.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.11 / 2015-05-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.9.1
|
||||
- Add new mime types
|
||||
|
||||
2.0.10 / 2015-03-13
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.8.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.9 / 2015-02-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.7.0
|
||||
- Add new mime types
|
||||
- Community extensions ownership transferred from `node-mime`
|
||||
|
||||
2.0.8 / 2015-01-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.6.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.7 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.5.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
|
||||
2.0.6 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.4.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
- Remove example template MIME types
|
||||
|
||||
2.0.5 / 2014-12-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.1
|
||||
- Fix missing extensions
|
||||
|
||||
2.0.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.2.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.2 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.1.0
|
||||
- Add new mime types
|
||||
- Add additional compressible
|
||||
- Update charsets
|
||||
|
||||
2.0.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
|
||||
2.0.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* Use `mime-db`
|
||||
* Remove `.define()`
|
||||
|
||||
1.0.2 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Set charset=utf-8 for `text/javascript`
|
||||
|
||||
1.0.1 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Add `text/jsx` type
|
||||
|
||||
1.0.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Return `false` for unknown types
|
||||
* Set charset=utf-8 for `application/json`
|
||||
|
||||
0.1.0 / 2014-05-02
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/body-parser/node_modules/mime-types/LICENSE
generated
vendored
Normal file
23
node_modules/body-parser/node_modules/mime-types/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.
|
||||
103
node_modules/body-parser/node_modules/mime-types/README.md
generated
vendored
Normal file
103
node_modules/body-parser/node_modules/mime-types/README.md
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
# mime-types
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
The ultimate javascript content-type utility.
|
||||
|
||||
Similar to [node-mime](https://github.com/broofa/node-mime), except:
|
||||
|
||||
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`,
|
||||
so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
|
||||
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
|
||||
- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db)
|
||||
- No `.define()` functionality
|
||||
|
||||
Otherwise, the API is compatible.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install mime-types
|
||||
```
|
||||
|
||||
## Adding Types
|
||||
|
||||
All mime types are based on [mime-db](https://github.com/jshttp/mime-db),
|
||||
so open a PR there if you'd like to add mime types.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var mime = require('mime-types')
|
||||
```
|
||||
|
||||
All functions return `false` if input is invalid or not found.
|
||||
|
||||
### mime.lookup(path)
|
||||
|
||||
Lookup the content-type associated with a file.
|
||||
|
||||
```js
|
||||
mime.lookup('json') // 'application/json'
|
||||
mime.lookup('.md') // 'text/x-markdown'
|
||||
mime.lookup('file.html') // 'text/html'
|
||||
mime.lookup('folder/file.js') // 'application/javascript'
|
||||
mime.lookup('folder/.htaccess') // false
|
||||
|
||||
mime.lookup('cats') // false
|
||||
```
|
||||
|
||||
### mime.contentType(type)
|
||||
|
||||
Create a full content-type header given a content-type or extension.
|
||||
|
||||
```js
|
||||
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
|
||||
mime.contentType('file.json') // 'application/json; charset=utf-8'
|
||||
|
||||
// from a full path
|
||||
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
|
||||
```
|
||||
|
||||
### mime.extension(type)
|
||||
|
||||
Get the default extension for a content-type.
|
||||
|
||||
```js
|
||||
mime.extension('application/octet-stream') // 'bin'
|
||||
```
|
||||
|
||||
### mime.charset(type)
|
||||
|
||||
Lookup the implied default charset of a content-type.
|
||||
|
||||
```js
|
||||
mime.charset('text/x-markdown') // 'UTF-8'
|
||||
```
|
||||
|
||||
### var type = mime.types[extension]
|
||||
|
||||
A map of content-types by extension.
|
||||
|
||||
### [extensions...] = mime.extensions[type]
|
||||
|
||||
A map of extensions by content-type.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/mime-types.svg
|
||||
[npm-url]: https://npmjs.org/package/mime-types
|
||||
[node-version-image]: https://img.shields.io/node/v/mime-types.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/mime-types
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types
|
||||
[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg
|
||||
[downloads-url]: https://npmjs.org/package/mime-types
|
||||
188
node_modules/body-parser/node_modules/mime-types/index.js
generated
vendored
Normal file
188
node_modules/body-parser/node_modules/mime-types/index.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/*!
|
||||
* mime-types
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var db = require('mime-db')
|
||||
var extname = require('path').extname
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var extractTypeRegExp = /^\s*([^;\s]*)(?:;|\s|$)/
|
||||
var textTypeRegExp = /^text\//i
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.charset = charset
|
||||
exports.charsets = { lookup: charset }
|
||||
exports.contentType = contentType
|
||||
exports.extension = extension
|
||||
exports.extensions = Object.create(null)
|
||||
exports.lookup = lookup
|
||||
exports.types = Object.create(null)
|
||||
|
||||
// Populate the extensions/types maps
|
||||
populateMaps(exports.extensions, exports.types)
|
||||
|
||||
/**
|
||||
* Get the default charset for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function charset(type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = extractTypeRegExp.exec(type)
|
||||
var mime = match && db[match[1].toLowerCase()]
|
||||
|
||||
if (mime && mime.charset) {
|
||||
return mime.charset
|
||||
}
|
||||
|
||||
// default text/* to utf-8
|
||||
if (match && textTypeRegExp.test(match[1])) {
|
||||
return 'UTF-8'
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a full Content-Type header given a MIME type or extension.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function contentType(str) {
|
||||
// TODO: should this even be in this module?
|
||||
if (!str || typeof str !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
var mime = str.indexOf('/') === -1
|
||||
? exports.lookup(str)
|
||||
: str
|
||||
|
||||
if (!mime) {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use content-type or other module
|
||||
if (mime.indexOf('charset') === -1) {
|
||||
var charset = exports.charset(mime)
|
||||
if (charset) mime += '; charset=' + charset.toLowerCase()
|
||||
}
|
||||
|
||||
return mime
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default extension for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function extension(type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = extractTypeRegExp.exec(type)
|
||||
|
||||
// get extensions
|
||||
var exts = match && exports.extensions[match[1].toLowerCase()]
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exts[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup the MIME type for a file path/extension.
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {boolean|string}
|
||||
*/
|
||||
|
||||
function lookup(path) {
|
||||
if (!path || typeof path !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// get the extension ("ext" or ".ext" or full path)
|
||||
var extension = extname('x.' + path)
|
||||
.toLowerCase()
|
||||
.substr(1)
|
||||
|
||||
if (!extension) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exports.types[extension] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the extensions and types maps.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function populateMaps(extensions, types) {
|
||||
// source preference (least -> most)
|
||||
var preference = ['nginx', 'apache', undefined, 'iana']
|
||||
|
||||
Object.keys(db).forEach(function forEachMimeType(type) {
|
||||
var mime = db[type]
|
||||
var exts = mime.extensions
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return
|
||||
}
|
||||
|
||||
// mime -> extensions
|
||||
extensions[type] = exts
|
||||
|
||||
// extension -> mime
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
var extension = exts[i]
|
||||
|
||||
if (types[extension]) {
|
||||
var from = preference.indexOf(db[types[extension]].source)
|
||||
var to = preference.indexOf(mime.source)
|
||||
|
||||
if (types[extension] !== 'application/octet-stream'
|
||||
&& from > to || (from === to && types[extension].substr(0, 12) === 'application/')) {
|
||||
// skip the remapping
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// set the extension -> mime
|
||||
types[extension] = type
|
||||
}
|
||||
})
|
||||
}
|
||||
114
node_modules/body-parser/node_modules/mime-types/package.json
generated
vendored
Normal file
114
node_modules/body-parser/node_modules/mime-types/package.json
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"mime-types@~2.1.10",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser\\node_modules\\type-is"
|
||||
]
|
||||
],
|
||||
"_from": "mime-types@>=2.1.10 <2.2.0",
|
||||
"_id": "mime-types@2.1.10",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser/mime-types",
|
||||
"_nodeVersion": "4.2.3",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/mime-types-2.1.10.tgz_1455575237256_0.9163766100537032"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "mime-types",
|
||||
"raw": "mime-types@~2.1.10",
|
||||
"rawSpec": "~2.1.10",
|
||||
"scope": null,
|
||||
"spec": ">=2.1.10 <2.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser/type-is"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.10.tgz",
|
||||
"_shasum": "b93c7cb4362e16d41072a7e54538fb4d43070837",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime-types@~2.1.10",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser\\node_modules\\type-is",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/mime-types/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jeremiah Senkpiel",
|
||||
"email": "fishrock123@rocketmail.com",
|
||||
"url": "https://searchbeam.jit.su"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mime-db": "~1.22.0"
|
||||
},
|
||||
"description": "The ultimate javascript content-type utility.",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b93c7cb4362e16d41072a7e54538fb4d43070837",
|
||||
"tarball": "http://registry.npmjs.org/mime-types/-/mime-types-2.1.10.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "70785d38e9cc251137b00f73ab3d3257c4aea203",
|
||||
"homepage": "https://github.com/jshttp/mime-types#readme",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "fishrock123",
|
||||
"email": "fishrock123@rocketmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "mime-types",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/mime-types.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec test/test.js",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"
|
||||
},
|
||||
"version": "2.1.10"
|
||||
}
|
||||
1
node_modules/body-parser/node_modules/qs/.eslintignore
generated
vendored
Normal file
1
node_modules/body-parser/node_modules/qs/.eslintignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
17
node_modules/body-parser/node_modules/qs/.eslintrc
generated
vendored
Normal file
17
node_modules/body-parser/node_modules/qs/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"complexity": [2, 19],
|
||||
"consistent-return": [1],
|
||||
"max-params": [2, 9],
|
||||
"max-statements": [2, 33],
|
||||
"no-extra-parens": [1],
|
||||
"no-continue": [1],
|
||||
"no-magic-numbers": 0,
|
||||
"no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
|
||||
"operator-linebreak": 1
|
||||
}
|
||||
}
|
||||
18
node_modules/body-parser/node_modules/qs/.npmignore
generated
vendored
Normal file
18
node_modules/body-parser/node_modules/qs/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
.idea
|
||||
*.iml
|
||||
npm-debug.log
|
||||
dump.rdb
|
||||
node_modules
|
||||
results.tap
|
||||
results.xml
|
||||
npm-shrinkwrap.json
|
||||
config.json
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
*/*/.DS_Store
|
||||
._*
|
||||
*/._*
|
||||
*/*/._*
|
||||
coverage.*
|
||||
lib-cov
|
||||
complexity.md
|
||||
69
node_modules/body-parser/node_modules/qs/.travis.yml
generated
vendored
Normal file
69
node_modules/body-parser/node_modules/qs/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "5.3"
|
||||
- "5.2"
|
||||
- "5.1"
|
||||
- "5.0"
|
||||
- "4.2"
|
||||
- "4.1"
|
||||
- "4.0"
|
||||
- "iojs-v3.3"
|
||||
- "iojs-v3.2"
|
||||
- "iojs-v3.1"
|
||||
- "iojs-v3.0"
|
||||
- "iojs-v2.5"
|
||||
- "iojs-v2.4"
|
||||
- "iojs-v2.3"
|
||||
- "iojs-v2.2"
|
||||
- "iojs-v2.1"
|
||||
- "iojs-v2.0"
|
||||
- "iojs-v1.8"
|
||||
- "iojs-v1.7"
|
||||
- "iojs-v1.6"
|
||||
- "iojs-v1.5"
|
||||
- "iojs-v1.4"
|
||||
- "iojs-v1.3"
|
||||
- "iojs-v1.2"
|
||||
- "iojs-v1.1"
|
||||
- "iojs-v1.0"
|
||||
- "0.12"
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.9"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
- "0.4"
|
||||
before_install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi'
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi'
|
||||
script:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" != "4.2" ]; then npm run tests-only ; else npm test ; fi'
|
||||
sudo: false
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- node_js: "5.2"
|
||||
- node_js: "5.1"
|
||||
- node_js: "5.0"
|
||||
- node_js: "4.1"
|
||||
- node_js: "4.0"
|
||||
- node_js: "iojs-v3.2"
|
||||
- node_js: "iojs-v3.1"
|
||||
- node_js: "iojs-v3.0"
|
||||
- node_js: "iojs-v2.4"
|
||||
- node_js: "iojs-v2.3"
|
||||
- node_js: "iojs-v2.2"
|
||||
- node_js: "iojs-v2.1"
|
||||
- node_js: "iojs-v2.0"
|
||||
- node_js: "iojs-v1.7"
|
||||
- node_js: "iojs-v1.6"
|
||||
- node_js: "iojs-v1.5"
|
||||
- node_js: "iojs-v1.4"
|
||||
- node_js: "iojs-v1.3"
|
||||
- node_js: "iojs-v1.2"
|
||||
- node_js: "iojs-v1.1"
|
||||
- node_js: "iojs-v1.0"
|
||||
- node_js: "0.11"
|
||||
- node_js: "0.9"
|
||||
- node_js: "0.6"
|
||||
- node_js: "0.4"
|
||||
115
node_modules/body-parser/node_modules/qs/CHANGELOG.md
generated
vendored
Normal file
115
node_modules/body-parser/node_modules/qs/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=34&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.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.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
|
||||
1
node_modules/body-parser/node_modules/qs/CONTRIBUTING.md
generated
vendored
Normal file
1
node_modules/body-parser/node_modules/qs/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Please view our [hapijs contributing guide](https://github.com/hapijs/hapi/blob/master/CONTRIBUTING.md).
|
||||
28
node_modules/body-parser/node_modules/qs/LICENSE
generated
vendored
Normal file
28
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
|
||||
335
node_modules/body-parser/node_modules/qs/README.md
generated
vendored
Normal file
335
node_modules/body-parser/node_modules/qs/README.md
generated
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
# qs
|
||||
|
||||
A querystring parsing and stringifying library with some added security.
|
||||
|
||||
[](http://travis-ci.org/ljharb/qs)
|
||||
|
||||
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 plain 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 plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true });
|
||||
assert.deepEqual(plainObject, { 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' });
|
||||
```
|
||||
|
||||
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' } });
|
||||
```
|
||||
|
||||
### 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:
|
||||
|
||||
```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' }] });
|
||||
```
|
||||
|
||||
### 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');
|
||||
```
|
||||
|
||||
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'
|
||||
```
|
||||
|
||||
Empty strings and null values will omit the value, but the equals sign (=) remains in place:
|
||||
|
||||
```javascript
|
||||
assert.equal(qs.stringify({ a: '' }), 'a=');
|
||||
```
|
||||
|
||||
Properties that are set to `undefined` will be omitted entirely:
|
||||
|
||||
```javascript
|
||||
assert.equal(qs.stringify({ a: null, b: undefined }), 'a=');
|
||||
```
|
||||
|
||||
The delimiter may be overridden with stringify as well:
|
||||
|
||||
```javascript
|
||||
assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d');
|
||||
```
|
||||
|
||||
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');
|
||||
```
|
||||
21
node_modules/body-parser/node_modules/qs/bower.json
generated
vendored
Normal file
21
node_modules/body-parser/node_modules/qs/bower.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "qs",
|
||||
"main": "dist/qs.js",
|
||||
"homepage": "https://github.com/hapijs/qs",
|
||||
"authors": [
|
||||
"Nathan LaFreniere <quitlahok@gmail.com>"
|
||||
],
|
||||
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
|
||||
"keywords": [
|
||||
"querystring",
|
||||
"qs"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
15
node_modules/body-parser/node_modules/qs/component.json
generated
vendored
Normal file
15
node_modules/body-parser/node_modules/qs/component.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "qs",
|
||||
"repository": "hapijs/qs",
|
||||
"description": "query-string parser / stringifier with nesting support",
|
||||
"version": "6.1.0",
|
||||
"keywords": ["querystring", "query", "parser"],
|
||||
"main": "lib/index.js",
|
||||
"scripts": [
|
||||
"lib/index.js",
|
||||
"lib/parse.js",
|
||||
"lib/stringify.js",
|
||||
"lib/utils.js"
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
}
|
||||
476
node_modules/body-parser/node_modules/qs/dist/qs.js
generated
vendored
Normal file
476
node_modules/body-parser/node_modules/qs/dist/qs.js
generated
vendored
Normal file
@@ -0,0 +1,476 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Stringify = require('./stringify');
|
||||
var Parse = require('./parse');
|
||||
|
||||
module.exports = {
|
||||
stringify: Stringify,
|
||||
parse: Parse
|
||||
};
|
||||
|
||||
},{"./parse":2,"./stringify":3}],2:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Utils = require('./utils');
|
||||
|
||||
var internals = {
|
||||
delimiter: '&',
|
||||
depth: 5,
|
||||
arrayLimit: 20,
|
||||
parameterLimit: 1000,
|
||||
strictNullHandling: false,
|
||||
plainObjects: false,
|
||||
allowPrototypes: false,
|
||||
allowDots: false
|
||||
};
|
||||
|
||||
internals.parseValues = function (str, options) {
|
||||
var obj = {};
|
||||
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
|
||||
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
var part = parts[i];
|
||||
var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
|
||||
|
||||
if (pos === -1) {
|
||||
obj[Utils.decode(part)] = '';
|
||||
|
||||
if (options.strictNullHandling) {
|
||||
obj[Utils.decode(part)] = null;
|
||||
}
|
||||
} else {
|
||||
var key = Utils.decode(part.slice(0, pos));
|
||||
var val = Utils.decode(part.slice(pos + 1));
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
obj[key] = [].concat(obj[key]).concat(val);
|
||||
} else {
|
||||
obj[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
internals.parseObject = function (chain, val, options) {
|
||||
if (!chain.length) {
|
||||
return val;
|
||||
}
|
||||
|
||||
var root = chain.shift();
|
||||
|
||||
var obj;
|
||||
if (root === '[]') {
|
||||
obj = [];
|
||||
obj = obj.concat(internals.parseObject(chain, val, options));
|
||||
} else {
|
||||
obj = options.plainObjects ? Object.create(null) : {};
|
||||
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
|
||||
var index = parseInt(cleanRoot, 10);
|
||||
if (
|
||||
!isNaN(index) &&
|
||||
root !== cleanRoot &&
|
||||
String(index) === cleanRoot &&
|
||||
index >= 0 &&
|
||||
(options.parseArrays && index <= options.arrayLimit)
|
||||
) {
|
||||
obj = [];
|
||||
obj[index] = internals.parseObject(chain, val, options);
|
||||
} else {
|
||||
obj[cleanRoot] = internals.parseObject(chain, val, options);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
internals.parseKeys = function (givenKey, val, options) {
|
||||
if (!givenKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Transform dot notation to bracket notation
|
||||
var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey;
|
||||
|
||||
// The regex chunks
|
||||
|
||||
var parent = /^([^\[\]]*)/;
|
||||
var child = /(\[[^\[\]]*\])/g;
|
||||
|
||||
// Get the parent
|
||||
|
||||
var segment = parent.exec(key);
|
||||
|
||||
// Stash the parent if it exists
|
||||
|
||||
var keys = [];
|
||||
if (segment[1]) {
|
||||
// If we aren't using plain objects, optionally prefix keys
|
||||
// that would overwrite object prototype properties
|
||||
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {
|
||||
if (!options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
keys.push(segment[1]);
|
||||
}
|
||||
|
||||
// Loop through children appending to the array until we hit depth
|
||||
|
||||
var i = 0;
|
||||
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
||||
i += 1;
|
||||
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
|
||||
if (!options.allowPrototypes) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
keys.push(segment[1]);
|
||||
}
|
||||
|
||||
// If there's a remainder, just add whatever is left
|
||||
|
||||
if (segment) {
|
||||
keys.push('[' + key.slice(segment.index) + ']');
|
||||
}
|
||||
|
||||
return internals.parseObject(keys, val, options);
|
||||
};
|
||||
|
||||
module.exports = function (str, opts) {
|
||||
var options = opts || {};
|
||||
options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
|
||||
options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
|
||||
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
|
||||
options.parseArrays = options.parseArrays !== false;
|
||||
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;
|
||||
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;
|
||||
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;
|
||||
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
|
||||
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
|
||||
|
||||
if (
|
||||
str === '' ||
|
||||
str === null ||
|
||||
typeof str === 'undefined'
|
||||
) {
|
||||
return options.plainObjects ? Object.create(null) : {};
|
||||
}
|
||||
|
||||
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
|
||||
var obj = options.plainObjects ? Object.create(null) : {};
|
||||
|
||||
// Iterate over the keys and setup the new object
|
||||
|
||||
var keys = Object.keys(tempObj);
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
var newObj = internals.parseKeys(key, tempObj[key], options);
|
||||
obj = Utils.merge(obj, newObj, options);
|
||||
}
|
||||
|
||||
return Utils.compact(obj);
|
||||
};
|
||||
|
||||
},{"./utils":4}],3:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Utils = require('./utils');
|
||||
|
||||
var internals = {
|
||||
delimiter: '&',
|
||||
arrayPrefixGenerators: {
|
||||
brackets: function (prefix) {
|
||||
return prefix + '[]';
|
||||
},
|
||||
indices: function (prefix, key) {
|
||||
return prefix + '[' + key + ']';
|
||||
},
|
||||
repeat: function (prefix) {
|
||||
return prefix;
|
||||
}
|
||||
},
|
||||
strictNullHandling: false,
|
||||
skipNulls: false,
|
||||
encode: true
|
||||
};
|
||||
|
||||
internals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) {
|
||||
var obj = object;
|
||||
if (typeof filter === 'function') {
|
||||
obj = filter(prefix, obj);
|
||||
} else if (Utils.isBuffer(obj)) {
|
||||
obj = String(obj);
|
||||
} else if (obj instanceof Date) {
|
||||
obj = obj.toISOString();
|
||||
} else if (obj === null) {
|
||||
if (strictNullHandling) {
|
||||
return encode ? Utils.encode(prefix) : prefix;
|
||||
}
|
||||
|
||||
obj = '';
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {
|
||||
if (encode) {
|
||||
return [Utils.encode(prefix) + '=' + Utils.encode(obj)];
|
||||
}
|
||||
return [prefix + '=' + obj];
|
||||
}
|
||||
|
||||
var values = [];
|
||||
|
||||
if (typeof obj === 'undefined') {
|
||||
return values;
|
||||
}
|
||||
|
||||
var objKeys;
|
||||
if (Array.isArray(filter)) {
|
||||
objKeys = filter;
|
||||
} else {
|
||||
var keys = Object.keys(obj);
|
||||
objKeys = sort ? keys.sort(sort) : keys;
|
||||
}
|
||||
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
|
||||
if (skipNulls && obj[key] === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
} else {
|
||||
values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
};
|
||||
|
||||
module.exports = function (object, opts) {
|
||||
var obj = object;
|
||||
var options = opts || {};
|
||||
var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
|
||||
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
|
||||
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;
|
||||
var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;
|
||||
var sort = typeof options.sort === 'function' ? options.sort : null;
|
||||
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
|
||||
var objKeys;
|
||||
var filter;
|
||||
if (typeof options.filter === 'function') {
|
||||
filter = options.filter;
|
||||
obj = filter('', obj);
|
||||
} else if (Array.isArray(options.filter)) {
|
||||
objKeys = filter = options.filter;
|
||||
}
|
||||
|
||||
var keys = [];
|
||||
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var arrayFormat;
|
||||
if (options.arrayFormat in internals.arrayPrefixGenerators) {
|
||||
arrayFormat = options.arrayFormat;
|
||||
} else if ('indices' in options) {
|
||||
arrayFormat = options.indices ? 'indices' : 'repeat';
|
||||
} else {
|
||||
arrayFormat = 'indices';
|
||||
}
|
||||
|
||||
var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
|
||||
|
||||
if (!objKeys) {
|
||||
objKeys = Object.keys(obj);
|
||||
}
|
||||
|
||||
if (sort) {
|
||||
objKeys.sort(sort);
|
||||
}
|
||||
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
|
||||
if (skipNulls && obj[key] === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
}
|
||||
|
||||
return keys.join(delimiter);
|
||||
};
|
||||
|
||||
},{"./utils":4}],4:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var hexTable = (function () {
|
||||
var array = new Array(256);
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
|
||||
}
|
||||
|
||||
return array;
|
||||
}());
|
||||
|
||||
exports.arrayToObject = function (source, options) {
|
||||
var obj = options.plainObjects ? Object.create(null) : {};
|
||||
for (var i = 0; i < source.length; ++i) {
|
||||
if (typeof source[i] !== 'undefined') {
|
||||
obj[i] = source[i];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.merge = function (target, source, options) {
|
||||
if (!source) {
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
if (Array.isArray(target)) {
|
||||
target.push(source);
|
||||
} else if (typeof target === 'object') {
|
||||
target[source] = true;
|
||||
} else {
|
||||
return [target, source];
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof target !== 'object') {
|
||||
return [target].concat(source);
|
||||
}
|
||||
|
||||
var mergeTarget = target;
|
||||
if (Array.isArray(target) && !Array.isArray(source)) {
|
||||
mergeTarget = exports.arrayToObject(target, options);
|
||||
}
|
||||
|
||||
return Object.keys(source).reduce(function (acc, key) {
|
||||
var value = source[key];
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(acc, key)) {
|
||||
acc[key] = exports.merge(acc[key], value, options);
|
||||
} else {
|
||||
acc[key] = value;
|
||||
}
|
||||
return acc;
|
||||
}, mergeTarget);
|
||||
};
|
||||
|
||||
exports.decode = function (str) {
|
||||
try {
|
||||
return decodeURIComponent(str.replace(/\+/g, ' '));
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
exports.encode = function (str) {
|
||||
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
||||
// It has been adapted here for stricter adherence to RFC 3986
|
||||
if (str.length === 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var string = typeof str === 'string' ? str : String(str);
|
||||
|
||||
var out = '';
|
||||
for (var i = 0; i < string.length; ++i) {
|
||||
var c = string.charCodeAt(i);
|
||||
|
||||
if (
|
||||
c === 0x2D || // -
|
||||
c === 0x2E || // .
|
||||
c === 0x5F || // _
|
||||
c === 0x7E || // ~
|
||||
(c >= 0x30 && c <= 0x39) || // 0-9
|
||||
(c >= 0x41 && c <= 0x5A) || // a-z
|
||||
(c >= 0x61 && c <= 0x7A) // A-Z
|
||||
) {
|
||||
out += string.charAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x80) {
|
||||
out = out + hexTable[c];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x800) {
|
||||
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0xD800 || c >= 0xE000) {
|
||||
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||
out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
exports.compact = function (obj, references) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var refs = references || [];
|
||||
var lookup = refs.indexOf(obj);
|
||||
if (lookup !== -1) {
|
||||
return refs[lookup];
|
||||
}
|
||||
|
||||
refs.push(obj);
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
var compacted = [];
|
||||
|
||||
for (var i = 0; i < obj.length; ++i) {
|
||||
if (typeof obj[i] !== 'undefined') {
|
||||
compacted.push(obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return compacted;
|
||||
}
|
||||
|
||||
var keys = Object.keys(obj);
|
||||
for (var j = 0; j < keys.length; ++j) {
|
||||
var key = keys[j];
|
||||
obj[key] = exports.compact(obj[key], refs);
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.isRegExp = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
||||
};
|
||||
|
||||
exports.isBuffer = function (obj) {
|
||||
if (obj === null || typeof obj === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
||||
};
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
||||
9
node_modules/body-parser/node_modules/qs/lib/index.js
generated
vendored
Normal file
9
node_modules/body-parser/node_modules/qs/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var Stringify = require('./stringify');
|
||||
var Parse = require('./parse');
|
||||
|
||||
module.exports = {
|
||||
stringify: Stringify,
|
||||
parse: Parse
|
||||
};
|
||||
164
node_modules/body-parser/node_modules/qs/lib/parse.js
generated
vendored
Normal file
164
node_modules/body-parser/node_modules/qs/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
'use strict';
|
||||
|
||||
var Utils = require('./utils');
|
||||
|
||||
var internals = {
|
||||
delimiter: '&',
|
||||
depth: 5,
|
||||
arrayLimit: 20,
|
||||
parameterLimit: 1000,
|
||||
strictNullHandling: false,
|
||||
plainObjects: false,
|
||||
allowPrototypes: false,
|
||||
allowDots: false
|
||||
};
|
||||
|
||||
internals.parseValues = function (str, options) {
|
||||
var obj = {};
|
||||
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
|
||||
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
var part = parts[i];
|
||||
var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
|
||||
|
||||
if (pos === -1) {
|
||||
obj[Utils.decode(part)] = '';
|
||||
|
||||
if (options.strictNullHandling) {
|
||||
obj[Utils.decode(part)] = null;
|
||||
}
|
||||
} else {
|
||||
var key = Utils.decode(part.slice(0, pos));
|
||||
var val = Utils.decode(part.slice(pos + 1));
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
obj[key] = [].concat(obj[key]).concat(val);
|
||||
} else {
|
||||
obj[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
internals.parseObject = function (chain, val, options) {
|
||||
if (!chain.length) {
|
||||
return val;
|
||||
}
|
||||
|
||||
var root = chain.shift();
|
||||
|
||||
var obj;
|
||||
if (root === '[]') {
|
||||
obj = [];
|
||||
obj = obj.concat(internals.parseObject(chain, val, options));
|
||||
} else {
|
||||
obj = options.plainObjects ? Object.create(null) : {};
|
||||
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
|
||||
var index = parseInt(cleanRoot, 10);
|
||||
if (
|
||||
!isNaN(index) &&
|
||||
root !== cleanRoot &&
|
||||
String(index) === cleanRoot &&
|
||||
index >= 0 &&
|
||||
(options.parseArrays && index <= options.arrayLimit)
|
||||
) {
|
||||
obj = [];
|
||||
obj[index] = internals.parseObject(chain, val, options);
|
||||
} else {
|
||||
obj[cleanRoot] = internals.parseObject(chain, val, options);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
internals.parseKeys = function (givenKey, val, options) {
|
||||
if (!givenKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Transform dot notation to bracket notation
|
||||
var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey;
|
||||
|
||||
// The regex chunks
|
||||
|
||||
var parent = /^([^\[\]]*)/;
|
||||
var child = /(\[[^\[\]]*\])/g;
|
||||
|
||||
// Get the parent
|
||||
|
||||
var segment = parent.exec(key);
|
||||
|
||||
// Stash the parent if it exists
|
||||
|
||||
var keys = [];
|
||||
if (segment[1]) {
|
||||
// If we aren't using plain objects, optionally prefix keys
|
||||
// that would overwrite object prototype properties
|
||||
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {
|
||||
if (!options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
keys.push(segment[1]);
|
||||
}
|
||||
|
||||
// Loop through children appending to the array until we hit depth
|
||||
|
||||
var i = 0;
|
||||
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
||||
i += 1;
|
||||
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
|
||||
if (!options.allowPrototypes) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
keys.push(segment[1]);
|
||||
}
|
||||
|
||||
// If there's a remainder, just add whatever is left
|
||||
|
||||
if (segment) {
|
||||
keys.push('[' + key.slice(segment.index) + ']');
|
||||
}
|
||||
|
||||
return internals.parseObject(keys, val, options);
|
||||
};
|
||||
|
||||
module.exports = function (str, opts) {
|
||||
var options = opts || {};
|
||||
options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
|
||||
options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
|
||||
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
|
||||
options.parseArrays = options.parseArrays !== false;
|
||||
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;
|
||||
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;
|
||||
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;
|
||||
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
|
||||
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
|
||||
|
||||
if (
|
||||
str === '' ||
|
||||
str === null ||
|
||||
typeof str === 'undefined'
|
||||
) {
|
||||
return options.plainObjects ? Object.create(null) : {};
|
||||
}
|
||||
|
||||
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
|
||||
var obj = options.plainObjects ? Object.create(null) : {};
|
||||
|
||||
// Iterate over the keys and setup the new object
|
||||
|
||||
var keys = Object.keys(tempObj);
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
var newObj = internals.parseKeys(key, tempObj[key], options);
|
||||
obj = Utils.merge(obj, newObj, options);
|
||||
}
|
||||
|
||||
return Utils.compact(obj);
|
||||
};
|
||||
131
node_modules/body-parser/node_modules/qs/lib/stringify.js
generated
vendored
Normal file
131
node_modules/body-parser/node_modules/qs/lib/stringify.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
'use strict';
|
||||
|
||||
var Utils = require('./utils');
|
||||
|
||||
var internals = {
|
||||
delimiter: '&',
|
||||
arrayPrefixGenerators: {
|
||||
brackets: function (prefix) {
|
||||
return prefix + '[]';
|
||||
},
|
||||
indices: function (prefix, key) {
|
||||
return prefix + '[' + key + ']';
|
||||
},
|
||||
repeat: function (prefix) {
|
||||
return prefix;
|
||||
}
|
||||
},
|
||||
strictNullHandling: false,
|
||||
skipNulls: false,
|
||||
encode: true
|
||||
};
|
||||
|
||||
internals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) {
|
||||
var obj = object;
|
||||
if (typeof filter === 'function') {
|
||||
obj = filter(prefix, obj);
|
||||
} else if (Utils.isBuffer(obj)) {
|
||||
obj = String(obj);
|
||||
} else if (obj instanceof Date) {
|
||||
obj = obj.toISOString();
|
||||
} else if (obj === null) {
|
||||
if (strictNullHandling) {
|
||||
return encode ? Utils.encode(prefix) : prefix;
|
||||
}
|
||||
|
||||
obj = '';
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {
|
||||
if (encode) {
|
||||
return [Utils.encode(prefix) + '=' + Utils.encode(obj)];
|
||||
}
|
||||
return [prefix + '=' + obj];
|
||||
}
|
||||
|
||||
var values = [];
|
||||
|
||||
if (typeof obj === 'undefined') {
|
||||
return values;
|
||||
}
|
||||
|
||||
var objKeys;
|
||||
if (Array.isArray(filter)) {
|
||||
objKeys = filter;
|
||||
} else {
|
||||
var keys = Object.keys(obj);
|
||||
objKeys = sort ? keys.sort(sort) : keys;
|
||||
}
|
||||
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
|
||||
if (skipNulls && obj[key] === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
} else {
|
||||
values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
};
|
||||
|
||||
module.exports = function (object, opts) {
|
||||
var obj = object;
|
||||
var options = opts || {};
|
||||
var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
|
||||
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
|
||||
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;
|
||||
var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;
|
||||
var sort = typeof options.sort === 'function' ? options.sort : null;
|
||||
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
|
||||
var objKeys;
|
||||
var filter;
|
||||
if (typeof options.filter === 'function') {
|
||||
filter = options.filter;
|
||||
obj = filter('', obj);
|
||||
} else if (Array.isArray(options.filter)) {
|
||||
objKeys = filter = options.filter;
|
||||
}
|
||||
|
||||
var keys = [];
|
||||
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var arrayFormat;
|
||||
if (options.arrayFormat in internals.arrayPrefixGenerators) {
|
||||
arrayFormat = options.arrayFormat;
|
||||
} else if ('indices' in options) {
|
||||
arrayFormat = options.indices ? 'indices' : 'repeat';
|
||||
} else {
|
||||
arrayFormat = 'indices';
|
||||
}
|
||||
|
||||
var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
|
||||
|
||||
if (!objKeys) {
|
||||
objKeys = Object.keys(obj);
|
||||
}
|
||||
|
||||
if (sort) {
|
||||
objKeys.sort(sort);
|
||||
}
|
||||
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
|
||||
if (skipNulls && obj[key] === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
|
||||
}
|
||||
|
||||
return keys.join(delimiter);
|
||||
};
|
||||
162
node_modules/body-parser/node_modules/qs/lib/utils.js
generated
vendored
Normal file
162
node_modules/body-parser/node_modules/qs/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
var hexTable = (function () {
|
||||
var array = new Array(256);
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
|
||||
}
|
||||
|
||||
return array;
|
||||
}());
|
||||
|
||||
exports.arrayToObject = function (source, options) {
|
||||
var obj = options.plainObjects ? Object.create(null) : {};
|
||||
for (var i = 0; i < source.length; ++i) {
|
||||
if (typeof source[i] !== 'undefined') {
|
||||
obj[i] = source[i];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.merge = function (target, source, options) {
|
||||
if (!source) {
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
if (Array.isArray(target)) {
|
||||
target.push(source);
|
||||
} else if (typeof target === 'object') {
|
||||
target[source] = true;
|
||||
} else {
|
||||
return [target, source];
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
if (typeof target !== 'object') {
|
||||
return [target].concat(source);
|
||||
}
|
||||
|
||||
var mergeTarget = target;
|
||||
if (Array.isArray(target) && !Array.isArray(source)) {
|
||||
mergeTarget = exports.arrayToObject(target, options);
|
||||
}
|
||||
|
||||
return Object.keys(source).reduce(function (acc, key) {
|
||||
var value = source[key];
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(acc, key)) {
|
||||
acc[key] = exports.merge(acc[key], value, options);
|
||||
} else {
|
||||
acc[key] = value;
|
||||
}
|
||||
return acc;
|
||||
}, mergeTarget);
|
||||
};
|
||||
|
||||
exports.decode = function (str) {
|
||||
try {
|
||||
return decodeURIComponent(str.replace(/\+/g, ' '));
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
exports.encode = function (str) {
|
||||
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
||||
// It has been adapted here for stricter adherence to RFC 3986
|
||||
if (str.length === 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var string = typeof str === 'string' ? str : String(str);
|
||||
|
||||
var out = '';
|
||||
for (var i = 0; i < string.length; ++i) {
|
||||
var c = string.charCodeAt(i);
|
||||
|
||||
if (
|
||||
c === 0x2D || // -
|
||||
c === 0x2E || // .
|
||||
c === 0x5F || // _
|
||||
c === 0x7E || // ~
|
||||
(c >= 0x30 && c <= 0x39) || // 0-9
|
||||
(c >= 0x41 && c <= 0x5A) || // a-z
|
||||
(c >= 0x61 && c <= 0x7A) // A-Z
|
||||
) {
|
||||
out += string.charAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x80) {
|
||||
out = out + hexTable[c];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0x800) {
|
||||
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c < 0xD800 || c >= 0xE000) {
|
||||
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
continue;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||
out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
exports.compact = function (obj, references) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var refs = references || [];
|
||||
var lookup = refs.indexOf(obj);
|
||||
if (lookup !== -1) {
|
||||
return refs[lookup];
|
||||
}
|
||||
|
||||
refs.push(obj);
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
var compacted = [];
|
||||
|
||||
for (var i = 0; i < obj.length; ++i) {
|
||||
if (typeof obj[i] !== 'undefined') {
|
||||
compacted.push(obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return compacted;
|
||||
}
|
||||
|
||||
var keys = Object.keys(obj);
|
||||
for (var j = 0; j < keys.length; ++j) {
|
||||
var key = keys[j];
|
||||
obj[key] = exports.compact(obj[key], refs);
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.isRegExp = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
||||
};
|
||||
|
||||
exports.isBuffer = function (obj) {
|
||||
if (obj === null || typeof obj === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
||||
};
|
||||
109
node_modules/body-parser/node_modules/qs/package.json
generated
vendored
Normal file
109
node_modules/body-parser/node_modules/qs/package.json
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"qs@6.1.0",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser"
|
||||
]
|
||||
],
|
||||
"_from": "qs@6.1.0",
|
||||
"_id": "qs@6.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser/qs",
|
||||
"_nodeVersion": "5.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-5-east.internal.npmjs.com",
|
||||
"tmp": "tmp/qs-6.1.0.tgz_1454565583082_0.44599376199766994"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "ljharb@gmail.com",
|
||||
"name": "ljharb"
|
||||
},
|
||||
"_npmVersion": "3.3.12",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "qs",
|
||||
"raw": "qs@6.1.0",
|
||||
"rawSpec": "6.1.0",
|
||||
"scope": null,
|
||||
"spec": "6.1.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/qs/-/qs-6.1.0.tgz",
|
||||
"_shasum": "ec1d1626b24278d99f0fdf4549e524e24eceeb26",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "qs@6.1.0",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/qs/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^1.6.1",
|
||||
"browserify": "^12.0.1",
|
||||
"covert": "^1.1.0",
|
||||
"eslint": "^1.10.3",
|
||||
"evalmd": "^0.0.16",
|
||||
"mkdirp": "^0.5.1",
|
||||
"parallelshell": "^2.0.0",
|
||||
"tape": "^4.3.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ec1d1626b24278d99f0fdf4549e524e24eceeb26",
|
||||
"tarball": "http://registry.npmjs.org/qs/-/qs-6.1.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"gitHead": "5bd79545edb33d6a43398fec7df9ecef2da005ea",
|
||||
"homepage": "https://github.com/ljharb/qs",
|
||||
"keywords": [
|
||||
"qs",
|
||||
"querystring"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "hueniverse",
|
||||
"email": "eran@hammer.io"
|
||||
},
|
||||
{
|
||||
"name": "ljharb",
|
||||
"email": "ljharb@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "nlf",
|
||||
"email": "quitlahok@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "qs",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/qs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "covert test",
|
||||
"dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js",
|
||||
"lint": "eslint lib/*.js text/*.js",
|
||||
"prepublish": "npm run dist",
|
||||
"readme": "evalmd README.md",
|
||||
"test": "parallelshell 'npm run readme' 'npm run lint' 'npm run coverage'",
|
||||
"tests-only": "node test"
|
||||
},
|
||||
"version": "6.1.0"
|
||||
}
|
||||
5
node_modules/body-parser/node_modules/qs/test/index.js
generated
vendored
Normal file
5
node_modules/body-parser/node_modules/qs/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
require('./parse');
|
||||
|
||||
require('./stringify');
|
||||
|
||||
require('./utils');
|
||||
393
node_modules/body-parser/node_modules/qs/test/parse.js
generated
vendored
Normal file
393
node_modules/body-parser/node_modules/qs/test/parse.js
generated
vendored
Normal file
@@ -0,0 +1,393 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var qs = require('../');
|
||||
|
||||
test('parse()', function (t) {
|
||||
t.test('parses a simple string', function (st) {
|
||||
st.deepEqual(qs.parse('0=foo'), { '0': 'foo' });
|
||||
st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' });
|
||||
st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } });
|
||||
st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } });
|
||||
st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } });
|
||||
st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null });
|
||||
st.deepEqual(qs.parse('foo'), { foo: '' });
|
||||
st.deepEqual(qs.parse('foo='), { foo: '' });
|
||||
st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' });
|
||||
st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' });
|
||||
st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' });
|
||||
st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' });
|
||||
st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' });
|
||||
st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null });
|
||||
st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' });
|
||||
st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), {
|
||||
cht: 'p3',
|
||||
chd: 't:60,40',
|
||||
chs: '250x100',
|
||||
chl: 'Hello|World'
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows enabling dot notation', function (st) {
|
||||
st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' });
|
||||
st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string');
|
||||
t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string');
|
||||
t.deepEqual(
|
||||
qs.parse('a[b][c][d][e][f][g][h]=i'),
|
||||
{ a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } },
|
||||
'defaults to a depth of 5'
|
||||
);
|
||||
|
||||
t.test('only parses one level when depth = 1', function (st) {
|
||||
st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } });
|
||||
st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array');
|
||||
|
||||
t.test('parses an explicit array', function (st) {
|
||||
st.deepEqual(qs.parse('a[]=b'), { a: ['b'] });
|
||||
st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses a mix of simple and explicit arrays', function (st) {
|
||||
st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a[1]=b&a=c'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a=b&a[1]=c'), { a: ['b', 'c'] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses a nested array', function (st) {
|
||||
st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } });
|
||||
st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows to specify array indices', function (st) {
|
||||
st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] });
|
||||
st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] });
|
||||
st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('limits specific array indices to 20', function (st) {
|
||||
st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] });
|
||||
st.deepEqual(qs.parse('a[21]=a'), { a: { '21': 'a' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number');
|
||||
|
||||
t.test('supports encoded = signs', function (st) {
|
||||
st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('is ok with url encoded strings', function (st) {
|
||||
st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } });
|
||||
st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows brackets in the value', function (st) {
|
||||
st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' });
|
||||
st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows empty values', function (st) {
|
||||
st.deepEqual(qs.parse(''), {});
|
||||
st.deepEqual(qs.parse(null), {});
|
||||
st.deepEqual(qs.parse(undefined), {});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('transforms arrays to objects', function (st) {
|
||||
st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } });
|
||||
st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', '0': 'bar' } });
|
||||
st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', '0': 'bar' } });
|
||||
st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } });
|
||||
st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } });
|
||||
st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] });
|
||||
st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c'), { a: { '0': 'b', t: 'u', c: true } });
|
||||
st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y'), { a: { '0': 'b', '1': 'c', x: 'y' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('transforms arrays to objects (dot notation)', function (st) {
|
||||
st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } });
|
||||
st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } });
|
||||
st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } });
|
||||
st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] });
|
||||
st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] });
|
||||
st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } });
|
||||
st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } });
|
||||
st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { '0': 'bar', bad: 'baz' } });
|
||||
st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } });
|
||||
st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.deepEqual(qs.parse('a[b]=c&a=d'), { a: { b: 'c', d: true } }, 'can add keys to objects');
|
||||
|
||||
t.test('correctly prunes undefined values when converting an array to an object', function (st) {
|
||||
st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { '2': 'b', '99999999': 'c' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('supports malformed uri characters', function (st) {
|
||||
st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null });
|
||||
st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' });
|
||||
st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('doesn\'t produce empty keys', function (st) {
|
||||
st.deepEqual(qs.parse('_r=1&'), { '_r': '1' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('cannot access Object prototype', function (st) {
|
||||
qs.parse('constructor[prototype][bad]=bad');
|
||||
qs.parse('bad[constructor][prototype][bad]=bad');
|
||||
st.equal(typeof Object.prototype.bad, 'undefined');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses arrays of objects', function (st) {
|
||||
st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] });
|
||||
st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows for empty strings in arrays', function (st) {
|
||||
st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] });
|
||||
st.deepEqual(qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true }), { a: ['b', null, 'c', ''] });
|
||||
st.deepEqual(qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true }), { a: ['b', '', 'c', null] });
|
||||
st.deepEqual(qs.parse('a[]=&a[]=b&a[]=c'), { a: ['', 'b', 'c'] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('compacts sparse arrays', function (st) {
|
||||
st.deepEqual(qs.parse('a[10]=1&a[2]=2'), { a: ['2', '1'] });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses semi-parsed strings', function (st) {
|
||||
st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } });
|
||||
st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses buffers correctly', function (st) {
|
||||
var b = new Buffer('test');
|
||||
st.deepEqual(qs.parse({ a: b }), { a: b });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('continues parsing when no parent is found', function (st) {
|
||||
st.deepEqual(qs.parse('[]=&a=b'), { '0': '', a: 'b' });
|
||||
st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { '0': null, a: 'b' });
|
||||
st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not error when parsing a very long array', function (st) {
|
||||
var str = 'a[]=a';
|
||||
while (Buffer.byteLength(str) < 128 * 1024) {
|
||||
str = str + '&' + str;
|
||||
}
|
||||
|
||||
st.doesNotThrow(function () { qs.parse(str); });
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('should not throw when a native prototype has an enumerable property', { parallel: false }, function (st) {
|
||||
Object.prototype.crash = '';
|
||||
Array.prototype.crash = '';
|
||||
st.doesNotThrow(qs.parse.bind(null, 'a=b'));
|
||||
st.deepEqual(qs.parse('a=b'), { a: 'b' });
|
||||
st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c'));
|
||||
st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] });
|
||||
delete Object.prototype.crash;
|
||||
delete Array.prototype.crash;
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses a string with an alternative string delimiter', function (st) {
|
||||
st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses a string with an alternative RegExp delimiter', function (st) {
|
||||
st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not use non-splittable objects as delimiters', function (st) {
|
||||
st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows overriding parameter limit', function (st) {
|
||||
st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows setting the parameter limit to Infinity', function (st) {
|
||||
st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows overriding array limit', function (st) {
|
||||
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { '0': 'b' } });
|
||||
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } });
|
||||
st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { '0': 'b', '1': 'c' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('allows disabling array parsing', function (st) {
|
||||
st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { '0': 'b', '1': 'c' } });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses an object', function (st) {
|
||||
var input = {
|
||||
'user[name]': { 'pop[bob]': 3 },
|
||||
'user[email]': null
|
||||
};
|
||||
|
||||
var expected = {
|
||||
user: {
|
||||
name: { 'pop[bob]': 3 },
|
||||
email: null
|
||||
}
|
||||
};
|
||||
|
||||
var result = qs.parse(input);
|
||||
|
||||
st.deepEqual(result, expected);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses an object in dot notation', function (st) {
|
||||
var input = {
|
||||
'user.name': { 'pop[bob]': 3 },
|
||||
'user.email.': null
|
||||
};
|
||||
|
||||
var expected = {
|
||||
user: {
|
||||
name: { 'pop[bob]': 3 },
|
||||
email: null
|
||||
}
|
||||
};
|
||||
|
||||
var result = qs.parse(input, { allowDots: true });
|
||||
|
||||
st.deepEqual(result, expected);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses an object and not child values', function (st) {
|
||||
var input = {
|
||||
'user[name]': { 'pop[bob]': { 'test': 3 } },
|
||||
'user[email]': null
|
||||
};
|
||||
|
||||
var expected = {
|
||||
user: {
|
||||
name: { 'pop[bob]': { 'test': 3 } },
|
||||
email: null
|
||||
}
|
||||
};
|
||||
|
||||
var result = qs.parse(input);
|
||||
|
||||
st.deepEqual(result, expected);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not blow up when Buffer global is missing', function (st) {
|
||||
var tempBuffer = global.Buffer;
|
||||
delete global.Buffer;
|
||||
var result = qs.parse('a=b&c=d');
|
||||
global.Buffer = tempBuffer;
|
||||
st.deepEqual(result, { a: 'b', c: 'd' });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not crash when parsing circular references', function (st) {
|
||||
var a = {};
|
||||
a.b = a;
|
||||
|
||||
var parsed;
|
||||
|
||||
st.doesNotThrow(function () {
|
||||
parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a });
|
||||
});
|
||||
|
||||
st.equal('foo' in parsed, true, 'parsed has "foo" property');
|
||||
st.equal('bar' in parsed.foo, true);
|
||||
st.equal('baz' in parsed.foo, true);
|
||||
st.equal(parsed.foo.bar, 'baz');
|
||||
st.deepEqual(parsed.foo.baz, a);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses plain objects correctly', function (st) {
|
||||
var a = Object.create(null);
|
||||
a.b = 'c';
|
||||
|
||||
st.deepEqual(qs.parse(a), { b: 'c' });
|
||||
var result = qs.parse({ a: a });
|
||||
st.equal('a' in result, true, 'result has "a" property');
|
||||
st.deepEqual(result.a, a);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses dates correctly', function (st) {
|
||||
var now = new Date();
|
||||
st.deepEqual(qs.parse({ a: now }), { a: now });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('parses regular expressions correctly', function (st) {
|
||||
var re = /^test$/;
|
||||
st.deepEqual(qs.parse({ a: re }), { a: re });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('can allow overwriting prototype properties', function (st) {
|
||||
st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }, { prototype: false });
|
||||
st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }, { prototype: false });
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('can return plain objects', function (st) {
|
||||
var expected = Object.create(null);
|
||||
expected.a = Object.create(null);
|
||||
expected.a.b = 'c';
|
||||
expected.a.hasOwnProperty = 'd';
|
||||
st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected);
|
||||
st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null));
|
||||
var expectedArray = Object.create(null);
|
||||
expectedArray.a = Object.create(null);
|
||||
expectedArray.a['0'] = 'b';
|
||||
expectedArray.a.c = 'd';
|
||||
st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray);
|
||||
st.end();
|
||||
});
|
||||
});
|
||||
259
node_modules/body-parser/node_modules/qs/test/stringify.js
generated
vendored
Normal file
259
node_modules/body-parser/node_modules/qs/test/stringify.js
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var qs = require('../');
|
||||
|
||||
test('stringify()', function (t) {
|
||||
t.test('stringifies a querystring object', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b' }), 'a=b');
|
||||
st.equal(qs.stringify({ a: 1 }), 'a=1');
|
||||
st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2');
|
||||
st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z');
|
||||
st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC');
|
||||
st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80');
|
||||
st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90');
|
||||
st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a nested object', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c');
|
||||
st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a nested object with dots notation', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c');
|
||||
st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an array value', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c', 'd'] }), 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('omits nulls when asked', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b', c: null }, { skipNulls: true }), 'a=b');
|
||||
st.end();
|
||||
});
|
||||
|
||||
|
||||
t.test('omits nested nulls when asked', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('omits array indices when asked', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a nested array value', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a nested array value with dots notation', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { allowDots: true, encode: false }), 'a.b[0]=c&a.b[1]=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an object inside an array', function (st) {
|
||||
st.equal(qs.stringify({ a: [{ b: 'c' }] }), 'a%5B0%5D%5Bb%5D=c');
|
||||
st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }), 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an object inside an array with dots notation', function (st) {
|
||||
st.equal(qs.stringify({ a: [{ b: 'c' }] }, { allowDots: true, encode: false }), 'a[0].b=c');
|
||||
st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }, { allowDots: true, encode: false }), 'a[0].b.c[0]=1');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not omit object keys when indices = false', function (st) {
|
||||
st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('uses indices notation for arrays when indices=true', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('uses indices notation for arrays when no arrayFormat=indices', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('uses repeat notation for arrays when no arrayFormat=repeat', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('uses brackets notation for arrays when no arrayFormat=brackets', function (st) {
|
||||
st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a complicated object', function (st) {
|
||||
st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an empty value', function (st) {
|
||||
st.equal(qs.stringify({ a: '' }), 'a=');
|
||||
st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a');
|
||||
|
||||
st.equal(qs.stringify({ a: '', b: '' }), 'a=&b=');
|
||||
st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b=');
|
||||
|
||||
st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D=');
|
||||
st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D');
|
||||
st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D=');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an empty object', function (st) {
|
||||
var obj = Object.create(null);
|
||||
obj.a = 'b';
|
||||
st.equal(qs.stringify(obj), 'a=b');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns an empty string for invalid input', function (st) {
|
||||
st.equal(qs.stringify(undefined), '');
|
||||
st.equal(qs.stringify(false), '');
|
||||
st.equal(qs.stringify(null), '');
|
||||
st.equal(qs.stringify(''), '');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an object with an empty object as a child', function (st) {
|
||||
var obj = {
|
||||
a: Object.create(null)
|
||||
};
|
||||
|
||||
obj.a.b = 'c';
|
||||
st.equal(qs.stringify(obj), 'a%5Bb%5D=c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('drops keys with a value of undefined', function (st) {
|
||||
st.equal(qs.stringify({ a: undefined }), '');
|
||||
|
||||
st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D');
|
||||
st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D=');
|
||||
st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D=');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('url encodes values', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies a date', function (st) {
|
||||
var now = new Date();
|
||||
var str = 'a=' + encodeURIComponent(now.toISOString());
|
||||
st.equal(qs.stringify({ a: now }), str);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies the weird object from qs', function (st) {
|
||||
st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('skips properties that are part of the object prototype', function (st) {
|
||||
Object.prototype.crash = 'test';
|
||||
st.equal(qs.stringify({ a: 'b' }), 'a=b');
|
||||
st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c');
|
||||
delete Object.prototype.crash;
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies boolean values', function (st) {
|
||||
st.equal(qs.stringify({ a: true }), 'a=true');
|
||||
st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true');
|
||||
st.equal(qs.stringify({ b: false }), 'b=false');
|
||||
st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies buffer values', function (st) {
|
||||
st.equal(qs.stringify({ a: new Buffer('test') }), 'a=test');
|
||||
st.equal(qs.stringify({ a: { b: new Buffer('test') } }), 'a%5Bb%5D=test');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('stringifies an object using an alternative delimiter', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('doesn\'t blow up when Buffer global is missing', function (st) {
|
||||
var tempBuffer = global.Buffer;
|
||||
delete global.Buffer;
|
||||
var result = qs.stringify({ a: 'b', c: 'd' });
|
||||
global.Buffer = tempBuffer;
|
||||
st.equal(result, 'a=b&c=d');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('selects properties when filter=array', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b');
|
||||
st.equal(qs.stringify({ a: 1 }, { filter: [] }), '');
|
||||
st.equal(qs.stringify({ a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, { filter: ['a', 'b', 0, 2] }), 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('supports custom representations when filter=function', function (st) {
|
||||
var calls = 0;
|
||||
var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } };
|
||||
var filterFunc = function (prefix, value) {
|
||||
calls++;
|
||||
if (calls === 1) {
|
||||
st.equal(prefix, '', 'prefix is empty');
|
||||
st.equal(value, obj);
|
||||
} else if (prefix === 'c') {
|
||||
return;
|
||||
} else if (value instanceof Date) {
|
||||
st.equal(prefix, 'e[f]');
|
||||
return value.getTime();
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000');
|
||||
st.equal(calls, 5);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('can disable uri encoding', function (st) {
|
||||
st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b');
|
||||
st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c');
|
||||
st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('can sort the keys', function (st) {
|
||||
var sort = function (a, b) { return a.localeCompare(b); };
|
||||
st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y');
|
||||
st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('can sort the keys at depth 3 or more too', function (st) {
|
||||
var sort = function (a, b) { return a.localeCompare(b); };
|
||||
st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: sort, encode: false }), 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb');
|
||||
st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: null, encode: false }), 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b');
|
||||
st.end();
|
||||
});
|
||||
});
|
||||
9
node_modules/body-parser/node_modules/qs/test/utils.js
generated
vendored
Normal file
9
node_modules/body-parser/node_modules/qs/test/utils.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var utils = require('../lib/utils');
|
||||
|
||||
test('merge()', function (t) {
|
||||
t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key');
|
||||
t.end();
|
||||
});
|
||||
200
node_modules/body-parser/node_modules/type-is/HISTORY.md
generated
vendored
Normal file
200
node_modules/body-parser/node_modules/type-is/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
1.6.12 / 2016-02-28
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.10
|
||||
- Add new mime types
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
|
||||
1.6.11 / 2016-01-29
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.9
|
||||
- Add new mime types
|
||||
|
||||
1.6.10 / 2015-12-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.8
|
||||
- Add new mime types
|
||||
|
||||
1.6.9 / 2015-09-27
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.7
|
||||
- Add new mime types
|
||||
|
||||
1.6.8 / 2015-09-04
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- Add new mime types
|
||||
|
||||
1.6.7 / 2015-08-20
|
||||
==================
|
||||
|
||||
* Fix type error when given invalid type to match against
|
||||
* deps: mime-types@~2.1.5
|
||||
- Add new mime types
|
||||
|
||||
1.6.6 / 2015-07-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- Add new mime types
|
||||
|
||||
1.6.5 / 2015-07-16
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- Add new mime types
|
||||
|
||||
1.6.4 / 2015-07-01
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- Add new mime types
|
||||
* perf: enable strict mode
|
||||
* perf: remove argument reassignment
|
||||
|
||||
1.6.3 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- Add new mime types
|
||||
* perf: reduce try block size
|
||||
* perf: remove bitwise operations
|
||||
|
||||
1.6.2 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- Add new mime types
|
||||
|
||||
1.6.1 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- Add new mime types
|
||||
|
||||
1.6.0 / 2015-02-12
|
||||
==================
|
||||
|
||||
* fix false-positives in `hasBody` `Transfer-Encoding` check
|
||||
* support wildcard for both type and subtype (`*/*`)
|
||||
|
||||
1.5.7 / 2015-02-09
|
||||
==================
|
||||
|
||||
* fix argument reassignment
|
||||
* deps: mime-types@~2.0.9
|
||||
- Add new mime types
|
||||
|
||||
1.5.6 / 2015-01-29
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- Add new mime types
|
||||
|
||||
1.5.5 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- Add new mime types
|
||||
- Fix missing extensions
|
||||
- Fix various invalid MIME type entries
|
||||
- Remove example template MIME types
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.5.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- Add new mime types
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.5.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- Add new mime types
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.5.2 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- Add new mime types
|
||||
- deps: mime-db@~1.1.0
|
||||
|
||||
1.5.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: media-typer@0.3.0
|
||||
* deps: mime-types@~2.0.1
|
||||
- Support Node.js 0.6
|
||||
|
||||
1.5.0 / 2014-09-05
|
||||
==================
|
||||
|
||||
* fix `hasbody` to be true for `content-length: 0`
|
||||
|
||||
1.4.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update mime-types
|
||||
|
||||
1.3.2 / 2014-06-24
|
||||
==================
|
||||
|
||||
* use `~` range on mime-types
|
||||
|
||||
1.3.1 / 2014-06-19
|
||||
==================
|
||||
|
||||
* fix global variable leak
|
||||
|
||||
1.3.0 / 2014-06-19
|
||||
==================
|
||||
|
||||
* improve type parsing
|
||||
|
||||
- invalid media type never matches
|
||||
- media type not case-sensitive
|
||||
- extra LWS does not affect results
|
||||
|
||||
1.2.2 / 2014-06-19
|
||||
==================
|
||||
|
||||
* fix behavior on unknown type argument
|
||||
|
||||
1.2.1 / 2014-06-03
|
||||
==================
|
||||
|
||||
* switch dependency from `mime` to `mime-types@1.0.0`
|
||||
|
||||
1.2.0 / 2014-05-11
|
||||
==================
|
||||
|
||||
* support suffix matching:
|
||||
|
||||
- `+json` matches `application/vnd+json`
|
||||
- `*/vnd+json` matches `application/vnd+json`
|
||||
- `application/*+json` matches `application/vnd+json`
|
||||
|
||||
1.1.0 / 2014-04-12
|
||||
==================
|
||||
|
||||
* add non-array values support
|
||||
* expose internal utilities:
|
||||
|
||||
- `.is()`
|
||||
- `.hasBody()`
|
||||
- `.normalize()`
|
||||
- `.match()`
|
||||
|
||||
1.0.1 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `multipart` as a shorthand
|
||||
23
node_modules/body-parser/node_modules/type-is/LICENSE
generated
vendored
Normal file
23
node_modules/body-parser/node_modules/type-is/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.
|
||||
136
node_modules/body-parser/node_modules/type-is/README.md
generated
vendored
Normal file
136
node_modules/body-parser/node_modules/type-is/README.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# type-is
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Infer the content-type of a request.
|
||||
|
||||
### Install
|
||||
|
||||
```sh
|
||||
$ npm install type-is
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var is = require('type-is')
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
var istext = is(req, ['text/*'])
|
||||
res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text')
|
||||
})
|
||||
```
|
||||
|
||||
### type = is(request, types)
|
||||
|
||||
`request` is the node HTTP request. `types` is an array of types.
|
||||
|
||||
```js
|
||||
// req.headers.content-type = 'application/json'
|
||||
|
||||
is(req, ['json']) // 'json'
|
||||
is(req, ['html', 'json']) // 'json'
|
||||
is(req, ['application/*']) // 'application/json'
|
||||
is(req, ['application/json']) // 'application/json'
|
||||
|
||||
is(req, ['html']) // false
|
||||
```
|
||||
|
||||
### is.hasBody(request)
|
||||
|
||||
Returns a Boolean if the given `request` has a body, regardless of the
|
||||
`Content-Type` header.
|
||||
|
||||
Having a body has no relation to how large the body is (it may be 0 bytes).
|
||||
This is similar to how file existence works. If a body does exist, then this
|
||||
indicates that there is data to read from the Node.js request stream.
|
||||
|
||||
```js
|
||||
if (is.hasBody(req)) {
|
||||
// read the body, since there is one
|
||||
|
||||
req.on('data', function (chunk) {
|
||||
// ...
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
### type = is.is(mediaType, types)
|
||||
|
||||
`mediaType` is the [media type](https://tools.ietf.org/html/rfc6838) string. `types` is an array of types.
|
||||
|
||||
```js
|
||||
var mediaType = 'application/json'
|
||||
|
||||
is.is(mediaType, ['json']) // 'json'
|
||||
is.is(mediaType, ['html', 'json']) // 'json'
|
||||
is.is(mediaType, ['application/*']) // 'application/json'
|
||||
is.is(mediaType, ['application/json']) // 'application/json'
|
||||
|
||||
is.is(mediaType, ['html']) // false
|
||||
```
|
||||
|
||||
### Each type can be:
|
||||
|
||||
- An extension name such as `json`. This name will be returned if matched.
|
||||
- A mime type such as `application/json`.
|
||||
- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`. The full mime type will be returned if matched.
|
||||
- A suffix such as `+json`. This can be combined with a wildcard such as `*/vnd+json` or `application/*+json`. The full mime type will be returned if matched.
|
||||
|
||||
`false` will be returned if no type matches or the content type is invalid.
|
||||
|
||||
`null` will be returned if the request does not have a body.
|
||||
|
||||
## Examples
|
||||
|
||||
#### Example body parser
|
||||
|
||||
```js
|
||||
var is = require('type-is');
|
||||
|
||||
function bodyParser(req, res, next) {
|
||||
if (!is.hasBody(req)) {
|
||||
return next()
|
||||
}
|
||||
|
||||
switch (is(req, ['urlencoded', 'json', 'multipart'])) {
|
||||
case 'urlencoded':
|
||||
// parse urlencoded body
|
||||
throw new Error('implement urlencoded body parsing')
|
||||
break
|
||||
case 'json':
|
||||
// parse json body
|
||||
throw new Error('implement json body parsing')
|
||||
break
|
||||
case 'multipart':
|
||||
// parse multipart body
|
||||
throw new Error('implement multipart body parsing')
|
||||
break
|
||||
default:
|
||||
// 415 error code
|
||||
res.statusCode = 415
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/type-is.svg
|
||||
[npm-url]: https://npmjs.org/package/type-is
|
||||
[node-version-image]: https://img.shields.io/node/v/type-is.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/type-is/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/type-is
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/type-is/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/type-is.svg
|
||||
[downloads-url]: https://npmjs.org/package/type-is
|
||||
262
node_modules/body-parser/node_modules/type-is/index.js
generated
vendored
Normal file
262
node_modules/body-parser/node_modules/type-is/index.js
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
/*!
|
||||
* type-is
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var typer = require('media-typer')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = typeofrequest
|
||||
module.exports.is = typeis
|
||||
module.exports.hasBody = hasbody
|
||||
module.exports.normalize = normalize
|
||||
module.exports.match = mimeMatch
|
||||
|
||||
/**
|
||||
* Compare a `value` content-type with `types`.
|
||||
* Each `type` can be an extension like `html`,
|
||||
* a special shortcut like `multipart` or `urlencoded`,
|
||||
* or a mime type.
|
||||
*
|
||||
* If no types match, `false` is returned.
|
||||
* Otherwise, the first `type` that matches is returned.
|
||||
*
|
||||
* @param {String} value
|
||||
* @param {Array} types
|
||||
* @public
|
||||
*/
|
||||
|
||||
function typeis(value, types_) {
|
||||
var i
|
||||
var types = types_
|
||||
|
||||
// remove parameters and normalize
|
||||
var val = tryNormalizeType(value)
|
||||
|
||||
// no type or invalid
|
||||
if (!val) {
|
||||
return false
|
||||
}
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length - 1)
|
||||
for (i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i + 1]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return the content type
|
||||
if (!types || !types.length) {
|
||||
return val
|
||||
}
|
||||
|
||||
var type
|
||||
for (i = 0; i < types.length; i++) {
|
||||
if (mimeMatch(normalize(type = types[i]), val)) {
|
||||
return type[0] === '+' || type.indexOf('*') !== -1
|
||||
? val
|
||||
: type
|
||||
}
|
||||
}
|
||||
|
||||
// no matches
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a request has a request body.
|
||||
* A request with a body __must__ either have `transfer-encoding`
|
||||
* or `content-length` headers set.
|
||||
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
|
||||
*
|
||||
* @param {Object} request
|
||||
* @return {Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function hasbody(req) {
|
||||
return req.headers['transfer-encoding'] !== undefined
|
||||
|| !isNaN(req.headers['content-length'])
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the incoming request contains the "Content-Type"
|
||||
* header field, and it contains any of the give mime `type`s.
|
||||
* If there is no request body, `null` is returned.
|
||||
* If there is no content type, `false` is returned.
|
||||
* Otherwise, it returns the first `type` that matches.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // With Content-Type: text/html; charset=utf-8
|
||||
* this.is('html'); // => 'html'
|
||||
* this.is('text/html'); // => 'text/html'
|
||||
* this.is('text/*', 'application/json'); // => 'text/html'
|
||||
*
|
||||
* // When Content-Type is application/json
|
||||
* this.is('json', 'urlencoded'); // => 'json'
|
||||
* this.is('application/json'); // => 'application/json'
|
||||
* this.is('html', 'application/*'); // => 'application/json'
|
||||
*
|
||||
* this.is('html'); // => false
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|false|null}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function typeofrequest(req, types_) {
|
||||
var types = types_
|
||||
|
||||
// no body
|
||||
if (!hasbody(req)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// support flattened arguments
|
||||
if (arguments.length > 2) {
|
||||
types = new Array(arguments.length - 1)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i + 1]
|
||||
}
|
||||
}
|
||||
|
||||
// request content type
|
||||
var value = req.headers['content-type']
|
||||
|
||||
return typeis(value, types)
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a mime type.
|
||||
* If it's a shorthand, expand it to a valid mime type.
|
||||
*
|
||||
* In general, you probably want:
|
||||
*
|
||||
* var type = is(req, ['urlencoded', 'json', 'multipart']);
|
||||
*
|
||||
* Then use the appropriate body parsers.
|
||||
* These three are the most common request body types
|
||||
* and are thus ensured to work.
|
||||
*
|
||||
* @param {String} type
|
||||
* @private
|
||||
*/
|
||||
|
||||
function normalize(type) {
|
||||
if (typeof type !== 'string') {
|
||||
// invalid type
|
||||
return false
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'urlencoded':
|
||||
return 'application/x-www-form-urlencoded'
|
||||
case 'multipart':
|
||||
return 'multipart/*'
|
||||
}
|
||||
|
||||
if (type[0] === '+') {
|
||||
// "+json" -> "*/*+json" expando
|
||||
return '*/*' + type
|
||||
}
|
||||
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `expected` mime type
|
||||
* matches `actual` mime type with
|
||||
* wildcard and +suffix support.
|
||||
*
|
||||
* @param {String} expected
|
||||
* @param {String} actual
|
||||
* @return {Boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function mimeMatch(expected, actual) {
|
||||
// invalid type
|
||||
if (expected === false) {
|
||||
return false
|
||||
}
|
||||
|
||||
// split types
|
||||
var actualParts = actual.split('/')
|
||||
var expectedParts = expected.split('/')
|
||||
|
||||
// invalid format
|
||||
if (actualParts.length !== 2 || expectedParts.length !== 2) {
|
||||
return false
|
||||
}
|
||||
|
||||
// validate type
|
||||
if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) {
|
||||
return false
|
||||
}
|
||||
|
||||
// validate suffix wildcard
|
||||
if (expectedParts[1].substr(0, 2) === '*+') {
|
||||
return expectedParts[1].length <= actualParts[1].length + 1
|
||||
&& expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length)
|
||||
}
|
||||
|
||||
// validate subtype
|
||||
if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a type and remove parameters.
|
||||
*
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function normalizeType(value) {
|
||||
// parse the type
|
||||
var type = typer.parse(value)
|
||||
|
||||
// remove the parameters
|
||||
type.parameters = undefined
|
||||
|
||||
// reformat it
|
||||
return typer.format(type)
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to normalize a type and remove parameters.
|
||||
*
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function tryNormalizeType(value) {
|
||||
try {
|
||||
return normalizeType(value)
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
106
node_modules/body-parser/node_modules/type-is/package.json
generated
vendored
Normal file
106
node_modules/body-parser/node_modules/type-is/package.json
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"type-is@~1.6.11",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser"
|
||||
]
|
||||
],
|
||||
"_from": "type-is@>=1.6.11 <1.7.0",
|
||||
"_id": "type-is@1.6.12",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser/type-is",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/type-is-1.6.12.tgz_1456726142464_0.8247741810046136"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "type-is",
|
||||
"raw": "type-is@~1.6.11",
|
||||
"rawSpec": "~1.6.11",
|
||||
"scope": null,
|
||||
"spec": ">=1.6.11 <1.7.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.12.tgz",
|
||||
"_shasum": "0352a9dfbfff040fe668cc153cc95829c354173e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "type-is@~1.6.11",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/type-is/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.10"
|
||||
},
|
||||
"description": "Infer the content-type of a request.",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0352a9dfbfff040fe668cc153cc95829c354173e",
|
||||
"tarball": "http://registry.npmjs.org/type-is/-/type-is-1.6.12.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7ba49c0ccc8e34f4321768c0b13c2ebcccaae28c",
|
||||
"homepage": "https://github.com/jshttp/type-is",
|
||||
"keywords": [
|
||||
"checking",
|
||||
"content",
|
||||
"type"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "type-is",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/type-is.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "1.6.12"
|
||||
}
|
||||
112
node_modules/body-parser/package.json
generated
vendored
Normal file
112
node_modules/body-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"body-parser",
|
||||
"L:\\Git\\repos\\html5-restaurant"
|
||||
]
|
||||
],
|
||||
"_from": "body-parser@latest",
|
||||
"_id": "body-parser@1.15.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/body-parser",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/body-parser-1.15.0.tgz_1455156407766_0.14806043729186058"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {
|
||||
"inherits": "2.0.1",
|
||||
"media-typer": "0.3.0",
|
||||
"statuses": "1.2.1"
|
||||
},
|
||||
"_requested": {
|
||||
"name": "body-parser",
|
||||
"raw": "body-parser",
|
||||
"rawSpec": "",
|
||||
"scope": null,
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.15.0.tgz",
|
||||
"_shasum": "8168abaeaf9e77e300f7b3aef4df4b46e9b21b35",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "body-parser",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/body-parser/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"bytes": "2.2.0",
|
||||
"content-type": "~1.0.1",
|
||||
"debug": "~2.2.0",
|
||||
"depd": "~1.1.0",
|
||||
"http-errors": "~1.4.0",
|
||||
"iconv-lite": "0.4.13",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.1.0",
|
||||
"raw-body": "~2.1.5",
|
||||
"type-is": "~1.6.11"
|
||||
},
|
||||
"description": "Node.js body parsing middleware",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.4.2",
|
||||
"methods": "1.1.2",
|
||||
"mocha": "2.4.5",
|
||||
"supertest": "1.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8168abaeaf9e77e300f7b3aef4df4b46e9b21b35",
|
||||
"tarball": "http://registry.npmjs.org/body-parser/-/body-parser-1.15.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"lib/"
|
||||
],
|
||||
"gitHead": "5b4fabe344e5b3df9e9157c7e9b9e6f5706b1cec",
|
||||
"homepage": "https://github.com/expressjs/body-parser",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "body-parser",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/body-parser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "1.15.0"
|
||||
}
|
||||
57
node_modules/bytes/History.md
generated
vendored
Normal file
57
node_modules/bytes/History.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
2.2.0 / 2015-11-13
|
||||
==================
|
||||
|
||||
* add option "decimalPlaces"
|
||||
* add option "fixedDecimals"
|
||||
|
||||
2.1.0 / 2015-05-21
|
||||
==================
|
||||
|
||||
* add `.format` export
|
||||
* add `.parse` export
|
||||
|
||||
2.0.2 / 2015-05-20
|
||||
==================
|
||||
|
||||
* remove map recreation
|
||||
* remove unnecessary object construction
|
||||
|
||||
2.0.1 / 2015-05-07
|
||||
==================
|
||||
|
||||
* fix browserify require
|
||||
* remove node.extend dependency
|
||||
|
||||
2.0.0 / 2015-04-12
|
||||
==================
|
||||
|
||||
* add option "case"
|
||||
* add option "thousandsSeparator"
|
||||
* return "null" on invalid parse input
|
||||
* support proper round-trip: bytes(bytes(num)) === num
|
||||
* units no longer case sensitive when parsing
|
||||
|
||||
1.0.0 / 2014-05-05
|
||||
==================
|
||||
|
||||
* add negative support. fixes #6
|
||||
|
||||
0.3.0 / 2014-03-19
|
||||
==================
|
||||
|
||||
* added terabyte support
|
||||
|
||||
0.2.1 / 2013-04-01
|
||||
==================
|
||||
|
||||
* add .component
|
||||
|
||||
0.2.0 / 2012-10-28
|
||||
==================
|
||||
|
||||
* bytes(200).should.eql('200b')
|
||||
|
||||
0.1.0 / 2012-07-04
|
||||
==================
|
||||
|
||||
* add bytes to string conversion [yields]
|
||||
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015 Jed Watson <jed.watson@me.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.
|
||||
99
node_modules/bytes/Readme.md
generated
vendored
Normal file
99
node_modules/bytes/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# Bytes utility
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
|
||||
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var bytes = require('bytes');
|
||||
```
|
||||
|
||||
#### bytes.format(number value, [options]): string|null
|
||||
|
||||
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
|
||||
rounded.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|--------|--------------------|
|
||||
| value | `number` | Value in bytes |
|
||||
| options | `Object` | Conversion options |
|
||||
|
||||
**Options**
|
||||
|
||||
| Property | Type | Description |
|
||||
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
||||
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
||||
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
||||
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `' '`. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|-------------|-------------------------|
|
||||
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes(1024);
|
||||
// output: '1kB'
|
||||
|
||||
bytes(1000);
|
||||
// output: '1000B'
|
||||
|
||||
bytes(1000, {thousandsSeparator: ' '});
|
||||
// output: '1 000B'
|
||||
|
||||
bytes(1024 * 1.7, {decimalPlaces: 0});
|
||||
// output: '2kB'
|
||||
```
|
||||
|
||||
#### bytes.parse(string value): number|null
|
||||
|
||||
Parse the string value into an integer in bytes. If no unit is given, it is assumed the value is in bytes.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|--------|--------------------|
|
||||
| value | `string` | String to parse. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|-------------|-------------------------|
|
||||
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes('1kB');
|
||||
// output: 1024
|
||||
|
||||
bytes('1024');
|
||||
// output: 1024
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install bytes --save
|
||||
component install visionmedia/bytes.js
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[](https://github.com/visionmedia/bytes.js/blob/master/LICENSE)
|
||||
|
||||
[downloads-image]: https://img.shields.io/npm/dm/bytes.svg
|
||||
[downloads-url]: https://npmjs.org/package/bytes
|
||||
[npm-image]: https://img.shields.io/npm/v/bytes.svg
|
||||
[npm-url]: https://npmjs.org/package/bytes
|
||||
[travis-image]: https://img.shields.io/travis/visionmedia/bytes.js/master.svg
|
||||
[travis-url]: https://travis-ci.org/visionmedia/bytes.js
|
||||
141
node_modules/bytes/index.js
generated
vendored
Normal file
141
node_modules/bytes/index.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/*!
|
||||
* bytes
|
||||
* Copyright(c) 2012-2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Jed Watson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = bytes;
|
||||
module.exports.format = format;
|
||||
module.exports.parse = parse;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var map = {
|
||||
b: 1,
|
||||
kb: 1 << 10,
|
||||
mb: 1 << 20,
|
||||
gb: 1 << 30,
|
||||
tb: ((1 << 30) * 1024)
|
||||
};
|
||||
|
||||
/**
|
||||
*Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
||||
*
|
||||
* @param {string|number} value
|
||||
* @param {{
|
||||
* case: [string],
|
||||
* decimalPlaces: [number]
|
||||
* fixedDecimals: [boolean]
|
||||
* thousandsSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string|number|null}
|
||||
*/
|
||||
|
||||
function bytes(value, options) {
|
||||
if (typeof value === 'string') {
|
||||
return parse(value);
|
||||
}
|
||||
|
||||
if (typeof value === 'number') {
|
||||
return format(value, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given value in bytes into a string.
|
||||
*
|
||||
* If the value is negative, it is kept as such. If it is a float,
|
||||
* it is rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {object} [options]
|
||||
* @param {number} [options.decimalPlaces=2]
|
||||
* @param {number} [options.fixedDecimals=false]
|
||||
* @param {string} [options.thousandsSeparator=]
|
||||
* @public
|
||||
*/
|
||||
|
||||
function format(value, options) {
|
||||
if (typeof value !== 'number') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mag = Math.abs(value);
|
||||
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
||||
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
||||
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
||||
var unit = 'B';
|
||||
|
||||
if (mag >= map.tb) {
|
||||
unit = 'TB';
|
||||
} else if (mag >= map.gb) {
|
||||
unit = 'GB';
|
||||
} else if (mag >= map.mb) {
|
||||
unit = 'MB';
|
||||
} else if (mag >= map.kb) {
|
||||
unit = 'kB';
|
||||
}
|
||||
|
||||
var val = value / map[unit.toLowerCase()];
|
||||
var str = val.toFixed(decimalPlaces);
|
||||
|
||||
if (!fixedDecimals) {
|
||||
str = str.replace(/(?:\.0*|(\.[^0]+)0+)$/, '$1');
|
||||
}
|
||||
|
||||
if (thousandsSeparator) {
|
||||
str = str.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
|
||||
}
|
||||
|
||||
return str + unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {number|string} val
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse(val) {
|
||||
if (typeof val === 'number' && !isNaN(val)) {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (typeof val !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Test if the string passed is valid
|
||||
var results = val.match(/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i);
|
||||
var floatValue;
|
||||
var unit = 'b';
|
||||
|
||||
if (!results) {
|
||||
// Nothing could be extracted from the given string
|
||||
floatValue = parseInt(val);
|
||||
unit = 'b'
|
||||
} else {
|
||||
// Retrieve the value and the unit
|
||||
floatValue = parseFloat(results[1]);
|
||||
unit = results[4].toLowerCase();
|
||||
}
|
||||
|
||||
return map[unit] * floatValue;
|
||||
}
|
||||
107
node_modules/bytes/package.json
generated
vendored
Normal file
107
node_modules/bytes/package.json
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"bytes@2.2.0",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser"
|
||||
]
|
||||
],
|
||||
"_from": "bytes@2.2.0",
|
||||
"_id": "bytes@2.2.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bytes",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "bytes",
|
||||
"raw": "bytes@2.2.0",
|
||||
"rawSpec": "2.2.0",
|
||||
"scope": null,
|
||||
"spec": "2.2.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bytes/-/bytes-2.2.0.tgz",
|
||||
"_shasum": "fd35464a403f6f9117c2de3609ecff9cae000588",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "bytes@2.2.0",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\body-parser",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/bytes.js/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"bytes/index.js": "index.js"
|
||||
}
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jed Watson",
|
||||
"email": "jed.watson@me.com"
|
||||
},
|
||||
{
|
||||
"name": "Théo FIDRY",
|
||||
"email": "theo.fidry@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
||||
"devDependencies": {
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "fd35464a403f6f9117c2de3609ecff9cae000588",
|
||||
"tarball": "http://registry.npmjs.org/bytes/-/bytes-2.2.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"History.md",
|
||||
"LICENSE",
|
||||
"Readme.md",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "509a01a5472b9163ae5a7db41e2d6bd986fdf595",
|
||||
"homepage": "https://github.com/visionmedia/bytes.js",
|
||||
"keywords": [
|
||||
"byte",
|
||||
"bytes",
|
||||
"convert",
|
||||
"converter",
|
||||
"parse",
|
||||
"parser",
|
||||
"utility"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "bytes",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/visionmedia/bytes.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --check-leaks --reporter spec"
|
||||
},
|
||||
"version": "2.2.0"
|
||||
}
|
||||
30
node_modules/center-align/package.json
generated
vendored
30
node_modules/center-align/package.json
generated
vendored
@@ -2,20 +2,24 @@
|
||||
"_args": [
|
||||
[
|
||||
"center-align@^0.1.1",
|
||||
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\cliui"
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\cliui"
|
||||
]
|
||||
],
|
||||
"_from": "center-align@>=0.1.1 <0.2.0",
|
||||
"_id": "center-align@0.1.2",
|
||||
"_id": "center-align@0.1.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/center-align",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_nodeVersion": "5.3.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-9-west.internal.npmjs.com",
|
||||
"tmp": "tmp/center-align-0.1.3.tgz_1454366538829_0.9471865000668913"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_npmVersion": "3.3.12",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "center-align",
|
||||
@@ -28,11 +32,11 @@
|
||||
"_requiredBy": [
|
||||
"/cliui"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.2.tgz",
|
||||
"_shasum": "74fa8540fc19b26aae6edc7e031cd6993d495ba0",
|
||||
"_resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
|
||||
"_shasum": "aa0d32629b6ee972200411cbd4461c907bc2b7ad",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "center-align@^0.1.1",
|
||||
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\cliui",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\cliui",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
@@ -41,8 +45,8 @@
|
||||
"url": "https://github.com/jonschlinkert/center-align/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"align-text": "^0.1.0",
|
||||
"lazy-cache": "^0.2.4"
|
||||
"align-text": "^0.1.3",
|
||||
"lazy-cache": "^1.0.3"
|
||||
},
|
||||
"description": "Center-align the text in a string.",
|
||||
"devDependencies": {
|
||||
@@ -50,8 +54,8 @@
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "74fa8540fc19b26aae6edc7e031cd6993d495ba0",
|
||||
"tarball": "http://registry.npmjs.org/center-align/-/center-align-0.1.2.tgz"
|
||||
"shasum": "aa0d32629b6ee972200411cbd4461c907bc2b7ad",
|
||||
"tarball": "http://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -60,7 +64,7 @@
|
||||
"index.js",
|
||||
"utils.js"
|
||||
],
|
||||
"gitHead": "b3af961dcbe6072aaa94503585a16434234c0a8b",
|
||||
"gitHead": "5c5fab5012fceaa3e21a00162958c0ed11109419",
|
||||
"homepage": "https://github.com/jonschlinkert/center-align",
|
||||
"keywords": [
|
||||
"align",
|
||||
@@ -105,5 +109,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "0.1.2"
|
||||
"version": "0.1.3"
|
||||
}
|
||||
|
||||
5
node_modules/clean-css/History.md
generated
vendored
5
node_modules/clean-css/History.md
generated
vendored
@@ -1,3 +1,8 @@
|
||||
[3.4.10 / 2016-02-29](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.9...v3.4.10)
|
||||
==================
|
||||
|
||||
* Fixed issue [#735](https://github.com/jakubpawlowicz/clean-css/issues/735) - whitespace removal with escaped chars.
|
||||
|
||||
[3.4.9 / 2016-01-03](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.8...v3.4.9)
|
||||
==================
|
||||
|
||||
|
||||
11
node_modules/clean-css/lib/selectors/clean-up.js
generated
vendored
11
node_modules/clean-css/lib/selectors/clean-up.js
generated
vendored
@@ -6,6 +6,15 @@ function selectorSorter(s1, s2) {
|
||||
return s1[0] > s2[0] ? 1 : -1;
|
||||
}
|
||||
|
||||
function whitespaceReplacements(_, p1, p2, p3) {
|
||||
if (p1 && p2 && p3.length)
|
||||
return p1 + p2 + ' ';
|
||||
else if (p1 && p2)
|
||||
return p1 + p2;
|
||||
else
|
||||
return p2;
|
||||
}
|
||||
|
||||
var CleanUp = {
|
||||
selectors: function (selectors, removeUnsupported, adjacentSpace) {
|
||||
var list = [];
|
||||
@@ -16,7 +25,7 @@ var CleanUp = {
|
||||
var reduced = selector[0]
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/ ?, ?/g, ',')
|
||||
.replace(/\s*([>\+\~])\s*/g, '$1')
|
||||
.replace(/\s*(\\)?([>+~])(\s*)/g, whitespaceReplacements)
|
||||
.trim();
|
||||
|
||||
if (adjacentSpace && reduced.indexOf('nav') > 0)
|
||||
|
||||
22
node_modules/clean-css/package.json
generated
vendored
22
node_modules/clean-css/package.json
generated
vendored
@@ -2,15 +2,19 @@
|
||||
"_args": [
|
||||
[
|
||||
"clean-css@^3.1.9",
|
||||
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\jade"
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\jade"
|
||||
]
|
||||
],
|
||||
"_from": "clean-css@>=3.1.9 <4.0.0",
|
||||
"_id": "clean-css@3.4.9",
|
||||
"_id": "clean-css@3.4.10",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/clean-css",
|
||||
"_nodeVersion": "0.12.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-5-east.internal.npmjs.com",
|
||||
"tmp": "tmp/clean-css-3.4.10.tgz_1456729605814_0.9978964275214821"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "jakub@goalsmashers.com",
|
||||
"name": "goalsmashers"
|
||||
@@ -30,11 +34,11 @@
|
||||
"_requiredBy": [
|
||||
"/jade"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.9.tgz",
|
||||
"_shasum": "954c49c34968763f50b05fd0dde44694cf9d2eb9",
|
||||
"_resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.10.tgz",
|
||||
"_shasum": "7c85ba47448b136a3e4925d397bdfdc5a4086b7f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "clean-css@^3.1.9",
|
||||
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\jade",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\jade",
|
||||
"author": {
|
||||
"email": "contact@jakubpawlowicz.com",
|
||||
"name": "Jakub Pawlowicz",
|
||||
@@ -62,8 +66,8 @@
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "954c49c34968763f50b05fd0dde44694cf9d2eb9",
|
||||
"tarball": "http://registry.npmjs.org/clean-css/-/clean-css-3.4.9.tgz"
|
||||
"shasum": "7c85ba47448b136a3e4925d397bdfdc5a4086b7f",
|
||||
"tarball": "http://registry.npmjs.org/clean-css/-/clean-css-3.4.10.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -75,7 +79,7 @@
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "feb956f9fbf540b8d870463600bb816640467eaa",
|
||||
"gitHead": "0a8d64b2e6c2370d01582d92cab8b225fe001ce5",
|
||||
"homepage": "https://github.com/jakubpawlowicz/clean-css",
|
||||
"keywords": [
|
||||
"css",
|
||||
@@ -107,5 +111,5 @@
|
||||
"prepublish": "npm run check",
|
||||
"test": "vows"
|
||||
},
|
||||
"version": "3.4.9"
|
||||
"version": "3.4.10"
|
||||
}
|
||||
|
||||
22
node_modules/crc/LICENSE
generated
vendored
Normal file
22
node_modules/crc/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2014 Alex Gorbatchev
|
||||
|
||||
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.
|
||||
100
node_modules/crc/README.md
generated
vendored
Normal file
100
node_modules/crc/README.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# crc
|
||||
|
||||
[](https://www.gittip.com/alexgorbatchev/)
|
||||
[](https://david-dm.org/alexgorbatchev/node-crc)
|
||||
[](https://david-dm.org/alexgorbatchev/node-crc#info=devDependencies)
|
||||
[](https://travis-ci.org/alexgorbatchev/node-crc)
|
||||
|
||||
[](https://npmjs.org/package/crc)
|
||||
|
||||
Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.
|
||||
|
||||
## Features
|
||||
|
||||
* Full test suite comparing values against reference `pycrc` implementation.
|
||||
* Version 3.x is 3x to 4x faster than version 2.x.
|
||||
* Pure JavaScript implementation, no dependencies.
|
||||
* Provides CRC Tables for optimized calculations.
|
||||
* Provides support for the following CRC algorithms:
|
||||
* CRC1 `crc.crc1(…)`
|
||||
* CRC8 `crc.crc8(…)`
|
||||
* CRC8 1-Wire `crc.crc81wire(…)`
|
||||
* CRC16 `crc.crc16(…)`
|
||||
* CRC16 CCITT `crc.crc16ccitt(…)`
|
||||
* CRC16 Modbus `crc.crc16modbus(…)`
|
||||
* CRC16 Kermit `crc.crc16kermit(…)`
|
||||
* CRC16 XModem `crc.crc16xmodem(…)`
|
||||
* CRC24 `crc.crc24(…)`
|
||||
* CRC32 `crc.crc32(…)`
|
||||
|
||||
## IMPORTANT
|
||||
|
||||
If you've used `crc` module prior to version 2.x, you might have some inconsistencies with the current implementation because it relied on very old code and wasn't checked against reference implementation. If you upgrading from 1.x, please take special care.
|
||||
|
||||
## Support
|
||||
|
||||
<a href="https://blockchain.info/address/1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ"><img src="bitcoin.png" width="150" align="right"/></a> Please support me on [GitTip](https://www.gittip.com/alexgorbatchev/). I'm sure you know that it takes a lot of personal time to write and even more time to maintain open source projects. If you use this package, buy me a beer on GitTip or via Bitcoin [`1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ`](https://blockchain.info/address/1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install crc
|
||||
|
||||
## Running tests
|
||||
|
||||
$ npm install
|
||||
$ npm test
|
||||
|
||||
## Usage Example
|
||||
|
||||
Calculate a CRC32:
|
||||
|
||||
var crc = require('crc');
|
||||
|
||||
crc.crc32('hello').toString(16);
|
||||
# => "3610a686"
|
||||
|
||||
Calculate a CRC32 of a file:
|
||||
|
||||
crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16);
|
||||
# => "127ad531"
|
||||
|
||||
Or using a `Buffer`:
|
||||
|
||||
crc.crc32(fs.readFileSync('README.md')).toString(16);
|
||||
# => "127ad531"
|
||||
|
||||
Incrementally calculate a CRC32:
|
||||
|
||||
value = crc.crc32('one');
|
||||
value = crc.crc32('two', value);
|
||||
value = crc.crc32('three', value);
|
||||
value.toString(16);
|
||||
# => "9e1c092"
|
||||
|
||||
## Thanks!
|
||||
|
||||
[pycrc](http://www.tty1.net/pycrc/) library is which the source of all of the CRC tables.
|
||||
|
||||
# License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Alex Gorbatchev
|
||||
|
||||
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.
|
||||
24
node_modules/crc/lib/crc1.js
generated
vendored
Normal file
24
node_modules/crc/lib/crc1.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc1', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = ~ ~previous;
|
||||
var accum = 0;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
accum += byte;
|
||||
}
|
||||
|
||||
crc += accum % 256;
|
||||
return crc % 256;
|
||||
});
|
||||
27
node_modules/crc/lib/crc16.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc16.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16 --generate=c`
|
||||
var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc-16', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = ~ ~previous;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc16_ccitt.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc16_ccitt.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=ccitt --generate=c`
|
||||
var TABLE = [0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('ccitt', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xffff;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = (TABLE[(crc >> 8 ^ byte) & 0xff] ^ crc << 8) & 0xffff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc16_kermit.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc16_kermit.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c`
|
||||
var TABLE = [0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('kermit', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = typeof previous !== 'undefined' ? ~ ~previous : 0x0000;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc16_modbus.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc16_modbus.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-modbus --generate=c`
|
||||
var TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc-16-modbus', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xffff;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
31
node_modules/crc/lib/crc16_xmodem.js
generated
vendored
Normal file
31
node_modules/crc/lib/crc16_xmodem.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = (0, _define_crc2.default)('xmodem', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = typeof previous !== 'undefined' ? ~ ~previous : 0x0;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
var code = crc >>> 8 & 0xFF;
|
||||
|
||||
code ^= byte & 0xFF;
|
||||
code ^= code >>> 4;
|
||||
crc = crc << 8 & 0xFFFF;
|
||||
crc ^= code;
|
||||
code = code << 5 & 0xFFFF;
|
||||
crc ^= code;
|
||||
code = code << 7 & 0xFFFF;
|
||||
crc ^= code;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc24.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc24.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-drive --model=crc-24 --generate=c`
|
||||
var TABLE = [0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc-24', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = typeof previous !== 'undefined' ? ~ ~previous : 0xb704ce;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = (TABLE[(crc >> 16 ^ byte) & 0xff] ^ crc << 8) & 0xffffff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc32.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc32.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=crc-32 --generate=c`
|
||||
var TABLE = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc-32', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = previous === 0 ? 0 : ~ ~previous ^ -1;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = TABLE[(crc ^ byte) & 0xff] ^ crc >>> 8;
|
||||
}
|
||||
|
||||
return crc ^ -1;
|
||||
});
|
||||
27
node_modules/crc/lib/crc8.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc8.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=crc-8 --generate=c`
|
||||
var TABLE = [0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('crc-8', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = ~ ~previous;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
27
node_modules/crc/lib/crc8_1wire.js
generated
vendored
Normal file
27
node_modules/crc/lib/crc8_1wire.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var _buffer = require('buffer');
|
||||
|
||||
var _define_crc = require('./define_crc');
|
||||
|
||||
var _define_crc2 = _interopRequireDefault(_define_crc);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// Generated by `./pycrc.py --algorithm=table-driven --model=dallas-1-wire --generate=c`
|
||||
var TABLE = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE);
|
||||
|
||||
module.exports = (0, _define_crc2.default)('dallas-1-wire', function (buf, previous) {
|
||||
if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _buffer.Buffer)(buf);
|
||||
|
||||
var crc = ~ ~previous;
|
||||
|
||||
for (var index = 0; index < buf.length; index++) {
|
||||
var byte = buf[index];
|
||||
crc = TABLE[(crc ^ byte) & 0xff] & 0xff;
|
||||
}
|
||||
|
||||
return crc;
|
||||
});
|
||||
16
node_modules/crc/lib/define_crc.js
generated
vendored
Normal file
16
node_modules/crc/lib/define_crc.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (model, calc) {
|
||||
var fn = function fn(buf, previous) {
|
||||
return calc(buf, previous) >>> 0;
|
||||
};
|
||||
fn.signed = calc;
|
||||
fn.unsigned = fn;
|
||||
fn.model = model;
|
||||
|
||||
return fn;
|
||||
};
|
||||
14
node_modules/crc/lib/index.js
generated
vendored
Normal file
14
node_modules/crc/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
crc1: require('./crc1'),
|
||||
crc8: require('./crc8'),
|
||||
crc81wire: require('./crc8_1wire'),
|
||||
crc16: require('./crc16'),
|
||||
crc16ccitt: require('./crc16_ccitt'),
|
||||
crc16modbus: require('./crc16_modbus'),
|
||||
crc16xmodem: require('./crc16_xmodem'),
|
||||
crc16kermit: require('./crc16_kermit'),
|
||||
crc24: require('./crc24'),
|
||||
crc32: require('./crc32')
|
||||
};
|
||||
93
node_modules/crc/package.json
generated
vendored
Normal file
93
node_modules/crc/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"crc@3.4.0",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\express-session"
|
||||
]
|
||||
],
|
||||
"_from": "crc@3.4.0",
|
||||
"_id": "crc@3.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/crc",
|
||||
"_nodeVersion": "0.12.7",
|
||||
"_npmUser": {
|
||||
"email": "alex.gorbatchev@gmail.com",
|
||||
"name": "alexgorbatchev"
|
||||
},
|
||||
"_npmVersion": "2.11.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "crc",
|
||||
"raw": "crc@3.4.0",
|
||||
"rawSpec": "3.4.0",
|
||||
"scope": null,
|
||||
"spec": "3.4.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/express-session"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/crc/-/crc-3.4.0.tgz",
|
||||
"_shasum": "4258e351613a74ef1153dfcb05e820c3e9715d7f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "crc@3.4.0",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\express-session",
|
||||
"author": {
|
||||
"name": "Alex Gorbatchev",
|
||||
"url": "https://github.com/alexgorbatchev"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"es2015"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/alexgorbatchev/node-crc/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.1.21",
|
||||
"babel-preset-es2015": "^6.1.18",
|
||||
"beautify-benchmark": "^0.2.4",
|
||||
"benchmark": "^1.0.0",
|
||||
"buffer-crc32": "^0.2.3",
|
||||
"chai": "^3.4.1",
|
||||
"mocha": "*",
|
||||
"seedrandom": "^2.3.6"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4258e351613a74ef1153dfcb05e820c3e9715d7f",
|
||||
"tarball": "http://registry.npmjs.org/crc/-/crc-3.4.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "3726e792cb4a328ef2d935cfd896e54fa9529aaf",
|
||||
"homepage": "https://github.com/alexgorbatchev/node-crc",
|
||||
"keywords": [
|
||||
"crc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "alexgorbatchev",
|
||||
"email": "alex.gorbatchev@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "crc",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/alexgorbatchev/node-crc.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "cd src && babel --out-dir ../lib *.js",
|
||||
"test": "mocha test/*.test.js"
|
||||
},
|
||||
"version": "3.4.0"
|
||||
}
|
||||
9
node_modules/decamelize/index.js
generated
vendored
9
node_modules/decamelize/index.js
generated
vendored
@@ -1,6 +1,4 @@
|
||||
'use strict';
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
module.exports = function (str, sep) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
@@ -8,9 +6,8 @@ module.exports = function (str, sep) {
|
||||
|
||||
sep = typeof sep === 'undefined' ? '_' : sep;
|
||||
|
||||
var reSep = escapeStringRegexp(sep);
|
||||
|
||||
return str.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
|
||||
.replace(new RegExp('(' + reSep + '[A-Z])([A-Z])', 'g'), '$1' + reSep + '$2')
|
||||
return str
|
||||
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
|
||||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
32
node_modules/decamelize/package.json
generated
vendored
32
node_modules/decamelize/package.json
generated
vendored
@@ -2,20 +2,24 @@
|
||||
"_args": [
|
||||
[
|
||||
"decamelize@^1.0.0",
|
||||
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\yargs"
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\yargs"
|
||||
]
|
||||
],
|
||||
"_from": "decamelize@>=1.0.0 <2.0.0",
|
||||
"_id": "decamelize@1.1.2",
|
||||
"_id": "decamelize@1.2.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/decamelize",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_nodeVersion": "4.3.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/decamelize-1.2.0.tgz_1457167749082_0.9810893186368048"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "sindresorhus"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_npmVersion": "3.8.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "decamelize",
|
||||
@@ -28,11 +32,11 @@
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.1.2.tgz",
|
||||
"_shasum": "dcc93727be209632e98b02718ef4cb79602322f2",
|
||||
"_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"_shasum": "f6534d15148269b20352e7bee26f501f9a191290",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "decamelize@^1.0.0",
|
||||
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\yargs",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\yargs",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
@@ -41,9 +45,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/decamelize/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^1.0.4"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
@@ -51,8 +53,8 @@
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "dcc93727be209632e98b02718ef4cb79602322f2",
|
||||
"tarball": "http://registry.npmjs.org/decamelize/-/decamelize-1.1.2.tgz"
|
||||
"shasum": "f6534d15148269b20352e7bee26f501f9a191290",
|
||||
"tarball": "http://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -60,8 +62,8 @@
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "82c87d3382126375ab0c3b7f5438bfd5eccb18c3",
|
||||
"homepage": "https://github.com/sindresorhus/decamelize",
|
||||
"gitHead": "95980ab6fb44c40eaca7792bdf93aff7c210c805",
|
||||
"homepage": "https://github.com/sindresorhus/decamelize#readme",
|
||||
"keywords": [
|
||||
"camelcase",
|
||||
"case",
|
||||
@@ -92,5 +94,5 @@
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
"version": "1.2.0"
|
||||
}
|
||||
|
||||
6
node_modules/decamelize/readme.md
generated
vendored
6
node_modules/decamelize/readme.md
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# decamelize [](https://travis-ci.org/sindresorhus/decamelize)
|
||||
|
||||
> Convert a camelized string into a lowercased one with a custom separator
|
||||
> Convert a camelized string into a lowercased one with a custom separator<br>
|
||||
> Example: `unicornRainbow` → `unicorn_rainbow`
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Type: `string`
|
||||
|
||||
#### separator
|
||||
|
||||
Type: `string`
|
||||
Type: `string`<br>
|
||||
Default: `_`
|
||||
|
||||
|
||||
@@ -45,4 +45,4 @@ See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
11
node_modules/escape-string-regexp/index.js
generated
vendored
11
node_modules/escape-string-regexp/index.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
||||
97
node_modules/escape-string-regexp/package.json
generated
vendored
97
node_modules/escape-string-regexp/package.json
generated
vendored
@@ -1,97 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"escape-string-regexp@^1.0.4",
|
||||
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\decamelize"
|
||||
]
|
||||
],
|
||||
"_from": "escape-string-regexp@>=1.0.4 <2.0.0",
|
||||
"_id": "escape-string-regexp@1.0.4",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/escape-string-regexp",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "sindresorhus"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "escape-string-regexp",
|
||||
"raw": "escape-string-regexp@^1.0.4",
|
||||
"rawSpec": "^1.0.4",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.4 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/decamelize"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.4.tgz",
|
||||
"_shasum": "b85e679b46f72d03fbbe8a3bf7259d535c21b62f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "escape-string-regexp@^1.0.4",
|
||||
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant\\node_modules\\decamelize",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Escape RegExp special characters",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b85e679b46f72d03fbbe8a3bf7259d535c21b62f",
|
||||
"tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.4.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "e9ca6832a9506ca26402cb0e6dc95efcf35b0b97",
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
|
||||
"keywords": [
|
||||
"characters",
|
||||
"escape",
|
||||
"expression",
|
||||
"re",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"special",
|
||||
"str",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
}
|
||||
],
|
||||
"name": "escape-string-regexp",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/escape-string-regexp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.4"
|
||||
}
|
||||
27
node_modules/escape-string-regexp/readme.md
generated
vendored
27
node_modules/escape-string-regexp/readme.md
generated
vendored
@@ -1,27 +0,0 @@
|
||||
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
const escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> 'how much \$ for a unicorn\?'
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
293
node_modules/express-session/HISTORY.md
generated
vendored
Normal file
293
node_modules/express-session/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
1.13.0 / 2016-01-10
|
||||
===================
|
||||
|
||||
* Fix `rolling: true` to not set cookie when no session exists
|
||||
- Better `saveUninitialized: false` + `rolling: true` behavior
|
||||
* deps: crc@3.4.0
|
||||
|
||||
1.12.1 / 2015-10-29
|
||||
===================
|
||||
|
||||
* deps: cookie@0.2.3
|
||||
- Fix cookie `Max-Age` to never be a floating point number
|
||||
|
||||
1.12.0 / 2015-10-25
|
||||
===================
|
||||
|
||||
* Support the value `'auto'` in the `cookie.secure` option
|
||||
* deps: cookie@0.2.2
|
||||
- Throw on invalid values provided to `serialize`
|
||||
* deps: depd@~1.1.0
|
||||
- Enable strict mode in more places
|
||||
- Support web browser loading
|
||||
* deps: on-headers@~1.0.1
|
||||
- perf: enable strict mode
|
||||
|
||||
1.11.3 / 2015-05-22
|
||||
===================
|
||||
|
||||
* deps: cookie@0.1.3
|
||||
- Slight optimizations
|
||||
* deps: crc@3.3.0
|
||||
|
||||
1.11.2 / 2015-05-10
|
||||
===================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
* deps: uid-safe@~2.0.0
|
||||
|
||||
1.11.1 / 2015-04-08
|
||||
===================
|
||||
|
||||
* Fix mutating `options.secret` value
|
||||
|
||||
1.11.0 / 2015-04-07
|
||||
===================
|
||||
|
||||
* Support an array in `secret` option for key rotation
|
||||
* deps: depd@~1.0.1
|
||||
|
||||
1.10.4 / 2015-03-15
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
1.10.3 / 2015-02-16
|
||||
===================
|
||||
|
||||
* deps: cookie-signature@1.0.6
|
||||
* deps: uid-safe@1.1.0
|
||||
- Use `crypto.randomBytes`, if available
|
||||
- deps: base64-url@1.2.1
|
||||
|
||||
1.10.2 / 2015-01-31
|
||||
===================
|
||||
|
||||
* deps: uid-safe@1.0.3
|
||||
- Fix error branch that would throw
|
||||
- deps: base64-url@1.2.0
|
||||
|
||||
1.10.1 / 2015-01-08
|
||||
===================
|
||||
|
||||
* deps: uid-safe@1.0.2
|
||||
- Remove dependency on `mz`
|
||||
|
||||
1.10.0 / 2015-01-05
|
||||
===================
|
||||
|
||||
* Add `store.touch` interface for session stores
|
||||
* Fix `MemoryStore` expiration with `resave: false`
|
||||
* deps: debug@~2.1.1
|
||||
|
||||
1.9.3 / 2014-12-02
|
||||
==================
|
||||
|
||||
* Fix error when `req.sessionID` contains a non-string value
|
||||
|
||||
1.9.2 / 2014-11-22
|
||||
==================
|
||||
|
||||
* deps: crc@3.2.1
|
||||
- Minor fixes
|
||||
|
||||
1.9.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Remove unnecessary empty write call
|
||||
- Fixes Node.js 0.11.14 behavior change
|
||||
- Helps work-around Node.js 0.10.1 zlib bug
|
||||
|
||||
1.9.0 / 2014-09-16
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
* deps: depd@~1.0.0
|
||||
|
||||
1.8.2 / 2014-09-15
|
||||
==================
|
||||
|
||||
* Use `crc` instead of `buffer-crc32` for speed
|
||||
* deps: depd@0.4.5
|
||||
|
||||
1.8.1 / 2014-09-08
|
||||
==================
|
||||
|
||||
* Keep `req.session.save` non-enumerable
|
||||
* Prevent session prototype methods from being overwritten
|
||||
|
||||
1.8.0 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Do not resave already-saved session at end of request
|
||||
* deps: cookie-signature@1.0.5
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
1.7.6 / 2014-08-18
|
||||
==================
|
||||
|
||||
* Fix exception on `res.end(null)` calls
|
||||
|
||||
1.7.5 / 2014-08-10
|
||||
==================
|
||||
|
||||
* Fix parsing original URL
|
||||
* deps: on-headers@~1.0.0
|
||||
* deps: parseurl@~1.3.0
|
||||
|
||||
1.7.4 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Fix response end delay for non-chunked responses
|
||||
|
||||
1.7.3 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Fix `res.end` patch to call correct upstream `res.write`
|
||||
|
||||
1.7.2 / 2014-07-27
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.4
|
||||
- Work-around v8 generating empty stack traces
|
||||
|
||||
1.7.1 / 2014-07-26
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.3
|
||||
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
1.7.0 / 2014-07-22
|
||||
==================
|
||||
|
||||
* Improve session-ending error handling
|
||||
- Errors are passed to `next(err)` instead of `console.error`
|
||||
* deps: debug@1.0.4
|
||||
* 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
|
||||
|
||||
1.6.5 / 2014-07-11
|
||||
==================
|
||||
|
||||
* Do not require `req.originalUrl`
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
1.6.4 / 2014-07-07
|
||||
==================
|
||||
|
||||
* Fix blank responses for stores with synchronous operations
|
||||
|
||||
1.6.3 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix resave deprecation message
|
||||
|
||||
1.6.2 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix confusing option deprecation messages
|
||||
|
||||
1.6.1 / 2014-06-28
|
||||
==================
|
||||
|
||||
* Fix saveUninitialized deprecation message
|
||||
|
||||
1.6.0 / 2014-06-28
|
||||
==================
|
||||
|
||||
* Add deprecation message to undefined `resave` option
|
||||
* Add deprecation message to undefined `saveUninitialized` option
|
||||
* Fix `res.end` patch to return correct value
|
||||
* Fix `res.end` patch to handle multiple `res.end` calls
|
||||
* Reject cookies with missing signatures
|
||||
|
||||
1.5.2 / 2014-06-26
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.4
|
||||
- fix for timing attacks
|
||||
|
||||
1.5.1 / 2014-06-21
|
||||
==================
|
||||
|
||||
* Move hard-to-track-down `req.secret` deprecation message
|
||||
|
||||
1.5.0 / 2014-06-19
|
||||
==================
|
||||
|
||||
* Debug name is now "express-session"
|
||||
* Deprecate integration with `cookie-parser` middleware
|
||||
* Deprecate looking for secret in `req.secret`
|
||||
* Directly read cookies; `cookie-parser` no longer required
|
||||
* Directly set cookies; `res.cookie` no longer required
|
||||
* Generate session IDs with `uid-safe`, faster and even less collisions
|
||||
|
||||
1.4.0 / 2014-06-17
|
||||
==================
|
||||
|
||||
* Add `genid` option to generate custom session IDs
|
||||
* Add `saveUninitialized` option to control saving uninitialized sessions
|
||||
* Add `unset` option to control unsetting `req.session`
|
||||
* Generate session IDs with `rand-token` by default; reduce collisions
|
||||
* deps: buffer-crc32@0.2.3
|
||||
|
||||
1.3.1 / 2014-06-14
|
||||
==================
|
||||
|
||||
* Add description in package for npmjs.org listing
|
||||
|
||||
1.3.0 / 2014-06-14
|
||||
==================
|
||||
|
||||
* Integrate with express "trust proxy" by default
|
||||
* deps: debug@1.0.2
|
||||
|
||||
1.2.1 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Fix `resave` such that `resave: true` works
|
||||
|
||||
1.2.0 / 2014-05-19
|
||||
==================
|
||||
|
||||
* Add `resave` option to control saving unmodified sessions
|
||||
|
||||
1.1.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Add `name` option; replacement for `key` option
|
||||
* Use `setImmediate` in MemoryStore for node.js >= 0.10
|
||||
|
||||
1.0.4 / 2014-04-27
|
||||
==================
|
||||
|
||||
* deps: debug@0.8.1
|
||||
|
||||
1.0.3 / 2014-04-19
|
||||
==================
|
||||
|
||||
* Use `res.cookie()` instead of `res.setHeader()`
|
||||
* deps: cookie@0.1.2
|
||||
|
||||
1.0.2 / 2014-02-23
|
||||
==================
|
||||
|
||||
* Add missing dependency to `package.json`
|
||||
|
||||
1.0.1 / 2014-02-15
|
||||
==================
|
||||
|
||||
* Add missing dependencies to `package.json`
|
||||
|
||||
1.0.0 / 2014-02-15
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
||||
24
node_modules/express-session/LICENSE
generated
vendored
Normal file
24
node_modules/express-session/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010 Sencha Inc.
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
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.
|
||||
552
node_modules/express-session/README.md
generated
vendored
Normal file
552
node_modules/express-session/README.md
generated
vendored
Normal file
@@ -0,0 +1,552 @@
|
||||
# express-session
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
[![Gratipay][gratipay-image]][gratipay-url]
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install express-session
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var session = require('express-session')
|
||||
```
|
||||
|
||||
### session(options)
|
||||
|
||||
Create a session middleware with the given `options`.
|
||||
|
||||
**Note** Session data is _not_ saved in the cookie itself, just the session ID.
|
||||
Session data is stored server-side.
|
||||
|
||||
**Warning** The default server-side session storage, `MemoryStore`, is _purposely_
|
||||
not designed for a production environment. It will leak memory under most
|
||||
conditions, does not scale past a single process, and is meant for debugging and
|
||||
developing.
|
||||
|
||||
For a list of stores, see [compatible session stores](#compatible-session-stores).
|
||||
|
||||
#### Options
|
||||
|
||||
`express-session` accepts these properties in the options object.
|
||||
|
||||
##### cookie
|
||||
|
||||
Settings for the session ID cookie. See the "Cookie options" section below for
|
||||
more information on the different values.
|
||||
|
||||
The default value is `{ path: '/', httpOnly: true, secure: false, maxAge: null }`.
|
||||
|
||||
##### genid
|
||||
|
||||
Function to call to generate a new session ID. Provide a function that returns
|
||||
a string that will be used as a session ID. The function is given `req` as the
|
||||
first argument if you want to use some value attached to `req` when generating
|
||||
the ID.
|
||||
|
||||
The default value is a function which uses the `uid-safe` library to generate IDs.
|
||||
|
||||
**NOTE** be careful to generate unique IDs so your sessions do not conflict.
|
||||
|
||||
```js
|
||||
app.use(session({
|
||||
genid: function(req) {
|
||||
return genuuid() // use UUIDs for session IDs
|
||||
},
|
||||
secret: 'keyboard cat'
|
||||
}))
|
||||
```
|
||||
|
||||
##### name
|
||||
|
||||
The name of the session ID cookie to set in the response (and read from in the
|
||||
request).
|
||||
|
||||
The default value is `'connect.sid'`.
|
||||
|
||||
**Note** if you have multiple apps running on the same host (hostname + port),
|
||||
then you need to separate the session cookies from each other. The simplest
|
||||
method is to simply set different `name`s per app.
|
||||
|
||||
##### proxy
|
||||
|
||||
Trust the reverse proxy when setting secure cookies (via the "X-Forwarded-Proto"
|
||||
header).
|
||||
|
||||
The default value is `undefined`.
|
||||
|
||||
- `true` The "X-Forwarded-Proto" header will be used.
|
||||
- `false` All headers are ignored and the connection is considered secure only
|
||||
if there is a direct TLS/SSL connection.
|
||||
- `undefined` Uses the "trust proxy" setting from express
|
||||
|
||||
##### resave
|
||||
|
||||
Forces the session to be saved back to the session store, even if the session
|
||||
was never modified during the request. Depending on your store this may be
|
||||
necessary, but it can also create race conditions where a client makes two
|
||||
parallel requests to your server and changes made to the session in one
|
||||
request may get overwritten when the other request ends, even if it made no
|
||||
changes (this behavior also depends on what store you're using).
|
||||
|
||||
The default value is `true`, but using the default has been deprecated,
|
||||
as the default will change in the future. Please research into this setting
|
||||
and choose what is appropriate to your use-case. Typically, you'll want
|
||||
`false`.
|
||||
|
||||
How do I know if this is necessary for my store? The best way to know is to
|
||||
check with your store if it implements the `touch` method. If it does, then
|
||||
you can safely set `resave: false`. If it does not implement the `touch`
|
||||
method and your store sets an expiration date on stored sessions, then you
|
||||
likely need `resave: true`.
|
||||
|
||||
##### rolling
|
||||
|
||||
Force a session identifier cookie to be set on every response. The expiration
|
||||
is reset to the original [`maxAge`](#cookiemaxage), resetting the expiration
|
||||
countdown.
|
||||
|
||||
The default value is `false`.
|
||||
|
||||
**Note** When this option is set to `true` but the `saveUnitialized` option is
|
||||
set to `false`, the cookie will not be set on a response with an uninitialized
|
||||
session.
|
||||
|
||||
##### saveUninitialized
|
||||
|
||||
Forces a session that is "uninitialized" to be saved to the store. A session is
|
||||
uninitialized when it is new but not modified. Choosing `false` is useful for
|
||||
implementing login sessions, reducing server storage usage, or complying with
|
||||
laws that require permission before setting a cookie. Choosing `false` will also
|
||||
help with race conditions where a client makes multiple parallel requests
|
||||
without a session.
|
||||
|
||||
The default value is `true`, but using the default has been deprecated, as the
|
||||
default will change in the future. Please research into this setting and
|
||||
choose what is appropriate to your use-case.
|
||||
|
||||
**Note** if you are using Session in conjunction with PassportJS, Passport
|
||||
will add an empty Passport object to the session for use after a user is
|
||||
authenticated, which will be treated as a modification to the session, causing
|
||||
it to be saved.
|
||||
|
||||
##### secret
|
||||
|
||||
**Required option**
|
||||
|
||||
This is the secret used to sign the session ID cookie. This can be either a string
|
||||
for a single secret, or an array of multiple secrets. If an array of secrets is
|
||||
provided, only the first element will be used to sign the session ID cookie, while
|
||||
all the elements will be considered when verifying the signature in requests.
|
||||
|
||||
##### store
|
||||
|
||||
The session store instance, defaults to a new `MemoryStore` instance.
|
||||
|
||||
##### unset
|
||||
|
||||
Control the result of unsetting `req.session` (through `delete`, setting to `null`,
|
||||
etc.).
|
||||
|
||||
The default value is `'keep'`.
|
||||
|
||||
- `'destroy'` The session will be destroyed (deleted) when the response ends.
|
||||
- `'keep'` The session in the store will be kept, but modifications made during
|
||||
the request are ignored and not saved.
|
||||
|
||||
#### Cookie options
|
||||
|
||||
**Note** Since version 1.5.0, the [`cookie-parser` middleware](https://www.npmjs.com/package/cookie-parser)
|
||||
no longer needs to be used for this module to work. This module now directly reads
|
||||
and writes cookies on `req`/`res`. Using `cookie-parser` may result in issues
|
||||
if the `secret` is not the same between this module and `cookie-parser`.
|
||||
|
||||
Please note that `secure: true` is a **recommended** option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies.
|
||||
If `secure` is set, and you access your site over HTTP, the cookie will not be set. If you have your node.js behind a proxy and are using `secure: true`, you need to set "trust proxy" in express:
|
||||
|
||||
```js
|
||||
var app = express()
|
||||
app.set('trust proxy', 1) // trust first proxy
|
||||
app.use(session({
|
||||
secret: 'keyboard cat',
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
cookie: { secure: true }
|
||||
}))
|
||||
```
|
||||
|
||||
For using secure cookies in production, but allowing for testing in development, the following is an example of enabling this setup based on `NODE_ENV` in express:
|
||||
|
||||
```js
|
||||
var app = express()
|
||||
var sess = {
|
||||
secret: 'keyboard cat',
|
||||
cookie: {}
|
||||
}
|
||||
|
||||
if (app.get('env') === 'production') {
|
||||
app.set('trust proxy', 1) // trust first proxy
|
||||
sess.cookie.secure = true // serve secure cookies
|
||||
}
|
||||
|
||||
app.use(session(sess))
|
||||
```
|
||||
|
||||
The `cookie.secure` option can also be set to the special value `'auto'` to have
|
||||
this setting automatically match the determined security of the connection. Be
|
||||
careful when using this setting if the site is available both as HTTP and HTTPS,
|
||||
as once the cookie is set on HTTPS, it will no longer be visible over HTTP. This
|
||||
is useful when the Express `"trust proxy"` setting is properly setup to simplify
|
||||
development vs production configuration.
|
||||
|
||||
By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set
|
||||
so the cookie becomes a browser-session cookie. When the user closes the
|
||||
browser the cookie (and session) will be removed.
|
||||
|
||||
### req.session
|
||||
|
||||
To store or access session data, simply use the request property `req.session`,
|
||||
which is (generally) serialized as JSON by the store, so nested objects
|
||||
are typically fine. For example below is a user-specific view counter:
|
||||
|
||||
```js
|
||||
// Use the session middleware
|
||||
app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
|
||||
|
||||
// Access the session as req.session
|
||||
app.get('/', function(req, res, next) {
|
||||
var sess = req.session
|
||||
if (sess.views) {
|
||||
sess.views++
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<p>views: ' + sess.views + '</p>')
|
||||
res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>')
|
||||
res.end()
|
||||
} else {
|
||||
sess.views = 1
|
||||
res.end('welcome to the session demo. refresh!')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Session.regenerate()
|
||||
|
||||
To regenerate the session simply invoke the method. Once complete,
|
||||
a new SID and `Session` instance will be initialized at `req.session`.
|
||||
|
||||
```js
|
||||
req.session.regenerate(function(err) {
|
||||
// will have a new session here
|
||||
})
|
||||
```
|
||||
|
||||
#### Session.destroy()
|
||||
|
||||
Destroys the session, removing `req.session`; will be re-generated next request.
|
||||
|
||||
```js
|
||||
req.session.destroy(function(err) {
|
||||
// cannot access session here
|
||||
})
|
||||
```
|
||||
|
||||
#### Session.reload()
|
||||
|
||||
Reloads the session data.
|
||||
|
||||
```js
|
||||
req.session.reload(function(err) {
|
||||
// session updated
|
||||
})
|
||||
```
|
||||
|
||||
#### Session.save()
|
||||
|
||||
Save the session back to the store, replacing the contents on the store with the
|
||||
contents in memory (though a store may do something else--consult the store's
|
||||
documentation for exact behavior).
|
||||
|
||||
This method is automatically called at the end of the HTTP response if the
|
||||
session data has been altered (though this behavior can be altered with various
|
||||
options in the middleware constructor). Because of this, typically this method
|
||||
does not need to be called.
|
||||
|
||||
There are some cases where it is useful to call this method, for example, long-
|
||||
lived requests or in WebSockets.
|
||||
|
||||
```js
|
||||
req.session.save(function(err) {
|
||||
// session saved
|
||||
})
|
||||
```
|
||||
|
||||
#### Session.touch()
|
||||
|
||||
Updates the `.maxAge` property. Typically this is
|
||||
not necessary to call, as the session middleware does this for you.
|
||||
|
||||
### req.session.id
|
||||
|
||||
Each session has a unique ID associated with it. This property will
|
||||
contain the session ID and cannot be modified.
|
||||
|
||||
### req.session.cookie
|
||||
|
||||
Each session has a unique cookie object accompany it. This allows
|
||||
you to alter the session cookie per visitor. For example we can
|
||||
set `req.session.cookie.expires` to `false` to enable the cookie
|
||||
to remain for only the duration of the user-agent.
|
||||
|
||||
#### Cookie.maxAge
|
||||
|
||||
Alternatively `req.session.cookie.maxAge` will return the time
|
||||
remaining in milliseconds, which we may also re-assign a new value
|
||||
to adjust the `.expires` property appropriately. The following
|
||||
are essentially equivalent
|
||||
|
||||
```js
|
||||
var hour = 3600000
|
||||
req.session.cookie.expires = new Date(Date.now() + hour)
|
||||
req.session.cookie.maxAge = hour
|
||||
```
|
||||
|
||||
For example when `maxAge` is set to `60000` (one minute), and 30 seconds
|
||||
has elapsed it will return `30000` until the current request has completed,
|
||||
at which time `req.session.touch()` is called to reset `req.session.maxAge`
|
||||
to its original value.
|
||||
|
||||
```js
|
||||
req.session.cookie.maxAge // => 30000
|
||||
```
|
||||
|
||||
### req.sessionID
|
||||
|
||||
To get the ID of the loaded session, access the request property
|
||||
`req.sessionID`. This is simply a read-only value set when a session
|
||||
is loaded/created.
|
||||
|
||||
## Session Store Implementation
|
||||
|
||||
Every session store _must_ be an `EventEmitter` and implement specific
|
||||
methods. The following methods are the list of **required**, **recommended**,
|
||||
and **optional**.
|
||||
|
||||
* Required methods are ones that this module will always call on the store.
|
||||
* Recommended methods are ones that this module will call on the store if
|
||||
available.
|
||||
* Optional methods are ones this module does not call at all, but helps
|
||||
present uniform stores to users.
|
||||
|
||||
For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
|
||||
|
||||
### store.all(callback)
|
||||
|
||||
**Optional**
|
||||
|
||||
This optional method is used to get all sessions in the store as an array. The
|
||||
`callback` should be called as `callback(error, sessions)`.
|
||||
|
||||
### store.destroy(sid, callback)
|
||||
|
||||
**Required**
|
||||
|
||||
This required method is used to destroy/delete a session from the store given
|
||||
a session ID (`sid`). The `callback` should be called as `callback(error)` once
|
||||
the session is destroyed.
|
||||
|
||||
### store.clear(callback)
|
||||
|
||||
**Optional**
|
||||
|
||||
This optional method is used to delete all sessions from the store. The
|
||||
`callback` should be called as `callback(error)` once the store is cleared.
|
||||
|
||||
### store.length(callback)
|
||||
|
||||
**Optional**
|
||||
|
||||
This optional method is used to get the count of all sessions in the store.
|
||||
The `callback` should be called as `callback(error, len)`.
|
||||
|
||||
### store.get(sid, callback)
|
||||
|
||||
**Required**
|
||||
|
||||
This required method is used to get a session from the store given a session
|
||||
ID (`sid`). The `callback` should be called as `callback(error, session)`.
|
||||
|
||||
The `session` argument should be a session if found, otherwise `null` or
|
||||
`undefined` if the session was not found (and there was no error). A special
|
||||
case is made when `error.code === 'ENOENT'` to act like `callback(null, null)`.
|
||||
|
||||
### store.set(sid, session, callback)
|
||||
|
||||
**Required**
|
||||
|
||||
This required method is used to upsert a session into the store given a
|
||||
session ID (`sid`) and session (`session`) object. The callback should be
|
||||
called as `callback(error)` once the session has been set in the store.
|
||||
|
||||
### store.touch(sid, session, callback)
|
||||
|
||||
**Recommended**
|
||||
|
||||
This recommended method is used to "touch" a given session given a
|
||||
session ID (`sid`) and session (`session`) object. The `callback` should be
|
||||
called as `callback(error)` once the session has been touched.
|
||||
|
||||
This is primarily used when the store will automatically delete idle sessions
|
||||
and this method is used to signal to the store the given session is active,
|
||||
potentially resetting the idle timer.
|
||||
|
||||
## Compatible Session Stores
|
||||
|
||||
The following modules implement a session store that is compatible with this
|
||||
module. Please make a PR to add additional modules :)
|
||||
|
||||
[![★][cassandra-store-image] cassandra-store][cassandra-store-url] An Apache Cassandra-based session store.
|
||||
[cassandra-store-url]: https://www.npmjs.com/package/cassandra-store
|
||||
[cassandra-store-image]: https://img.shields.io/github/stars/webcc/cassandra-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][cluster-store-image] cluster-store][cluster-store-url] A wrapper for using in-process / embedded
|
||||
stores - such as SQLite (via knex), leveldb, files, or memory - with node cluster (desirable for Raspberry Pi 2
|
||||
and other multi-core embedded devices).
|
||||
[cluster-store-url]: https://www.npmjs.com/package/cluster-store
|
||||
[cluster-store-image]: https://img.shields.io/github/stars/coolaj86/cluster-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-couchbase-image] connect-couchbase][connect-couchbase-url] A [couchbase](http://www.couchbase.com/)-based session store.
|
||||
[connect-couchbase-url]: https://www.npmjs.com/package/connect-couchbase
|
||||
[connect-couchbase-image]: https://img.shields.io/github/stars/christophermina/connect-couchbase.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-mssql-image] connect-mssql][connect-mssql-url] A SQL Server-based session store.
|
||||
[connect-mssql-url]: https://www.npmjs.com/package/connect-mssql
|
||||
[connect-mssql-image]: https://img.shields.io/github/stars/patriksimek/connect-mssql.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-monetdb-image] connect-monetdb][connect-monetdb-url] A MonetDB-based session store.
|
||||
[connect-monetdb-url]: https://www.npmjs.com/package/connect-monetdb
|
||||
[connect-monetdb-image]: https://img.shields.io/github/stars/MonetDB/npm-connect-monetdb.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-mongo-image] connect-mongo][connect-mongo-url] A MongoDB-based session store.
|
||||
[connect-mongo-url]: https://www.npmjs.com/package/connect-mongo
|
||||
[connect-mongo-image]: https://img.shields.io/github/stars/kcbanner/connect-mongo.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-mongodb-session-image] connect-mongodb-session][connect-mongodb-session-url] Lightweight MongoDB-based session store built and maintained by MongoDB.
|
||||
[connect-mongodb-session-url]: https://www.npmjs.com/package/connect-mongodb-session
|
||||
[connect-mongodb-session-image]: https://img.shields.io/github/stars/mongodb-js/connect-mongodb-session.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-pg-simple-image] connect-pg-simple][connect-pg-simple-url] A PostgreSQL-based session store.
|
||||
[connect-pg-simple-url]: https://www.npmjs.com/package/connect-pg-simple
|
||||
[connect-pg-simple-image]: https://img.shields.io/github/stars/voxpelli/node-connect-pg-simple.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-redis-image] connect-redis][connect-redis-url] A Redis-based session store.
|
||||
[connect-redis-url]: https://www.npmjs.com/package/connect-redis
|
||||
[connect-redis-image]: https://img.shields.io/github/stars/tj/connect-redis.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-memcached-image] connect-memcached][connect-memcached-url] A memcached-based session store.
|
||||
[connect-memcached-url]: https://www.npmjs.com/package/connect-memcached
|
||||
[connect-memcached-image]: https://img.shields.io/github/stars/balor/connect-memcached.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-session-knex-image] connect-session-knex][connect-session-knex-url] A session store using
|
||||
[Knex.js](http://knexjs.org/), which is a SQL query builder for PostgreSQL, MySQL, MariaDB, SQLite3, and Oracle.
|
||||
[connect-session-knex-url]: https://www.npmjs.com/package/connect-session-knex
|
||||
[connect-session-knex-image]: https://img.shields.io/github/stars/llambda/connect-session-knex.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-session-sequelize-image] connect-session-sequelize][connect-session-sequelize-url] A session store using
|
||||
[Sequelize.js](http://sequelizejs.com/), which is a Node.js / io.js ORM for PostgreSQL, MySQL, SQLite and MSSQL.
|
||||
[connect-session-sequelize-url]: https://www.npmjs.com/package/connect-session-sequelize
|
||||
[connect-session-sequelize-image]: https://img.shields.io/github/stars/mweibel/connect-session-sequelize.svg?label=%E2%98%85
|
||||
|
||||
[![★][connect-sqlite3-image] connect-sqlite3][connect-sqlite3-url] A [SQLite3](https://github.com/mapbox/node-sqlite3) session store modeled after the TJ's `connect-redis` store.
|
||||
[connect-sqlite3-url]: https://www.npmjs.com/package/connect-sqlite3
|
||||
[connect-sqlite3-image]: https://img.shields.io/github/stars/rawberg/connect-sqlite3.svg?label=%E2%98%85
|
||||
|
||||
[![★][express-nedb-session-image] express-nedb-session][express-nedb-session-url] A NeDB-based session store.
|
||||
[express-nedb-session-url]: https://www.npmjs.com/package/express-nedb-session
|
||||
[express-nedb-session-image]: https://img.shields.io/github/stars/louischatriot/express-nedb-session.svg?label=%E2%98%85
|
||||
|
||||
[![★][level-session-store-image] level-session-store][level-session-store-url] A LevelDB-based session store.
|
||||
[level-session-store-url]: https://www.npmjs.com/package/level-session-store
|
||||
[level-session-store-image]: https://img.shields.io/github/stars/scriptollc/level-session-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][mssql-session-store-image] mssql-session-store][mssql-session-store-url] A SQL Server-based session store.
|
||||
[mssql-session-store-url]: https://www.npmjs.com/package/mssql-session-store
|
||||
[mssql-session-store-image]: https://img.shields.io/github/stars/jwathen/mssql-session-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][nedb-session-store-image] nedb-session-store][nedb-session-store-url] An alternate NeDB-based (either in-memory or file-persisted) session store.
|
||||
[nedb-session-store-url]: https://www.npmjs.com/package/nedb-session-store
|
||||
[nedb-session-store-image]: https://img.shields.io/github/stars/JamesMGreene/nedb-session-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][sequelstore-connect-image] sequelstore-connect][sequelstore-connect-url] A session store using [Sequelize.js](http://sequelizejs.com/).
|
||||
[sequelstore-connect-url]: https://www.npmjs.com/package/sequelstore-connect
|
||||
[sequelstore-connect-image]: https://img.shields.io/github/stars/MattMcFarland/sequelstore-connect.svg?label=%E2%98%85
|
||||
|
||||
[![★][session-file-store-image] session-file-store][session-file-store-url] A file system-based session store.
|
||||
[session-file-store-url]: https://www.npmjs.com/package/session-file-store
|
||||
[session-file-store-image]: https://img.shields.io/github/stars/valery-barysok/session-file-store.svg?label=%E2%98%85
|
||||
|
||||
[![★][session-rethinkdb-image] session-rethinkdb][session-rethinkdb-url] A [RethinkDB](http://rethinkdb.com/)-based session store.
|
||||
[session-rethinkdb-url]: https://www.npmjs.com/package/session-rethinkdb
|
||||
[session-rethinkdb-image]: https://img.shields.io/github/stars/llambda/session-rethinkdb.svg?label=%E2%98%85
|
||||
|
||||
## Example
|
||||
|
||||
A simple example using `express-session` to store page views for a user.
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var parseurl = require('parseurl')
|
||||
var session = require('express-session')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(session({
|
||||
secret: 'keyboard cat',
|
||||
resave: false,
|
||||
saveUninitialized: true
|
||||
}))
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
var views = req.session.views
|
||||
|
||||
if (!views) {
|
||||
views = req.session.views = {}
|
||||
}
|
||||
|
||||
// get the url pathname
|
||||
var pathname = parseurl(req).pathname
|
||||
|
||||
// count the views
|
||||
views[pathname] = (views[pathname] || 0) + 1
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
app.get('/foo', function (req, res, next) {
|
||||
res.send('you viewed this page ' + req.session.views['/foo'] + ' times')
|
||||
})
|
||||
|
||||
app.get('/bar', function (req, res, next) {
|
||||
res.send('you viewed this page ' + req.session.views['/bar'] + ' times')
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/express-session.svg
|
||||
[npm-url]: https://npmjs.org/package/express-session
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/session/master.svg
|
||||
[travis-url]: https://travis-ci.org/expressjs/session
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/session/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/session?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/express-session.svg
|
||||
[downloads-url]: https://npmjs.org/package/express-session
|
||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
||||
[gratipay-url]: https://gratipay.com/dougwilson/
|
||||
606
node_modules/express-session/index.js
generated
vendored
Normal file
606
node_modules/express-session/index.js
generated
vendored
Normal file
@@ -0,0 +1,606 @@
|
||||
/*!
|
||||
* express-session
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var cookie = require('cookie');
|
||||
var crc = require('crc').crc32;
|
||||
var debug = require('debug')('express-session');
|
||||
var deprecate = require('depd')('express-session');
|
||||
var parseUrl = require('parseurl');
|
||||
var uid = require('uid-safe').sync
|
||||
, onHeaders = require('on-headers')
|
||||
, signature = require('cookie-signature')
|
||||
|
||||
var Session = require('./session/session')
|
||||
, MemoryStore = require('./session/memory')
|
||||
, Cookie = require('./session/cookie')
|
||||
, Store = require('./session/store')
|
||||
|
||||
// environment
|
||||
|
||||
var env = process.env.NODE_ENV;
|
||||
|
||||
/**
|
||||
* Expose the middleware.
|
||||
*/
|
||||
|
||||
exports = module.exports = session;
|
||||
|
||||
/**
|
||||
* Expose constructors.
|
||||
*/
|
||||
|
||||
exports.Store = Store;
|
||||
exports.Cookie = Cookie;
|
||||
exports.Session = Session;
|
||||
exports.MemoryStore = MemoryStore;
|
||||
|
||||
/**
|
||||
* Warning message for `MemoryStore` usage in production.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var warning = 'Warning: connect.session() MemoryStore is not\n'
|
||||
+ 'designed for a production environment, as it will leak\n'
|
||||
+ 'memory, and will not scale past a single process.';
|
||||
|
||||
/**
|
||||
* Node.js 0.8+ async implementation.
|
||||
* @private
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Setup session store with the given `options`.
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {Object} [options.cookie] Options for cookie
|
||||
* @param {Function} [options.genid]
|
||||
* @param {String} [options.name=connect.sid] Session ID cookie name
|
||||
* @param {Boolean} [options.proxy]
|
||||
* @param {Boolean} [options.resave] Resave unmodified sessions back to the store
|
||||
* @param {Boolean} [options.rolling] Enable/disable rolling session expiration
|
||||
* @param {Boolean} [options.saveUninitialized] Save uninitialized sessions to the store
|
||||
* @param {String|Array} [options.secret] Secret for signing session ID
|
||||
* @param {Object} [options.store=MemoryStore] Session store
|
||||
* @param {String} [options.unset]
|
||||
* @return {Function} middleware
|
||||
* @public
|
||||
*/
|
||||
|
||||
function session(options){
|
||||
var options = options || {}
|
||||
// name - previously "options.key"
|
||||
, name = options.name || options.key || 'connect.sid'
|
||||
, store = options.store || new MemoryStore
|
||||
, trustProxy = options.proxy
|
||||
, storeReady = true
|
||||
, rollingSessions = options.rolling || false;
|
||||
var cookieOptions = options.cookie || {};
|
||||
var resaveSession = options.resave;
|
||||
var saveUninitializedSession = options.saveUninitialized;
|
||||
var secret = options.secret;
|
||||
|
||||
var generateId = options.genid || generateSessionId;
|
||||
|
||||
if (typeof generateId !== 'function') {
|
||||
throw new TypeError('genid option must be a function');
|
||||
}
|
||||
|
||||
if (resaveSession === undefined) {
|
||||
deprecate('undefined resave option; provide resave option');
|
||||
resaveSession = true;
|
||||
}
|
||||
|
||||
if (saveUninitializedSession === undefined) {
|
||||
deprecate('undefined saveUninitialized option; provide saveUninitialized option');
|
||||
saveUninitializedSession = true;
|
||||
}
|
||||
|
||||
if (options.unset && options.unset !== 'destroy' && options.unset !== 'keep') {
|
||||
throw new TypeError('unset option must be "destroy" or "keep"');
|
||||
}
|
||||
|
||||
// TODO: switch to "destroy" on next major
|
||||
var unsetDestroy = options.unset === 'destroy';
|
||||
|
||||
if (Array.isArray(secret) && secret.length === 0) {
|
||||
throw new TypeError('secret option array must contain one or more strings');
|
||||
}
|
||||
|
||||
if (secret && !Array.isArray(secret)) {
|
||||
secret = [secret];
|
||||
}
|
||||
|
||||
if (!secret) {
|
||||
deprecate('req.secret; provide secret option');
|
||||
}
|
||||
|
||||
// notify user that this store is not
|
||||
// meant for a production environment
|
||||
if ('production' == env && store instanceof MemoryStore) {
|
||||
console.warn(warning);
|
||||
}
|
||||
|
||||
// generates the new session
|
||||
store.generate = function(req){
|
||||
req.sessionID = generateId(req);
|
||||
req.session = new Session(req);
|
||||
req.session.cookie = new Cookie(cookieOptions);
|
||||
|
||||
if (cookieOptions.secure === 'auto') {
|
||||
req.session.cookie.secure = issecure(req, trustProxy);
|
||||
}
|
||||
};
|
||||
|
||||
var storeImplementsTouch = typeof store.touch === 'function';
|
||||
store.on('disconnect', function(){ storeReady = false; });
|
||||
store.on('connect', function(){ storeReady = true; });
|
||||
|
||||
return function session(req, res, next) {
|
||||
// self-awareness
|
||||
if (req.session) return next();
|
||||
|
||||
// Handle connection as if there is no session if
|
||||
// the store has temporarily disconnected etc
|
||||
if (!storeReady) return debug('store is disconnected'), next();
|
||||
|
||||
// pathname mismatch
|
||||
var originalPath = parseUrl.original(req).pathname;
|
||||
if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next();
|
||||
|
||||
// ensure a secret is available or bail
|
||||
if (!secret && !req.secret) {
|
||||
next(new Error('secret option required for sessions'));
|
||||
return;
|
||||
}
|
||||
|
||||
// backwards compatibility for signed cookies
|
||||
// req.secret is passed from the cookie parser middleware
|
||||
var secrets = secret || [req.secret];
|
||||
|
||||
var originalHash;
|
||||
var originalId;
|
||||
var savedHash;
|
||||
|
||||
// expose store
|
||||
req.sessionStore = store;
|
||||
|
||||
// get the session ID from the cookie
|
||||
var cookieId = req.sessionID = getcookie(req, name, secrets);
|
||||
|
||||
// set-cookie
|
||||
onHeaders(res, function(){
|
||||
if (!req.session) {
|
||||
debug('no session');
|
||||
return;
|
||||
}
|
||||
|
||||
var cookie = req.session.cookie;
|
||||
|
||||
// only send secure cookies via https
|
||||
if (cookie.secure && !issecure(req, trustProxy)) {
|
||||
debug('not secured');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldSetCookie(req)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setcookie(res, name, req.sessionID, secrets[0], cookie.data);
|
||||
});
|
||||
|
||||
// proxy end() to commit the session
|
||||
var _end = res.end;
|
||||
var _write = res.write;
|
||||
var ended = false;
|
||||
res.end = function end(chunk, encoding) {
|
||||
if (ended) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ended = true;
|
||||
|
||||
var ret;
|
||||
var sync = true;
|
||||
|
||||
function writeend() {
|
||||
if (sync) {
|
||||
ret = _end.call(res, chunk, encoding);
|
||||
sync = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_end.call(res);
|
||||
}
|
||||
|
||||
function writetop() {
|
||||
if (!sync) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (chunk == null) {
|
||||
ret = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
var contentLength = Number(res.getHeader('Content-Length'));
|
||||
|
||||
if (!isNaN(contentLength) && contentLength > 0) {
|
||||
// measure chunk
|
||||
chunk = !Buffer.isBuffer(chunk)
|
||||
? new Buffer(chunk, encoding)
|
||||
: chunk;
|
||||
encoding = undefined;
|
||||
|
||||
if (chunk.length !== 0) {
|
||||
debug('split response');
|
||||
ret = _write.call(res, chunk.slice(0, chunk.length - 1));
|
||||
chunk = chunk.slice(chunk.length - 1, chunk.length);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = _write.call(res, chunk, encoding);
|
||||
sync = false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (shouldDestroy(req)) {
|
||||
// destroy session
|
||||
debug('destroying');
|
||||
store.destroy(req.sessionID, function ondestroy(err) {
|
||||
if (err) {
|
||||
defer(next, err);
|
||||
}
|
||||
|
||||
debug('destroyed');
|
||||
writeend();
|
||||
});
|
||||
|
||||
return writetop();
|
||||
}
|
||||
|
||||
// no session to save
|
||||
if (!req.session) {
|
||||
debug('no session');
|
||||
return _end.call(res, chunk, encoding);
|
||||
}
|
||||
|
||||
// touch session
|
||||
req.session.touch();
|
||||
|
||||
if (shouldSave(req)) {
|
||||
req.session.save(function onsave(err) {
|
||||
if (err) {
|
||||
defer(next, err);
|
||||
}
|
||||
|
||||
writeend();
|
||||
});
|
||||
|
||||
return writetop();
|
||||
} else if (storeImplementsTouch && shouldTouch(req)) {
|
||||
// store implements touch method
|
||||
debug('touching');
|
||||
store.touch(req.sessionID, req.session, function ontouch(err) {
|
||||
if (err) {
|
||||
defer(next, err);
|
||||
}
|
||||
|
||||
debug('touched');
|
||||
writeend();
|
||||
});
|
||||
|
||||
return writetop();
|
||||
}
|
||||
|
||||
return _end.call(res, chunk, encoding);
|
||||
};
|
||||
|
||||
// generate the session
|
||||
function generate() {
|
||||
store.generate(req);
|
||||
originalId = req.sessionID;
|
||||
originalHash = hash(req.session);
|
||||
wrapmethods(req.session);
|
||||
}
|
||||
|
||||
// wrap session methods
|
||||
function wrapmethods(sess) {
|
||||
var _save = sess.save;
|
||||
|
||||
function save() {
|
||||
debug('saving %s', this.id);
|
||||
savedHash = hash(this);
|
||||
_save.apply(this, arguments);
|
||||
}
|
||||
|
||||
Object.defineProperty(sess, 'save', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: save,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
|
||||
// check if session has been modified
|
||||
function isModified(sess) {
|
||||
return originalId !== sess.id || originalHash !== hash(sess);
|
||||
}
|
||||
|
||||
// check if session has been saved
|
||||
function isSaved(sess) {
|
||||
return originalId === sess.id && savedHash === hash(sess);
|
||||
}
|
||||
|
||||
// determine if session should be destroyed
|
||||
function shouldDestroy(req) {
|
||||
return req.sessionID && unsetDestroy && req.session == null;
|
||||
}
|
||||
|
||||
// determine if session should be saved to store
|
||||
function shouldSave(req) {
|
||||
// cannot set cookie without a session ID
|
||||
if (typeof req.sessionID !== 'string') {
|
||||
debug('session ignored because of bogus req.sessionID %o', req.sessionID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return !saveUninitializedSession && cookieId !== req.sessionID
|
||||
? isModified(req.session)
|
||||
: !isSaved(req.session)
|
||||
}
|
||||
|
||||
// determine if session should be touched
|
||||
function shouldTouch(req) {
|
||||
// cannot set cookie without a session ID
|
||||
if (typeof req.sessionID !== 'string') {
|
||||
debug('session ignored because of bogus req.sessionID %o', req.sessionID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return cookieId === req.sessionID && !shouldSave(req);
|
||||
}
|
||||
|
||||
// determine if cookie should be set on response
|
||||
function shouldSetCookie(req) {
|
||||
// cannot set cookie without a session ID
|
||||
if (typeof req.sessionID !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cookieId != req.sessionID
|
||||
? saveUninitializedSession || isModified(req.session)
|
||||
: rollingSessions || req.session.cookie.expires != null && isModified(req.session);
|
||||
}
|
||||
|
||||
// generate a session if the browser doesn't send a sessionID
|
||||
if (!req.sessionID) {
|
||||
debug('no SID sent, generating session');
|
||||
generate();
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
// generate the session object
|
||||
debug('fetching %s', req.sessionID);
|
||||
store.get(req.sessionID, function(err, sess){
|
||||
// error handling
|
||||
if (err) {
|
||||
debug('error %j', err);
|
||||
|
||||
if (err.code !== 'ENOENT') {
|
||||
next(err);
|
||||
return;
|
||||
}
|
||||
|
||||
generate();
|
||||
// no session
|
||||
} else if (!sess) {
|
||||
debug('no session found');
|
||||
generate();
|
||||
// populate req.session
|
||||
} else {
|
||||
debug('session found');
|
||||
store.createSession(req, sess);
|
||||
originalId = req.sessionID;
|
||||
originalHash = hash(sess);
|
||||
|
||||
if (!resaveSession) {
|
||||
savedHash = originalHash
|
||||
}
|
||||
|
||||
wrapmethods(req.session);
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a session ID for a new session.
|
||||
*
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function generateSessionId(sess) {
|
||||
return uid(24);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the session ID cookie from request.
|
||||
*
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getcookie(req, name, secrets) {
|
||||
var header = req.headers.cookie;
|
||||
var raw;
|
||||
var val;
|
||||
|
||||
// read from cookie header
|
||||
if (header) {
|
||||
var cookies = cookie.parse(header);
|
||||
|
||||
raw = cookies[name];
|
||||
|
||||
if (raw) {
|
||||
if (raw.substr(0, 2) === 's:') {
|
||||
val = unsigncookie(raw.slice(2), secrets);
|
||||
|
||||
if (val === false) {
|
||||
debug('cookie signature invalid');
|
||||
val = undefined;
|
||||
}
|
||||
} else {
|
||||
debug('cookie unsigned')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// back-compat read from cookieParser() signedCookies data
|
||||
if (!val && req.signedCookies) {
|
||||
val = req.signedCookies[name];
|
||||
|
||||
if (val) {
|
||||
deprecate('cookie should be available in req.headers.cookie');
|
||||
}
|
||||
}
|
||||
|
||||
// back-compat read from cookieParser() cookies data
|
||||
if (!val && req.cookies) {
|
||||
raw = req.cookies[name];
|
||||
|
||||
if (raw) {
|
||||
if (raw.substr(0, 2) === 's:') {
|
||||
val = unsigncookie(raw.slice(2), secrets);
|
||||
|
||||
if (val) {
|
||||
deprecate('cookie should be available in req.headers.cookie');
|
||||
}
|
||||
|
||||
if (val === false) {
|
||||
debug('cookie signature invalid');
|
||||
val = undefined;
|
||||
}
|
||||
} else {
|
||||
debug('cookie unsigned')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash the given `sess` object omitting changes to `.cookie`.
|
||||
*
|
||||
* @param {Object} sess
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function hash(sess) {
|
||||
return crc(JSON.stringify(sess, function (key, val) {
|
||||
if (key !== 'cookie') {
|
||||
return val;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if request is secure.
|
||||
*
|
||||
* @param {Object} req
|
||||
* @param {Boolean} [trustProxy]
|
||||
* @return {Boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function issecure(req, trustProxy) {
|
||||
// socket is https server
|
||||
if (req.connection && req.connection.encrypted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// do not trust proxy
|
||||
if (trustProxy === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// no explicit trust; try req.secure from express
|
||||
if (trustProxy !== true) {
|
||||
var secure = req.secure;
|
||||
return typeof secure === 'boolean'
|
||||
? secure
|
||||
: false;
|
||||
}
|
||||
|
||||
// read the proto from x-forwarded-proto header
|
||||
var header = req.headers['x-forwarded-proto'] || '';
|
||||
var index = header.indexOf(',');
|
||||
var proto = index !== -1
|
||||
? header.substr(0, index).toLowerCase().trim()
|
||||
: header.toLowerCase().trim()
|
||||
|
||||
return proto === 'https';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cookie on response.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
|
||||
function setcookie(res, name, val, secret, options) {
|
||||
var signed = 's:' + signature.sign(val, secret);
|
||||
var data = cookie.serialize(name, signed, options);
|
||||
|
||||
debug('set-cookie %s', data);
|
||||
|
||||
var prev = res.getHeader('set-cookie') || [];
|
||||
var header = Array.isArray(prev) ? prev.concat(data)
|
||||
: Array.isArray(data) ? [prev].concat(data)
|
||||
: [prev, data];
|
||||
|
||||
res.setHeader('set-cookie', header)
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify and decode the given `val` with `secrets`.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {Array} secrets
|
||||
* @returns {String|Boolean}
|
||||
* @private
|
||||
*/
|
||||
function unsigncookie(val, secrets) {
|
||||
for (var i = 0; i < secrets.length; i++) {
|
||||
var result = signature.unsign(val, secrets[i]);
|
||||
|
||||
if (result !== false) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
97
node_modules/express-session/node_modules/cookie/HISTORY.md
generated
vendored
Normal file
97
node_modules/express-session/node_modules/cookie/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
0.2.3 / 2015-10-25
|
||||
==================
|
||||
|
||||
* Fix cookie `Max-Age` to never be a floating point number
|
||||
|
||||
0.2.2 / 2015-09-17
|
||||
==================
|
||||
|
||||
* Fix regression when setting empty cookie value
|
||||
- Ease the new restriction, which is just basic header-level validation
|
||||
* Fix typo in invalid value errors
|
||||
|
||||
0.2.1 / 2015-09-17
|
||||
==================
|
||||
|
||||
* Throw on invalid values provided to `serialize`
|
||||
- Ensures the resulting string is a valid HTTP header value
|
||||
|
||||
0.2.0 / 2015-08-13
|
||||
==================
|
||||
|
||||
* Add `firstPartyOnly` option
|
||||
* Throw better error for invalid argument to parse
|
||||
* perf: hoist regular expression
|
||||
|
||||
0.1.5 / 2015-09-17
|
||||
==================
|
||||
|
||||
* Fix regression when setting empty cookie value
|
||||
- Ease the new restriction, which is just basic header-level validation
|
||||
* Fix typo in invalid value errors
|
||||
|
||||
0.1.4 / 2015-09-17
|
||||
==================
|
||||
|
||||
* Throw better error for invalid argument to parse
|
||||
* Throw on invalid values provided to `serialize`
|
||||
- Ensures the resulting string is a valid HTTP header value
|
||||
|
||||
0.1.3 / 2015-05-19
|
||||
==================
|
||||
|
||||
* Reduce the scope of try-catch deopt
|
||||
* Remove argument reassignments
|
||||
|
||||
0.1.2 / 2014-04-16
|
||||
==================
|
||||
|
||||
* Remove unnecessary files from npm package
|
||||
|
||||
0.1.1 / 2014-02-23
|
||||
==================
|
||||
|
||||
* Fix bad parse when cookie value contained a comma
|
||||
* Fix support for `maxAge` of `0`
|
||||
|
||||
0.1.0 / 2013-05-01
|
||||
==================
|
||||
|
||||
* Add `decode` option
|
||||
* Add `encode` option
|
||||
|
||||
0.0.6 / 2013-04-08
|
||||
==================
|
||||
|
||||
* Ignore cookie parts missing `=`
|
||||
|
||||
0.0.5 / 2012-10-29
|
||||
==================
|
||||
|
||||
* Return raw cookie value if value unescape errors
|
||||
|
||||
0.0.4 / 2012-06-21
|
||||
==================
|
||||
|
||||
* Use encode/decodeURIComponent for cookie encoding/decoding
|
||||
- Improve server/client interoperability
|
||||
|
||||
0.0.3 / 2012-06-06
|
||||
==================
|
||||
|
||||
* Only escape special characters per the cookie RFC
|
||||
|
||||
0.0.2 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Fix `maxAge` option to not throw error
|
||||
|
||||
0.0.1 / 2012-05-28
|
||||
==================
|
||||
|
||||
* Add more tests
|
||||
|
||||
0.0.0 / 2012-05-28
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
24
node_modules/express-session/node_modules/cookie/LICENSE
generated
vendored
Normal file
24
node_modules/express-session/node_modules/cookie/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.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.
|
||||
|
||||
67
node_modules/express-session/node_modules/cookie/README.md
generated
vendored
Normal file
67
node_modules/express-session/node_modules/cookie/README.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# cookie
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.
|
||||
|
||||
See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.
|
||||
|
||||
## how?
|
||||
|
||||
```
|
||||
npm install cookie
|
||||
```
|
||||
|
||||
```javascript
|
||||
var cookie = require('cookie');
|
||||
|
||||
var hdr = cookie.serialize('foo', 'bar');
|
||||
// hdr = 'foo=bar';
|
||||
|
||||
var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
|
||||
// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };
|
||||
```
|
||||
|
||||
## more
|
||||
|
||||
The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.
|
||||
|
||||
### path
|
||||
> cookie path
|
||||
|
||||
### expires
|
||||
> absolute expiration date for the cookie (Date object)
|
||||
|
||||
### maxAge
|
||||
> relative max age of the cookie from when the client receives it (seconds)
|
||||
|
||||
### domain
|
||||
> domain for the cookie
|
||||
|
||||
### secure
|
||||
> true or false
|
||||
|
||||
### httpOnly
|
||||
> true or false
|
||||
|
||||
### firstPartyOnly
|
||||
> true or false
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/cookie.svg
|
||||
[npm-url]: https://npmjs.org/package/cookie
|
||||
[node-version-image]: https://img.shields.io/node/v/cookie.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/cookie/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/cookie
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/cookie/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/cookie.svg
|
||||
[downloads-url]: https://npmjs.org/package/cookie
|
||||
158
node_modules/express-session/node_modules/cookie/index.js
generated
vendored
Normal file
158
node_modules/express-session/node_modules/cookie/index.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
/*!
|
||||
* cookie
|
||||
* Copyright(c) 2012-2014 Roman Shtylman
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.parse = parse;
|
||||
exports.serialize = serialize;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var decode = decodeURIComponent;
|
||||
var encode = encodeURIComponent;
|
||||
var pairSplitRegExp = /; */;
|
||||
|
||||
/**
|
||||
* RegExp to match field-content in RFC 7230 sec 3.2
|
||||
*
|
||||
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
||||
* field-vchar = VCHAR / obs-text
|
||||
* obs-text = %x80-FF
|
||||
*/
|
||||
|
||||
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
||||
|
||||
/**
|
||||
* Parse a cookie header.
|
||||
*
|
||||
* Parse the given cookie header string into an object
|
||||
* The object has the various cookies as keys(names) => values
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {object} [options]
|
||||
* @return {object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse(str, options) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('argument str must be a string');
|
||||
}
|
||||
|
||||
var obj = {}
|
||||
var opt = options || {};
|
||||
var pairs = str.split(pairSplitRegExp);
|
||||
var dec = opt.decode || decode;
|
||||
|
||||
pairs.forEach(function(pair) {
|
||||
var eq_idx = pair.indexOf('=')
|
||||
|
||||
// skip things that don't look like key=value
|
||||
if (eq_idx < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = pair.substr(0, eq_idx).trim()
|
||||
var val = pair.substr(++eq_idx, pair.length).trim();
|
||||
|
||||
// quoted values
|
||||
if ('"' == val[0]) {
|
||||
val = val.slice(1, -1);
|
||||
}
|
||||
|
||||
// only assign once
|
||||
if (undefined == obj[key]) {
|
||||
obj[key] = tryDecode(val, dec);
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data into a cookie header.
|
||||
*
|
||||
* Serialize the a name value pair into a cookie string suitable for
|
||||
* http headers. An optional options object specified cookie parameters.
|
||||
*
|
||||
* serialize('foo', 'bar', { httpOnly: true })
|
||||
* => "foo=bar; httpOnly"
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} val
|
||||
* @param {object} [options]
|
||||
* @return {string}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function serialize(name, val, options) {
|
||||
var opt = options || {};
|
||||
var enc = opt.encode || encode;
|
||||
|
||||
if (!fieldContentRegExp.test(name)) {
|
||||
throw new TypeError('argument name is invalid');
|
||||
}
|
||||
|
||||
var value = enc(val);
|
||||
|
||||
if (value && !fieldContentRegExp.test(value)) {
|
||||
throw new TypeError('argument val is invalid');
|
||||
}
|
||||
|
||||
var pairs = [name + '=' + value];
|
||||
|
||||
if (null != opt.maxAge) {
|
||||
var maxAge = opt.maxAge - 0;
|
||||
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
||||
pairs.push('Max-Age=' + Math.floor(maxAge));
|
||||
}
|
||||
|
||||
if (opt.domain) {
|
||||
if (!fieldContentRegExp.test(opt.domain)) {
|
||||
throw new TypeError('option domain is invalid');
|
||||
}
|
||||
|
||||
pairs.push('Domain=' + opt.domain);
|
||||
}
|
||||
|
||||
if (opt.path) {
|
||||
if (!fieldContentRegExp.test(opt.path)) {
|
||||
throw new TypeError('option path is invalid');
|
||||
}
|
||||
|
||||
pairs.push('Path=' + opt.path);
|
||||
}
|
||||
|
||||
if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString());
|
||||
if (opt.httpOnly) pairs.push('HttpOnly');
|
||||
if (opt.secure) pairs.push('Secure');
|
||||
if (opt.firstPartyOnly) pairs.push('First-Party-Only');
|
||||
|
||||
return pairs.join('; ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Try decoding a string using a decoding function.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {function} decode
|
||||
* @private
|
||||
*/
|
||||
|
||||
function tryDecode(str, decode) {
|
||||
try {
|
||||
return decode(str);
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
102
node_modules/express-session/node_modules/cookie/package.json
generated
vendored
Normal file
102
node_modules/express-session/node_modules/cookie/package.json
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"cookie@0.2.3",
|
||||
"L:\\Git\\repos\\html5-restaurant\\node_modules\\express-session"
|
||||
]
|
||||
],
|
||||
"_from": "cookie@0.2.3",
|
||||
"_id": "cookie@0.2.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/express-session/cookie",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "cookie",
|
||||
"raw": "cookie@0.2.3",
|
||||
"rawSpec": "0.2.3",
|
||||
"scope": null,
|
||||
"spec": "0.2.3",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/express-session"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.2.3.tgz",
|
||||
"_shasum": "1a59536af68537a21178a01346f87cb059d2ae5c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cookie@0.2.3",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant\\node_modules\\express-session",
|
||||
"author": {
|
||||
"email": "shtylman@gmail.com",
|
||||
"name": "Roman Shtylman"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/cookie/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "cookie parsing and serialization",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.22",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "1a59536af68537a21178a01346f87cb059d2ae5c",
|
||||
"tarball": "http://registry.npmjs.org/cookie/-/cookie-0.2.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "35326af88e9665bb8ea1be280cb827523e9360a7",
|
||||
"homepage": "https://github.com/jshttp/cookie",
|
||||
"keywords": [
|
||||
"cookie",
|
||||
"cookies"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "cookie",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/cookie.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
||||
},
|
||||
"version": "0.2.3"
|
||||
}
|
||||
117
node_modules/express-session/package.json
generated
vendored
Normal file
117
node_modules/express-session/package.json
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"express-session",
|
||||
"L:\\Git\\repos\\html5-restaurant"
|
||||
]
|
||||
],
|
||||
"_from": "express-session@latest",
|
||||
"_id": "express-session@1.13.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/express-session",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "express-session",
|
||||
"raw": "express-session",
|
||||
"rawSpec": "",
|
||||
"scope": null,
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/express-session/-/express-session-1.13.0.tgz",
|
||||
"_shasum": "8ac3b5c0188b48382851d88207b8e7746efb4011",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "express-session",
|
||||
"_where": "L:\\Git\\repos\\html5-restaurant",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/session/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Joe Wagner",
|
||||
"email": "njwjs722@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"cookie": "0.2.3",
|
||||
"cookie-signature": "1.0.6",
|
||||
"crc": "3.4.0",
|
||||
"debug": "~2.2.0",
|
||||
"depd": "~1.1.0",
|
||||
"on-headers": "~1.0.1",
|
||||
"parseurl": "~1.3.0",
|
||||
"uid-safe": "~2.0.0",
|
||||
"utils-merge": "1.0.0"
|
||||
},
|
||||
"description": "Simple session middleware for Express",
|
||||
"devDependencies": {
|
||||
"after": "0.8.1",
|
||||
"cookie-parser": "~1.4.0",
|
||||
"express": "~4.13.3",
|
||||
"istanbul": "0.4.1",
|
||||
"mocha": "2.3.4",
|
||||
"supertest": "1.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8ac3b5c0188b48382851d88207b8e7746efb4011",
|
||||
"tarball": "http://registry.npmjs.org/express-session/-/express-session-1.13.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"session/"
|
||||
],
|
||||
"gitHead": "222b30ddeb9589ec700ae53b4e70b47a95114b77",
|
||||
"homepage": "https://github.com/expressjs/session",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "mscdex",
|
||||
"email": "mscdex@mscdex.net"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "express-session",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/session.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --bail --reporter spec test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/"
|
||||
},
|
||||
"version": "1.13.0"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user