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

netlify-headers-parser

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netlify-headers-parser - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

package.json
{
"name": "netlify-headers-parser",
"version": "2.1.0",
"version": "2.1.1",
"description": "Parses Netlify headers into a JavaScript object representation",

@@ -5,0 +5,0 @@ "main": "src/index.js",

const { inspect, isDeepStrictEqual } = require('util')
const { splitResults } = require('./results')
// Merge headers from `_headers` with the ones from `netlify.toml`.

@@ -18,20 +20,12 @@ // When:

const mergeHeaders = function ({ fileHeaders = [], configHeaders = [] }) {
const errors = validateArrays(fileHeaders, configHeaders)
if (errors.length !== 0) {
return { headers: [], errors }
}
const headers = [...fileHeaders, ...configHeaders].filter(isUniqueHeader)
return { headers, errors: [] }
const results = [...validateArray(fileHeaders), ...validateArray(configHeaders)]
const { headers, errors } = splitResults(results)
const mergedHeaders = headers.filter(isUniqueHeader)
return { headers: mergedHeaders, errors }
}
const validateArrays = function (fileHeaders, configHeaders) {
const fileError = validateArray(fileHeaders)
const configError = validateArray(configHeaders)
return [fileError, configError].filter(Boolean)
}
const validateArray = function (headers) {
if (!Array.isArray(headers)) {
return new TypeError(`Headers should be an array: ${inspect(headers, { colors: false })}`)
}
return Array.isArray(headers)
? headers
: [new TypeError(`Headers should be an array: ${inspect(headers, { colors: false })}`)]
}

@@ -38,0 +32,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