Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Add _.sample(array, number) functionality to underscore.js #963
Ruby's Array#sample method is extremely useful to me, at least as useful as shuffle.
Please advise if this is up to scratch, and thanks for the great library.
The different return types do bother me a bit since, as currently implemented, passing a null argument will likely cause an error due to an unexpected return type. Passing a string by accident would do the same. If we're going to return different types I think we should use
On empty array vs