@contrail/util
Advanced tools
Comparing version 1.0.16 to 1.0.17
export declare class StringUtil { | ||
static convertToHyphenCase(entityName: string, transformToLowerCase?: boolean): string; | ||
static parseVariables(variableString: string, data: any, quoteStrings?: boolean): string; | ||
static convertToCamelCase(str: any): any; | ||
static convertToTitleCase(str: any): any; | ||
static isString(value: any): boolean; | ||
static isArray(value: any): boolean; | ||
} |
@@ -44,2 +44,12 @@ "use strict"; | ||
} | ||
static convertToCamelCase(str) { | ||
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) { | ||
return index === 0 ? word.toLowerCase() : word.toUpperCase(); | ||
}).replace(/\s+/g, ''); | ||
} | ||
static convertToTitleCase(str) { | ||
const camelCase = this.convertToCamelCase(str); | ||
const withSpaces = camelCase.replace(/([A-Z])/g, " $1"); | ||
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1); | ||
} | ||
static isString(value) { | ||
@@ -46,0 +56,0 @@ return typeof value === 'string' || value instanceof String; |
{ | ||
"name": "@contrail/util", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"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
16425
455