@netvlies/utility-collection
Advanced tools
Comparing version
@@ -11,2 +11,20 @@ 'use strict'; | ||
const BUNDLE_NAME = 'NVS Utility Collection'; | ||
class Logger { | ||
constructor() { | ||
this.title = BUNDLE_NAME; | ||
} | ||
formatMessage(message, type) { | ||
return `[${this.title} ${type}]: ${message}`; | ||
} | ||
warn(message) { | ||
console.warn(this.formatMessage(message, 'warn')); | ||
} | ||
error(message) { | ||
console.error(this.formatMessage(message, 'error')); | ||
} | ||
} | ||
const logger = new Logger(); | ||
// Vendor | ||
@@ -21,3 +39,3 @@ class DynamicURL { | ||
} | ||
setDynamicRoute(replaceValue) { | ||
setRouteParams(replaceValue) { | ||
this.url = | ||
@@ -29,2 +47,7 @@ typeof replaceValue !== 'object' | ||
} | ||
setDynamicRoute(replaceValue) { | ||
logger.warn('Method "setDynamicRoute" is deprecated, please use "setRouteParams" instead.'); | ||
this.setRouteParams(replaceValue); | ||
return this; | ||
} | ||
resolve() { | ||
@@ -31,0 +54,0 @@ return this.url; |
import qs from 'qs'; | ||
const BUNDLE_NAME = 'NVS Utility Collection'; | ||
class Logger { | ||
constructor() { | ||
this.title = BUNDLE_NAME; | ||
} | ||
formatMessage(message, type) { | ||
return `[${this.title} ${type}]: ${message}`; | ||
} | ||
warn(message) { | ||
console.warn(this.formatMessage(message, 'warn')); | ||
} | ||
error(message) { | ||
console.error(this.formatMessage(message, 'error')); | ||
} | ||
} | ||
const logger = new Logger(); | ||
// Vendor | ||
@@ -12,3 +30,3 @@ class DynamicURL { | ||
} | ||
setDynamicRoute(replaceValue) { | ||
setRouteParams(replaceValue) { | ||
this.url = | ||
@@ -20,2 +38,7 @@ typeof replaceValue !== 'object' | ||
} | ||
setDynamicRoute(replaceValue) { | ||
logger.warn('Method "setDynamicRoute" is deprecated, please use "setRouteParams" instead.'); | ||
this.setRouteParams(replaceValue); | ||
return this; | ||
} | ||
resolve() { | ||
@@ -22,0 +45,0 @@ return this.url; |
@@ -5,2 +5,3 @@ declare class DynamicURL { | ||
setQueryParams(query: Record<string, unknown>): this; | ||
setRouteParams(replaceValue: string | Record<string, string>): this; | ||
setDynamicRoute(replaceValue: string | Record<string, string>): this; | ||
@@ -7,0 +8,0 @@ resolve(): string; |
{ | ||
"name": "@netvlies/utility-collection", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Collection of frequently used utilities by Netvlies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13007
61.02%11
22.22%112
89.83%