Introduce a placeholder for min/max parameters
See original GitHub issueBuilding 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 arraysfc.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 = autofc.array(fc.nat(), fc._, 3)
- min = auto, max = 3fc.array(fc.nat(), fc._, fc._)
- min = auto, max = auto
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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…
@SupernaviX Indeed I think I will move to this kind of signature - with
min
andmax
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 😉