question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce a placeholder for min/max parameters

See original GitHub issue

Building an array of length 3 or more is currently not ideal, solutions are the following:

  • fc.array(fc.nat()).filter(data => data.length >= 3) - not optimized, will reject too many arrays
  • fc.array(fc.nat(), 3, 100) - but why 100? Why do the user has to specify this value?
  • fc.tuple(fc.nat(), fc.nat(), fc.nat(), fc.array(fc.nat())).map(([a,b,c,data]) => [a,b,c,...data]) - really to complicated

The idea is to introduced a placeholder whenever possible to be able to do:

  • fc.array(fc.nat(), 3, fc._) - min = 3, max = auto
  • fc.array(fc.nat(), fc._, 3) - min = auto, max = 3
  • fc.array(fc.nat(), fc._, fc._) - min = auto, max = auto

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dubzzzcommented, Aug 29, 2020

@ethanresnick For the moment the approach I wanted to experiment is the one suggested by @SupernaviX. I did try the other one a while ago but it didn’t fit with the framework. The object based syntax has been spread and used in all the recent arbitraries and works perfectly: typings are easier, no need for ‘overloaded’ functions…

1reaction
dubzzzcommented, May 27, 2018

@SupernaviX Indeed I think I will move to this kind of signature - with min and max as attributes of an object. The placeholder way - fc.array(fc.nat(), 3, fc._) - seems less idiomatic and does not adapt to all situations. The only benefit I see is that it seems lighter for cases where you need to specify both min and max.

I think I will update the branch I started to implement this feature to the {min,max} way.

In any cases, I need some kind of: I want a min not a max, or the contrary. I prefer not forcing the user into specifying a value for min or max - the framework should do the magical part itself 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

minmax() - CSS: Cascading Style Sheets - MDN Web Docs
The minmax() CSS function defines a size range greater than or equal to min and less than or equal to max. It is...
Read more >
HTML5 Forms: Min, Max, Step Type Attribute - Wufoo
To use the min, max, and step attributes the input first needs a type of number, range or one of the date/time values....
Read more >
Format placeholders | Google developer documentation style ...
Introduce the list of placeholders with This output includes the following values: List the placeholders in the order in which they appear ...
Read more >
Minimax Algorithm Guide: How to Create an Unbeatable AI
Note: The minimax function created above is designed to accept two arguments. The first is an array list of the current board's content...
Read more >
Use placeholder images in templates in Motion - Apple Support
Video clips can introduce timing conflicts in Final Cut Pro. Add a placeholder image to a template.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found