packages/react-server-module-tagger/index.js
function(fn, opts, trim, basePath, prefix){
	var slashPattern = isWindows
		?/\\/g
		:/\//g
	var name = fn.substring(basePath.length+trim.length, fn.length)
		.replace(/\.jsx?$/, '')
		.replace(slashPattern,'.')
	if (opts.label) {
		name += '.'+opts.label
	}
	if (prefix) {
		name = prefix + name
	}
	return name;
}
function(fn, opts, trim, basePath, prefix){
	var slashPattern = isWindows
		?/\\/g
		:/\//g
	var name = fn.substring(basePath.length+trim.length, fn.length)
		.replace(/\.jsx?$/, '')
		.replace(slashPattern,'.')
	if (opts.label) {
		name += '.'+opts.label
	}
	if (prefix) {
		name = prefix + name
	}
	return name;
}
function ( fn , opts , trim , basePath , prefix ) { var slashPattern = isWindows ? / \\ / g : / \/ / g var name = fn . substring ( basePath . length + trim . length , fn . length ) . replace ( / \.jsx?$ / , '' ) . replace ( slashPattern , '.' ) if ( opts . label ) { name += '.' + opts . label } if ( prefix ) { name = prefix + name } return name ; }
Gets the name of a logger from its filepath.
@example
getName(
'my-component',
{ label: 'sub' },
'my-project.src',
'my-project/src/components/my-component.js'
) // returns "components.my-component"
@param  {String}   fn       filename
@param  {Object}   opts     { label: 'Optional logger label' }
@param  {String}   trim     The leading portion of the name to remove
@param  {String}   basePath The path to the file
@param  {String}   prefix   A prefix to prepend to the name
@return {String}            The logger name, e.g. my-project.components.my-component
Gets the name of a logger from its filepath .