-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toString missing #1
Comments
Hi @MartinSStewart! No, but there's no particular reason why there shouldn't be. Feel free to make a PR if you want to add it :-) |
I started working on a PR but then realized this was going to be more work than expected. Also I realized for my use case it's going to be too slow to parse the data URIs (I'm working with data URIs that are up to 256kb). I did notice that you have a lot of unused dependencies in this package so I went ahead and made a PR removing those at least (though I seem to have broken something in CI, let me check on that first). |
Interesting. Any ideas how we could improve elm-data-uri to handle these cases, or are you going to use an alternative route to handle your use-case? |
For my use case, I only need the data URI to be validated efficiently and I don't need to parse any of the information contained in it. I'm just getting a data URI from somewhere and then passing it along. I suppose one way to make that work would be to add a |
That would be cool, but perhaps it would be enough to have a |
I'm creating a package and the simplified API looks like this |
So you need something like |
I'm not sure that would work. I'd still need to call By type Data
= Base64 Bytes
| Raw String
| Lazy String
fromStringLazy : String -> Maybe DataUri
fromStringlazy dataUriText =
if fastValidation dataUriText then
Just
{ mediaType = getMediaTypeWhichShouldAlsoBeFast dataUriText
, data = Lazy dataUriText
}
else
Nothing
toString : DataUri -> String
toString dataUri =
case dataUri.data of
Lazy data -> data -- Also fast
Raw data -> ...
Base64 data -> ... |
I see. As long as it doesn't change how the ordinary fromString and parser works, then I'm fine with it. |
I'm not actually sure if this is a good idea. Adding a |
Fair enough. |
I guess we can leave the issue open, a toString method wouldn't be out of the question. |
Hi, I had a look at the API for this package and was surprised there wasn't a
toString: DataUri -> String
function to complement the existingfromString
function. Are there plans to add one?The text was updated successfully, but these errors were encountered: