@server/next 0.20.17 → 0.20.18

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +9 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.20.17",
3
+ "version": "0.20.18",
4
4
  "description": "An experimental reimplementation of server.js focused on the DX",
5
5
  "homepage": "https://node-server.com/",
6
6
  "repository": "https://github.com/franciscop/server-next.git",
package/src/index.js CHANGED
@@ -118,11 +118,15 @@ export default function server(options = {}) {
118
118
  if (!(this instanceof server)) {
119
119
  const inst = new server(options);
120
120
  const cb = inst.netlify;
121
- Object.keys(Object.getPrototypeOf(inst)).forEach((key) => {
122
- cb[key] = inst[key];
123
- });
124
- Object.keys(inst).forEach((key) => {
125
- cb[key] = inst[key];
121
+ const keys = Object.keys(Object.getPrototypeOf(inst)).concat(
122
+ Object.keys(inst)
123
+ );
124
+ keys.forEach((key) => {
125
+ if (typeof inst[key] === "function") {
126
+ cb[key] = inst[key].bind(inst);
127
+ } else {
128
+ cb[key] = inst[key];
129
+ }
126
130
  });
127
131
  return cb;
128
132
  }