Skip to content

Commit

Permalink
Format.prototype.parse()
Browse files Browse the repository at this point in the history
Base class returns null, which is falsy.
  • Loading branch information
sidewayss committed Jan 1, 2025
1 parent 50c3852 commit 68d9f69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Format.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ export default class Format {
return this.type === "function" || /** @type {any} */ (this).serialize;
}


/**
* @returns Color
*/
parse () {
return null;
}
/**
* @param {Format | FormatInterface} format
* @param {RemoveFirstElement<ConstructorParameters<typeof Format>>} args
Expand Down
2 changes: 1 addition & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function parse (str, options) {
// Convert to Format object
format = space.getFormat(format);

let color = format.parse?.(env.str);
let color = format.parse(env.str);

if (color) {
if (meta) {
Expand Down

0 comments on commit 68d9f69

Please sign in to comment.