Skip to content

Commit

Permalink
fix(10): fix nodejs 10
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Nov 5, 2020
1 parent b26fd3e commit a2b3b27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ironStore from "iron-store";
import cookie from "cookie";
import createDebug from "debug";
import flat from "array.prototype.flat";

const debug = createDebug("next-iron-session");

Expand Down Expand Up @@ -67,7 +68,7 @@ export async function applySession(
`next-iron-session: Cookie length is too big ${cookieValue.length}, browsers will refuse it`,
);
}
const existingSetCookie = [res.getHeader("set-cookie") || []].flat();
const existingSetCookie = flat([res.getHeader("set-cookie") || []]);
res.setHeader("set-cookie", [...existingSetCookie, cookieValue]);
return cookieValue;
},
Expand All @@ -77,7 +78,7 @@ export async function applySession(
...cookieOptions,
maxAge: 0,
});
const existingSetCookie = [res.getHeader("set-cookie") || []].flat();
const existingSetCookie = flat([res.getHeader("set-cookie") || []]);
res.setHeader("set-cookie", [...existingSetCookie, cookieValue]);
},
};
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
{
"targets": {
"node": "10"
},
"useBuiltIns": "usage",
"corejs": 3
}
}
]
]
Expand Down Expand Up @@ -81,6 +79,7 @@
]
},
"dependencies": {
"array.prototype.flat": "^1.2.3",
"clone": "^2.1.2",
"cookie": "^0.4.1",
"debug": "^4.1.1",
Expand Down

1 comment on commit a2b3b27

@vercel
Copy link

@vercel vercel bot commented on a2b3b27 Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.