babel-plugin-logger-namespace
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -15,3 +15,3 @@ 'use strict'; | ||
function pathToNamespace (path, _a) { | ||
var stripPrefix = _a.stripPrefix, prefix = _a.prefix; | ||
var stripPrefix = _a.stripPrefix, stripSubfix = _a.stripSubfix, prefix = _a.prefix; | ||
var result = path.replace(/[/|\\]/g, ':'); | ||
@@ -21,2 +21,5 @@ if (stripPrefix !== undefined && result.startsWith(stripPrefix)) { | ||
} | ||
if (stripSubfix !== undefined && result.endsWith(stripSubfix)) { | ||
result = result.slice(0, result.length - stripSubfix.length); | ||
} | ||
if (prefix !== undefined) { | ||
@@ -23,0 +26,0 @@ result = prefix + result; |
export declare type Options = { | ||
stripPrefix?: string; | ||
prefix?: string; | ||
stripSubfix?: string; | ||
}; | ||
export default function (path: string, { stripPrefix, prefix }: Options): string; | ||
export default function (path: string, { stripPrefix, stripSubfix, prefix }: Options): string; |
{ | ||
"name": "babel-plugin-logger-namespace", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Babel plugin that generates the namespace for creating a logger based on the path of the module", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -35,2 +35,3 @@ # babel-plugin-logger-namespace | ||
* stripPrefix?: Remove specified prefix from the resulting namespace | ||
* prefix?: Add specified prefix to the resulting namespace | ||
* prefix?: Add specified prefix to the resulting namespace | ||
* stripSubfix?: Remove specified subfix from the resulting namespace |
Sorry, the diff of this file is not supported yet
8745
132
37