Closed MakhBeth closed 2 years ago
@MakhBeth documentation has not been updated, please run npm run docs
.
I'm not aware of the preferred publish strategy
Recent features were added with a minor bump.
Right, I had some prettier issues and a missing support to URL for old TS versions. Now it should be ok
I had to do something awful, to make everything work on browser:
import * as nodeURL from 'url'
declare const window: any // tslint:disable-next-line
/* istanbul ignore next */ const URL = typeof window === 'undefined' ? nodeURL.URL : window.URL
It's the only way that I know to do the match. Suggestions are (very) welcome
Ok, it could be a lot simpler Edited and removed the horrible ternary on window 👍
The issue that I see here is that the type of window.URL
is different from URL
from url
(NodeJS module), one can't be assigned to the other, and I don't see a way to make this codec work with both environments.
Simply add a URLFromString codec. It takes a string and uses the native URL api to detect if it's valid.
Note: I reference version 0.5.17 in the doc string, but I haven't bumped the version anywhere, I'm not aware of the preferred publish strategy