beaugunderson / ip-address

💻 a library for parsing and manipulating IPv4 and IPv6 addresses in JavaScript
http://ip-address.js.org/
MIT License
580 stars 73 forks source link

Lodash repeat should be fed with a string, not a number #85

Closed klimashkin closed 5 years ago

klimashkin commented 5 years ago

We are using lodash-webpack-plugin to avoid including the whole lodash library in our bundle. And we faced with pretty subtle bug when new Address4('10.0.10.0/24').startAddress().address returning 0.10.0.10.

After some debugging we found out that ip-address calls repeat function from lodash with a number as a first argument, when it supposed to be string. Full lodash transforms types by default, but with lodash-webpack-plugin it's not included by default.

For now, we're adding coercions: true option to plugin, but I think ip-address should fix repeat helper call to conform to its arguments typing, and to safe other developers from shooting themselves in their feet.

beaugunderson commented 5 years ago

@klimashkin fixed in 5.9.2, thanks for your patience :)

(and as an aside: i know of no surer way to shoot yourself in the foot than to use lodash-webpack-plugin; it was the cause of no fewer than 5 subtle issues for us before we removed it)