Conversation
Added guide on using decorators in p5.js
Co-authored-by: Kenneth Lim <limzy.kenneth@gmail.com>
Co-authored-by: Kenneth Lim <limzy.kenneth@gmail.com>
…/max()
The runtime implementation of min() and max() is variadic, but their
documented overloads only declared (n0, n1), so the parameter validator
rejected calls like min(1, 2, 3, 4). Add a {...Number} rest parameter to
the two-number overload of both functions (same pattern as createVector)
and update parameterData.json accordingly.
Calls with fewer than two number arguments still fail validation with
the same friendly error as before, and the single-array overload is
unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release notes draft:
This patch release includes a security hardening measure, a couple of bugfixes, and documentation updates.
In #9145 @limzykenneth introduces
MAX_GIF_PIXELS, a static property that defines how large, in total pixels, a GIF image is allowed to be loaded into a p5 sketch. The default value is 16,000,000. This means an image's width multiplied by its height must not exceed that value. The property can be set higher if needed. This limitation prevents a GIF with a very large canvas from taking up a lot of browser memory ("decompression bomb"). This patch addresses a security vulnerability report by @slash-init, thanks for reporting! Security vulnerabilities can be reported according to the SECURITY.md policy.In #9006 @roymacdonald spotted and patched a typo in quaternion multiplication, adding tests as well. In #9039 @xdroberto fixed a Friendly Error System (FES) parameter validation bug that @TakagiHitoshi spotted.
Finally, in #9118 @ksen0 added initial documentation of p5's new Decorators API. This API is mainly aimed at addon authors, but is also used throughout the p5.js library code. In programming, a decorator helps to reduce duplicated code. In p5.js, decorators are applied using
p5.registerDecoration(pattern, decorator). They have been supported since version 2.3.0, and follow the TC39 proposal as closely as possible. The new contributor guide is for p5.js code contributors who would like to learn when to use a decorator, and how.Work continues (in the
mainbranch) toward 2.4, but this atomic patch makes recent security updates and bugfixes available sooner, following our recent approach to patch releases.🎉 Thanks to all contributors & stewards!
Full Changelog: v2.3.2...v2.3.3