@contrail/util
Advanced tools
Comparing version 1.0.3 to 1.0.4
export declare class StringUtil { | ||
static convertToHyphenCase(entityName: string): string; | ||
static convertToHyphenCase(entityName: string, transformToLowerCase?: boolean): string; | ||
} |
@@ -5,4 +5,7 @@ "use strict"; | ||
class StringUtil { | ||
static convertToHyphenCase(entityName) { | ||
const slugName = entityName === null || entityName === void 0 ? void 0 : entityName.split(/(?=[A-Z])/).join('-').toLowerCase(); | ||
static convertToHyphenCase(entityName, transformToLowerCase = true) { | ||
const slugName = entityName === null || entityName === void 0 ? void 0 : entityName.split(/(?=[A-Z])/).join('-'); | ||
if (slugName && transformToLowerCase) { | ||
return slugName.toLowerCase(); | ||
} | ||
return slugName; | ||
@@ -9,0 +12,0 @@ } |
@@ -25,2 +25,7 @@ "use strict"; | ||
}); | ||
it('should handle the composite entity name but no lower case', () => { | ||
const entityName = 'ItemContentHolder'; | ||
const slug = string_util_1.StringUtil.convertToHyphenCase(entityName, false); | ||
expect(slug).toEqual('Item-Content-Holder'); | ||
}); | ||
it('should handle the empty name', () => { | ||
@@ -27,0 +32,0 @@ const entityName = ''; |
{ | ||
"name": "@contrail/util", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "General javascript utilities", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4768
95