netlify-headers-parser
Advanced tools
Comparing version 2.1.1 to 3.0.0
{ | ||
"name": "netlify-headers-parser", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "Parses Netlify headers into a JavaScript object representation", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -9,3 +9,3 @@ const { parseFileHeaders } = require('./line_parser') | ||
// and validate those. | ||
const parseAllHeaders = async function ({ headersFiles = [], netlifyConfigPath, configHeaders = [] } = {}) { | ||
const parseAllHeaders = async function ({ headersFiles = [], netlifyConfigPath, configHeaders = [] }) { | ||
const [ | ||
@@ -12,0 +12,0 @@ { headers: fileHeaders, errors: fileParseErrors }, |
const { parseAllHeaders } = require('./all') | ||
const { parseFileHeaders } = require('./line_parser') | ||
const { mergeHeaders } = require('./merge') | ||
const { parseConfigHeaders } = require('./netlify_config_parser') | ||
const { normalizeHeaders } = require('./normalize') | ||
module.exports = { | ||
parseAllHeaders, | ||
parseFileHeaders, | ||
mergeHeaders, | ||
parseConfigHeaders, | ||
normalizeHeaders, | ||
} | ||
module.exports = { parseAllHeaders } |
@@ -1,2 +0,2 @@ | ||
const { inspect, isDeepStrictEqual } = require('util') | ||
const { isDeepStrictEqual } = require('util') | ||
@@ -19,4 +19,4 @@ const { splitResults } = require('./results') | ||
// as `netlify.toml` headers. | ||
const mergeHeaders = function ({ fileHeaders = [], configHeaders = [] }) { | ||
const results = [...validateArray(fileHeaders), ...validateArray(configHeaders)] | ||
const mergeHeaders = function ({ fileHeaders, configHeaders }) { | ||
const results = [...fileHeaders, ...configHeaders] | ||
const { headers, errors } = splitResults(results) | ||
@@ -27,8 +27,2 @@ const mergedHeaders = headers.filter(isUniqueHeader) | ||
const validateArray = function (headers) { | ||
return Array.isArray(headers) | ||
? headers | ||
: [new TypeError(`Headers should be an array: ${inspect(headers, { colors: false })}`)] | ||
} | ||
// Remove duplicates. This is especially likely considering `fileHeaders` might | ||
@@ -35,0 +29,0 @@ // have been previously merged to `configHeaders`, which happens when |
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
15515
303