Handling of non-standard framerates provided as strings (and additonal exports for ease-of-use)#1
Conversation
Type "StandardFramerate" determined by this array
Fixed a few typos
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.
Non-standard framerates provided as strings
When constructing a Framerate with a string, any value that does not match a 'standard' framerate (e.g. "25", "29.97DF"...) is now tested to see if it can be interpretted as a number.
If it can, it is parsed as a float and the framerate constructed from that number.
Framerate getter
Since a Framerate or FramerateLike object must be specified when constructing a Timecode, it makes sense to allow that Framerate to be retrieved from the Timecode instance later via a new getter.
Additional exports
TimecodeErroris exported so that consumers can test if an error isinstanceof TimecodeError.StandardFramerateswhich contains the supported standard framerates is exported. Internally, the type definition of typeStandardFramerateis defined as any of the values in that array.