Skip to content

Commit

Permalink
Updating comments / docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Oct 10, 2022
1 parent 4a8c4a2 commit 55001ad
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ export function getComputedFluidTypographyValue( {
}

/**
* Internal method that checks a string for a unit and value and returns an array consisting of `'value'` and `'unit'`, e.g., [ '42', 'rem' ].
* A raw font size of `value + unit` is expected. If the value is a number, it will convert to `value + 'px'`.
*
* @param {string} rawValue Raw size value from theme.json.
* @param {string|number} rawValue Raw size value from theme.json.
* @param {Object|undefined} options Calculation options.
*
* @return {{ unit: string, value: number }|null} An object consisting of `'value'` and `'unit'` properties.
Expand All @@ -158,7 +160,8 @@ export function getTypographyValueAndUnit( rawValue, options = {} ) {
return null;
}

if ( typeof rawValue === 'number' && ! Number.isNaN( rawValue ) ) {
// Converts numbers to pixel values by default.
if ( typeof rawValue === 'number' ) {
rawValue = `${ rawValue }px`;
}

Expand Down

0 comments on commit 55001ad

Please sign in to comment.