Skip to content
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

Merged
merged 4 commits into from
Sep 12, 2021
Merged

feat(collections): add sample #1212

merged 4 commits into from
Sep 12, 2021

Conversation

majidsajadi
Copy link
Contributor

This PR adds sample function to collections module. #1173

@LionC LionC mentioned this pull request Sep 8, 2021
44 tasks
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
*/
export function randomNumber(lower: number, upper: number) {
Copy link
Member

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

Copy link
Contributor

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 :-)

* const numbers = [1, 2, 3, 4];
* const random = sample(numbers);
*
* assert(numbers.includes(random));
Copy link
Member

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

Copy link
Member

@kt3k kt3k left a 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!

@kt3k kt3k merged commit 0fef6e3 into denoland:main Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants