Skip to content

Commit

Permalink
Remove unnecessary functions
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal authored and aduth committed Mar 25, 2020
1 parent 1658348 commit 62ad0f0
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions bin/api-docs/update-api-docs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
const { join, relative, resolve, sep, basename, dirname } = require( 'path' );
const { join, relative, resolve, sep, dirname } = require( 'path' );
const glob = require( 'fast-glob' );
const execa = require( 'execa' );
const { Transform } = require( 'stream' );
Expand Down Expand Up @@ -76,9 +76,7 @@ const TOKEN_PATTERN = /<!-- START TOKEN\((.+?(?:\|(.+?))?)\) -->/g;
* @return {string} Package name.
*/
function getFilePackage( file ) {
return file.startsWith( PACKAGES_DIR )
? relative( PACKAGES_DIR, file ).split( sep )[ 0 ]
: getDataDocumentationFilePackage( basename( file, '.md' ) );
return relative( PACKAGES_DIR, file ).split( sep )[ 0 ];
}

/**
Expand Down Expand Up @@ -117,22 +115,6 @@ function getPackageStoreName( packageName ) {
return storeName;
}

/**
* Returns the conventional package name of a given documentation file name.
*
* @param {string} file Documentation file name.
*
* @return {string} package name.
*/
function getDataDocumentationFilePackage( file ) {
let packageName = file.replace( /^data-/, '' ).replace( /^core-/, '' );
if ( packageName === 'core' ) {
packageName += '-data';
}

return packageName;
}

/**
* Returns the conventional documentation file name of a given package.
*
Expand Down

0 comments on commit 62ad0f0

Please sign in to comment.