Skip to content

Commit

Permalink
Adds JSdoc to getNewIndexFromPresets
Browse files Browse the repository at this point in the history
  • Loading branch information
amitraj2203 committed May 27, 2024
1 parent 681bd5f commit f4f6d5a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/edit-site/src/components/global-styles/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ export function getVariationClassName( variation ) {
return `is-style-${ variation }`;
}

/**
* Returns a new index based on the presets and slug prefix.
*
* @param {Array} presets The array of presets.
* @param {string} slugPrefix The prefix for the slug.
*
* @return {number} The new index.
*/
export function getNewIndexFromPresets( presets, slugPrefix ) {
const nameRegex = new RegExp( `^${ slugPrefix }([\\d]+)$` );
return presets.reduce( ( previousValue, currentValue ) => {
Expand Down

0 comments on commit f4f6d5a

Please sign in to comment.