Skip to content

Commit a2b3b27

Browse files
committed
fix(10): fix nodejs 10
1 parent b26fd3e commit a2b3b27

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ironStore from "iron-store";
22
import cookie from "cookie";
33
import createDebug from "debug";
4+
import flat from "array.prototype.flat";
45

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

@@ -67,7 +68,7 @@ export async function applySession(
6768
`next-iron-session: Cookie length is too big ${cookieValue.length}, browsers will refuse it`,
6869
);
6970
}
70-
const existingSetCookie = [res.getHeader("set-cookie") || []].flat();
71+
const existingSetCookie = flat([res.getHeader("set-cookie") || []]);
7172
res.setHeader("set-cookie", [...existingSetCookie, cookieValue]);
7273
return cookieValue;
7374
},
@@ -77,7 +78,7 @@ export async function applySession(
7778
...cookieOptions,
7879
maxAge: 0,
7980
});
80-
const existingSetCookie = [res.getHeader("set-cookie") || []].flat();
81+
const existingSetCookie = flat([res.getHeader("set-cookie") || []]);
8182
res.setHeader("set-cookie", [...existingSetCookie, cookieValue]);
8283
},
8384
};

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
{
3333
"targets": {
3434
"node": "10"
35-
},
36-
"useBuiltIns": "usage",
37-
"corejs": 3
35+
}
3836
}
3937
]
4038
]
@@ -81,6 +79,7 @@
8179
]
8280
},
8381
"dependencies": {
82+
"array.prototype.flat": "^1.2.3",
8483
"clone": "^2.1.2",
8584
"cookie": "^0.4.1",
8685
"debug": "^4.1.1",

0 commit comments

Comments
 (0)