parsehttpdate
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "parsehttpdate", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Parses the value of the Date header in HTTP responses.", | ||
"keywords": ["http", "dates", "date", "last-modified"], | ||
"keywords": [ | ||
"http", | ||
"dates", | ||
"date", | ||
"last-modified" | ||
], | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/Pimm/parseHttpDate.git" | ||
"type": "git", | ||
"url": "https://github.com/Pimm/parseHttpDate.git" | ||
}, | ||
@@ -17,4 +22,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"jest": "^23.5.0" | ||
"jest": "^23.6.0" | ||
} | ||
} |
@@ -38,2 +38,22 @@ # parseHttpDate | ||
Dit is hetzelfde voorbeeld met een [async-functie](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function): | ||
```javascript | ||
import parseHttpDate from 'parsehttpdate'; | ||
async function getServerDate() { | ||
const {headers} = await fetch('/'); | ||
if (headers.has('Date')) { | ||
return parseHttpDate(headers.get('Date')); | ||
} else /* if (false == headers.has('Date')) */ { | ||
throw new Error('The response lacks a Date header'); | ||
} | ||
} | ||
getServerDate() | ||
.then(date => { | ||
console.log(date.toTimeString()); | ||
}); | ||
``` | ||
### Geavanceerd gebruik | ||
@@ -40,0 +60,0 @@ |
@@ -38,2 +38,22 @@ # parseHttpDate | ||
This is the same example using an [async function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function): | ||
```javascript | ||
import parseHttpDate from 'parsehttpdate'; | ||
async function getServerDate() { | ||
const {headers} = await fetch('/'); | ||
if (headers.has('Date')) { | ||
return parseHttpDate(headers.get('Date')); | ||
} else /* if (false == headers.has('Date')) */ { | ||
throw new Error('The response lacks a Date header'); | ||
} | ||
} | ||
getServerDate() | ||
.then(date => { | ||
console.log(date.toTimeString()); | ||
}); | ||
``` | ||
### Advanced usage | ||
@@ -40,0 +60,0 @@ |
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
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
13070
88