Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expect-ct

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-ct - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

8

CHANGELOG.md
# Changelog
## Unreleased
## 0.3.0 - 2019-09-01
### Changed
- Dropped support for Node <8
- You must now pass a positive integer for `maxAge` (instead of any positive number)
- You cannot pass `undefined` for `maxAge` (though you can still omit the property)
## 0.2.0 - 2019-05-04
### Added

@@ -5,0 +11,0 @@ - TypeScript type definitions. See [helmetjs/helmet#188](https://github.com/helmetjs/helmet/issues/188)

15

dist/index.js
"use strict";
function isPositiveInteger(option) {
return (typeof option === 'number' &&
option >= 0 &&
Math.round(option) === option);
}
function parseMaxAge(option) {
if (option === undefined) {
return 0;
if (isPositiveInteger(option)) {
return option;
}
if (typeof option !== 'number' || option < 0) {
else {
throw new Error(option + " is not a valid value for maxAge. Please choose a positive integer.");
}
return option;
}

@@ -17,3 +21,4 @@ function getHeaderValueFromOptions(options) {

}
directives.push("max-age=" + parseMaxAge(options.maxAge));
var maxAge = 'maxAge' in options ? options.maxAge : 0;
directives.push("max-age=" + parseMaxAge(maxAge));
if (options.reportUri) {

@@ -20,0 +25,0 @@ directives.push("report-uri=\"" + options.reportUri + "\"");

@@ -5,3 +5,3 @@ {

"description": "Middleware to set the Expect-CT header",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",

@@ -25,3 +25,3 @@ "keywords": [

"engines": {
"node": ">=4.0.0"
"node": ">=8.0.0"
},

@@ -47,15 +47,15 @@ "main": "./dist/index.js",

"@types/connect": "^3.4.32",
"@types/jest": "^24.0.12",
"@types/supertest": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
"connect": "^3.6.6",
"eslint": "^5.16.0",
"@types/jest": "^24.0.18",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"connect": "^3.7.0",
"eslint": "^6.3.0",
"eslint-config-helmet": "^0.2.0",
"jest": "^24.7.1",
"jest": "^24.9.0",
"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
"typescript": "^3.6.2"
},
"dependencies": {}
}
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