Socket
Socket
Sign inDemoInstall

parsehttpdate

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

2

changelog.md

@@ -13,4 +13,4 @@ ### 1.0.0

### 1.0.3 - 1.0.5
### 1.0.3 - 1.0.6
(No changes)

@@ -1,1 +0,1 @@

'use strict';var validDateMatcher=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/,monthsNames="anebarprayunulugepctovec";function parseHttpDate(a,b){if(!1!=b&&!1==validDateMatcher.test(a))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(a.substring(12,16),10),monthsNames.indexOf(a.substring(9,11))>>1,parseInt(a.substring(5,7),10),parseInt(a.substring(17,19),10),parseInt(a.substring(20,22),10),parseInt(a.substring(23,25),10)))}module.exports=parseHttpDate;
'use strict';var validDateMatcher=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/,monthsNames="anebarprayunulugepctovec";function parseHttpDate(a,b){if(!1!=b&&!1==validDateMatcher.test(a))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(a.substring(12,16),10),monthsNames.indexOf(a.substring(9,11))>>1,parseInt(a.substring(5,7),10),parseInt(a.substring(17,19),10),parseInt(a.substring(20,22),10),parseInt(a.substring(23,25),10)))}module.exports=parseHttpDate;

@@ -1,1 +0,1 @@

var validDateMatcher=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/,monthsNames="anebarprayunulugepctovec";function parseHttpDate(a,b){if(!1!=b&&!1==validDateMatcher.test(a))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(a.substring(12,16),10),monthsNames.indexOf(a.substring(9,11))>>1,parseInt(a.substring(5,7),10),parseInt(a.substring(17,19),10),parseInt(a.substring(20,22),10),parseInt(a.substring(23,25),10)))}export default parseHttpDate;
var validDateMatcher=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/,monthsNames="anebarprayunulugepctovec";function parseHttpDate(a,b){if(!1!=b&&!1==validDateMatcher.test(a))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(a.substring(12,16),10),monthsNames.indexOf(a.substring(9,11))>>1,parseInt(a.substring(5,7),10),parseInt(a.substring(17,19),10),parseInt(a.substring(20,22),10),parseInt(a.substring(23,25),10)))}export default parseHttpDate;

@@ -1,1 +0,1 @@

var parseHttpDate=function(){'use strict';var a=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/;return function(b,c){if(!1!=c&&!1==a.test(b))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(b.substring(12,16),10),"anebarprayunulugepctovec".indexOf(b.substring(9,11))>>1,parseInt(b.substring(5,7),10),parseInt(b.substring(17,19),10),parseInt(b.substring(20,22),10),parseInt(b.substring(23,25),10)))}}();
var parseHttpDate=(function(){'use strict';var validDateMatcher=/^[A-Z][a-z]{2}, [0-3]\d (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} [0-2]\d:[0-5]\d:[0-6]\d GMT$/,monthsNames="anebarprayunulugepctovec";function parseHttpDate(a,b){if(!1!=b&&!1==validDateMatcher.test(a))throw new Error("The passed value has an unexpected format");return new Date(Date.UTC(parseInt(a.substring(12,16),10),monthsNames.indexOf(a.substring(9,11))>>1,parseInt(a.substring(5,7),10),parseInt(a.substring(17,19),10),parseInt(a.substring(20,22),10),parseInt(a.substring(23,25),10)))}return parseHttpDate;}());

@@ -7,5 +7,2 @@ /**

*
* This format is a subset of the specification used by the Internet Message Format. Note that the specification also
* defines two obsolete formats, which this implementation does not support.
*
* The second argument determines whether the passed date-time should be validated before being parsed. Not validating

@@ -12,0 +9,0 @@ * (`false`) is faster, but behaviour is undefined if the passed date-time is not formatted correctly. Validating

@@ -19,5 +19,2 @@ // (The number of seconds may start with a 6 because of leap seconds.)

*
* This format is a subset of the specification used by the Internet Message Format. Note that the specification also
* defines two obsolete formats, which this implementation does not support.
*
* The second argument determines whether the passed date-time should be validated before being parsed. Not validating

@@ -43,2 +40,2 @@ * (`false`) is faster, but behaviour is undefined if the passed date-time is not formatted correctly. Validating

));
};
}
{
"name": "parsehttpdate",
"description": "Parses the value of the Date header in HTTP responses",
"version": "1.0.5",
"version": "1.0.6",
"main": "compiled/cjs/parsehttpdate.min.js",

@@ -18,8 +18,8 @@ "module": "compiled/esm/parsehttpdate.min.js",

"devDependencies": {
"@babel/preset-env": "^7.5.5",
"jest": "^24.9.0",
"rollup": "^1.20.3",
"@babel/preset-env": "^7.8.6",
"babel-preset-minify": "^0.5.1",
"jest": "^25.1.0",
"rollup": "^1.32.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel-minify": "^9.0.0",
"typescript": "^3.6.2"
"typescript": "^3.8.3"
},

@@ -26,0 +26,0 @@ "scripts": {

@@ -5,7 +5,7 @@ Ontleedt de waarde van de `Date` header in HTTP antwoorden.

Ontleedt datum-tijdstippen van HTTP-headers zoals _Date_, _Last-Modified_, en _Expires_. Die datum-tijdstippen zijn bijna altijd opgeschreven in het aangeraden formaat [gedefinieerd door HTTP/1.1][http-1.1]. Een voorbeeld van zo een datum-tijdstip is:
Ontleedt datum-tijdstippen van HTTP-headers zoals _Date_, _Last-Modified_, en _Expires_. Een voorbeeld van zo een datum-tijdstip is:
> Tue, 15 Nov 1994 08:12:31 GMT
Dit formaat is een subgroep van de specificatie die wordt gebruikt door in het [Internet Message Format][imf].
Het formaat is [gedefinieerd door HTTP/1.1][http-1.1] (en [HTTP/1.0][http-1.0]) en is een subgroep van de specificatie die wordt gebruikt door in het [Internet Message Format][imf].

@@ -21,3 +21,3 @@ # Installatie

```html
<script src="https://unpkg.com/parsehttpdate@^1.0.5"></script>
<script src="https://unpkg.com/parsehttpdate@^1.0.6"></script>
```

@@ -40,3 +40,3 @@ Met deze aanpak wordt de functie beschikbaar als `window.parseHttpDate`.

fetch('/')
.then(({headers}) => {
.then(({ headers }) => {
if (headers.has('Date')) {

@@ -60,3 +60,3 @@ return headers.get('Date');

async function getServerDate() {
const {headers} = await fetch('/');
const { headers } = await fetch('/');
if (headers.has('Date')) {

@@ -101,3 +101,3 @@ return parseHttpDate(headers.get('Date'));

Deze bibliotheek ondersteunt deze niet.
Deze bibliotheek ondersteunt deze niet; sinds 1996 is het gebruik van het ondersteunde formaat aanbevolen. [Maak alsjeblieft een issue aan][issues] als je de overige toch nodig hebt.

@@ -115,5 +115,7 @@ ## Licentie (X11/MIT)

[http-1.1]: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
[http-1.0]: https://tools.ietf.org/html/rfc1945#section-3.3
[imf]: https://tools.ietf.org/html/rfc5322
[ecmascript-10-date-time]: http://www.ecma-international.org/ecma-262/10.0/#sec-date-time-string-format
[mdn-fetch]: https://developer.mozilla.org/docs/Web/API/Fetch_API
[mdn-async-function]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function
[mdn-async-function]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function
[issues]: https://github.com/Pimm/parseHttpDate/issues

@@ -5,7 +5,7 @@ Parses the value of the `Date` header in HTTP responses.

Parses date-times from HTTP headers such as _Date_, _Last Modified_, and _Expires_. Those date-times almost always have the preferred format [as defined by HTTP/1.1][http-1.1]. An example of such a date-time is:
Parses date-times from HTTP headers such as _Date_, _Last Modified_, and _Expires_. An example of such a date-time is:
> Tue, 15 Nov 1994 08:12:31 GMT
This format is a subset of the specification used by the [Internet Message Format][imf].
The format [is defined by HTTP/1.1][http-1.1] (and [HTTP/1.0][http-1.0]) and is a subset of the specification used by the [Internet Message Format][imf].

@@ -21,3 +21,3 @@ # Installation

```html
<script src="https://unpkg.com/parsehttpdate@^1.0.5"></script>
<script src="https://unpkg.com/parsehttpdate@^1.0.6"></script>
```

@@ -38,3 +38,3 @@ This alternative makes the function available at `window.parseHttpDate`.

fetch('/')
.then(({headers}) => {
.then(({ headers }) => {
if (headers.has('Date')) {

@@ -56,3 +56,3 @@ return headers.get('Date');

async function getServerDate() {
const {headers} = await fetch('/');
const { headers } = await fetch('/');
if (headers.has('Date')) {

@@ -97,3 +97,3 @@ return parseHttpDate(headers.get('Date'));

This library does not support those.
This library does not support those; the supported format has been the preferred one since 1996. [Please create an issue][issues] if your use case requires the others.

@@ -111,5 +111,7 @@ # License (X11/MIT)

[http-1.1]: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
[http-1.0]: https://tools.ietf.org/html/rfc1945#section-3.3
[imf]: https://tools.ietf.org/html/rfc5322
[ecmascript-10-date-time]: http://www.ecma-international.org/ecma-262/10.0/#sec-date-time-string-format
[mdn-fetch]: https://developer.mozilla.org/docs/Web/API/Fetch_API
[mdn-async-function]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function
[mdn-async-function]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function
[issues]: https://github.com/Pimm/parseHttpDate/issues
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc