Closed jerrygreen closed 4 years ago
- Would you recommend a version bump for a typescript rewrite?
Yea. I'll make a version bump commit right away
- Would you be willing to add a test for these changes?
Yea, I'll now think about this too
@jekrb I have a question actually, - why you've initially added host.indexOf('localhost') > -1
, does it have any sense, really?
UPD. Uh, wait, I'm silly, that's the initial sense of the lib 😅 so we can define protocol properly
@jekrb I think that's all. Have a look?
@JerryGreen this looks really good to me. Thank you so much for writing the tests! Merging now. 🚀
@JerryGreen this has been publish on npm next-absolute-url@1.2.0
🎉
next-absolute-url
doesn't have Typescript definitions:What this PR does:
Rewrite to Typescript. It has
index.ts
now, which is actual source code now, and by runningyarn build
it will generateindex.js
(which stays to be pretty much the same as earlier) andindex.d.ts
with type definitionsRemove
req.headers['x-forwarded-host']
as host source. I don't receive this header myself, and also I haven't found it at node type definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/http.d.tsUse
/^localhost(:\d+)?$/.test(host)
regular expression instead ofhost.indexOf('localhost') > -1
. No very much sense here but urls likefancy-localhost.com
won't be treated as actual localhost now