petersirka / nosql

NoSQL embedded database for small node.js projects
Other
295 stars 48 forks source link

Naming discussion: Array.prototype.random #42

Closed ondras closed 7 years ago

ondras commented 7 years ago

This issue is motivated primarily by https://github.com/ondras/rot.js/pull/128.

I am the author of the rot.js library. A naming collision prevents usage of both our libraries together, as your Array.prototype.random does something different than mine does. In particular, your random() randomizes the array (something my library offers under the name randomize()), but my random() implementation returns a value at random.

Moreover, my library has Array.prototype.random as a public API, so adjusting that on my side would be a breaking, backwards-incompatible change. May I suggest doing one of the following:

1) renaming your random to randomize, adjusting its usage in index.js accordingly;

2) moving the randomization logic out of Array.prototype completely.

I am willing to send you a PR to any one of these two approaches, should you consider one of them feasible.

petersirka commented 7 years ago

Hi @ondras, I have renamed it.

Thank you!