Comparing version 3.1.1 to 4.0.0
@@ -38,3 +38,3 @@ 'use strict'; | ||
if (path.endsWith('.csv')) { | ||
request.setUrl(`${path.substring(0, path.length - 4)}${request.url.search}`); | ||
request.setUrl(`${path.substring(0, path.length - 4)}${request.url.search ? request.url.search : ''}`); | ||
request.headers.accept = 'text/csv'; | ||
@@ -61,5 +61,5 @@ } | ||
const result = allowedTypesRegex.exec(request.headers.accept); | ||
const preferedType = result && result[0]; | ||
const preferredType = result && result[0]; | ||
if (!(preferedType && internals.routeMap.has(internals.createRouteMethodString(request.route.path, request.route.method)))) { | ||
if (!(preferredType && internals.routeMap.has(internals.createRouteMethodString(request.route.path, request.route.method)))) { | ||
return reply.continue(); | ||
@@ -95,5 +95,5 @@ } | ||
// var response = reply(csv); | ||
// response.type(`${preferedType}; charset=${response.settings.charset}; header=present;`); | ||
// response.type(`${preferredType}; charset=${response.settings.charset}; header=present;`); | ||
return reply(csv).type(preferedType).header('content-disposition', 'attachment;'); | ||
return reply(csv).type(preferredType).header('content-disposition', 'attachment;'); | ||
}); | ||
@@ -261,3 +261,3 @@ }); | ||
else { | ||
temp = internals.dateToISOstring(temp); | ||
temp = internals.dateToISOString(temp); | ||
dataRow += `"${internals.escapeQuotesInString(temp)}"`; | ||
@@ -284,10 +284,9 @@ } | ||
internals.dateToISOstring = (str) => { | ||
internals.dateToISOString = (str) => { | ||
if (str instanceof Date) { | ||
if (str instanceof Date) { | ||
return str.toISOString(); | ||
} | ||
return str.toISOString(); | ||
} | ||
return str; | ||
return str; | ||
}; | ||
@@ -294,0 +293,0 @@ |
{ | ||
"name": "hapi-csv", | ||
"version": "3.1.1", | ||
"version": "4.0.0", | ||
"description": "Hapi plugin for converting a Joi response schema and dataset to csv", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "lab -a code -vL --lint-fix -t 100", | ||
"test-cov-html": "lab -a code -vL --lint-fix -t 100 -r html -o coverage.html" | ||
"test": "lab -a code -vL --lint-fix -t 100 -I URL,URLSearchParams" | ||
}, | ||
@@ -21,13 +20,13 @@ "repository": { | ||
], | ||
"author": "Kevin De Clerck", | ||
"author": "Salesflare Team", | ||
"license": "MIT", | ||
"dependencies": { | ||
"hoek": "4.x.x", | ||
"async": "^2.5.0" | ||
"async": "^2.6.0", | ||
"hoek": "5.x.x" | ||
}, | ||
"devDependencies": { | ||
"joi": "^11.0.0", | ||
"code": "4.x.x", | ||
"hapi": "16.x.x", | ||
"lab": "14.x.x" | ||
"hapi": "^16.6.3", | ||
"joi": "^13.0.0", | ||
"lab": "^14.3.4" | ||
}, | ||
@@ -38,2 +37,5 @@ "peerDependencies": { | ||
}, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"bugs": { | ||
@@ -40,0 +42,0 @@ "url": "https://github.com/Salesflare/hapi-csv/issues" |
@@ -1,2 +0,2 @@ | ||
# Hapi-csv [![Build Status](https://travis-ci.org/Salesflare/hapi-csv.svg?branch=master)](https://travis-ci.org/Salesflare/hapi-csv) | ||
# hapi-csv [![Build Status](https://travis-ci.org/Salesflare/hapi-csv.svg?branch=master)](https://travis-ci.org/Salesflare/hapi-csv) | ||
@@ -3,0 +3,0 @@ ## What |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41971
6
875
+ Addedhoek@5.0.4(transitive)
- Removedhoek@4.3.1(transitive)
Updatedasync@^2.6.0
Updatedhoek@5.x.x