unitedwardrobe / imgproxy-node

A Node client library to generate urls for imgproxy services.
MIT License
36 stars 8 forks source link

Ignore undefined arguments passed to resize() #3

Closed ajsharp closed 5 years ago

ajsharp commented 5 years ago

imgproxy supports ignoring certain arguments, such as height, when calling resize. If you call resize with only the width, it will automatically respect the source image dimensions. In this line https://github.com/unitedwardrobe/imgproxy-node/blob/b34198fd925a8572519baa67efea78108e3a10d6/src/builder.ts#L53 this library stringifies any value passed to it, so, if you pass null or undefined, the string "undefined" will be passed on to imgproxy. Ideally, this library would check for a truthy value before stringifying the value and ignoring falsey values.

koenpunt commented 5 years ago

I assume you mean these methods?

https://github.com/unitedwardrobe/imgproxy-node/blob/b34198fd925a8572519baa67efea78108e3a10d6/src/builder.ts#L27-L40