Socket
Socket
Sign inDemoInstall

parsehttpdate

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsehttpdate - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

15

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc