-
Notifications
You must be signed in to change notification settings - Fork 590
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
feat(collections): add sample #1212
Conversation
collections/_utils.ts
Outdated
/** | ||
* Produces a random number between the inclusive `lower` and `upper` bounds. | ||
*/ | ||
export function randomNumber(lower: number, upper: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it uses Math.floor
, I guess it's better to name this randomIntegerNumber
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or randomInteger
, the number part is kind of redundant there :-)
collections/sample.ts
Outdated
* const numbers = [1, 2, 3, 4]; | ||
* const random = sample(numbers); | ||
* | ||
* assert(numbers.includes(random)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems causing type error in doc testing. you can check that with the command
deno test --doc collections/sample.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@majidsajadi LGTM! Thank you for your contribution!
This PR adds
sample
function tocollections
module. #1173