@netlify/redirect-matcher 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -37,11 +37,15 @@ const stringRecord = (record, name, normalizeKey) => {
37
37
  }
38
38
  let entries
39
39
  if (record !== null && typeof record === 'object') {
40
- const proto = Object.getPrototypeOf(record)
41
- if (proto === Object.prototype || proto === null) {
42
- entries = Object.entries(record)
43
- } else if (typeof record[Symbol.iterator] === 'function') {
40
+ if (typeof record[Symbol.iterator] === 'function') {
44
41
  entries = record
42
+ } else {
43
+ // Dictionaries built on a constructor-less prototype, like the ones
44
+ // `cookie` returns, count as plain; class instances such as URL do not.
45
+ const constructor = Object.getPrototypeOf(record)?.constructor
46
+ if (constructor === undefined || constructor === Object) {
47
+ entries = Object.entries(record)
48
+ }
45
49
  }
46
50
  }
47
51
  if (entries === undefined) {
package/matcher.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/redirect-matcher",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Netlify's redirect rule matcher, compiled from go-redirects to WebAssembly",
5
5
  "type": "module",
6
6
  "engines": {