/**
 * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */

'use strict';

const getShortModulePath = require( './get-short-module-path' );
const splitLongname = require( './split-longname' );

module.exports = ( longname, transformFn ) => {
	const className = splitLongname( longname ).className;
	const str = className ? `${ getShortModulePath( longname ) }~${ className }` : getShortModulePath( longname );

	if ( typeof transformFn === 'function' ) {
		return transformFn( str );
	} else {
		return false;
	}
};
