@openapi-generator-plus/generator-common
Advanced tools
Comparing version 0.25.0 to 0.25.1
@@ -15,8 +15,10 @@ "use strict"; | ||
function camelCase(value) { | ||
if (value.toLocaleUpperCase() === value) { | ||
value = value.toLocaleLowerCase(); | ||
} | ||
/* Find separator characters; remove and upper-case the alphanumeric character imediately after */ | ||
value = value.replace(/([^a-zA-Z0-9]+)([a-zA-Z0-9])/g, (whole, sep, letter) => capitalize(letter)); | ||
/* If the string starts with capitals, we need to lower-case that first word */ | ||
/* If the string starts with capitals, followed by lower-case, we lower-case that first word */ | ||
value = value.replace(/^([A-Z]+)([A-Z][a-z])/, (whole, first, next) => first.toLocaleLowerCase() + next); | ||
/* Handle all upper-case words */ | ||
value = value.replace(/^([A-Z]+)([^a-zA-Z]|$)/, (whole, first, next) => first.toLocaleLowerCase() + next); | ||
/* If the string starts with a capital letter, lower-case it */ | ||
// /* If the string starts with a capital letter, lower-case it */ | ||
value = value.replace(/^[A-Z]/, (whole) => whole.toLocaleLowerCase()); | ||
@@ -23,0 +25,0 @@ return value; |
{ | ||
"name": "@openapi-generator-plus/generator-common", | ||
"version": "0.25.0", | ||
"version": "0.25.1", | ||
"description": "Common utilities for openapi-generator-plus generators", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
}, | ||
"homepage": "https://github.com/karlvr/openapi-generator-plus-generators#readme", | ||
"homepage": "https://github.com/karlvr/openapi-generator-plus-generators/tree/master/packages/generator-common#readme", | ||
"dependencies": { | ||
@@ -19,0 +19,0 @@ "pluralize": "^8.0.0", |
@@ -11,8 +11,10 @@ /** Returns the string with the first character converted to upper-case */ | ||
export function camelCase(value: string): string { | ||
if (value.toLocaleUpperCase() === value) { | ||
value = value.toLocaleLowerCase() | ||
} | ||
/* Find separator characters; remove and upper-case the alphanumeric character imediately after */ | ||
value = value.replace(/([^a-zA-Z0-9]+)([a-zA-Z0-9])/g, (whole, sep, letter) => capitalize(letter)) | ||
/* If the string starts with capitals, we need to lower-case that first word */ | ||
/* If the string starts with capitals, followed by lower-case, we lower-case that first word */ | ||
value = value.replace(/^([A-Z]+)([A-Z][a-z])/, (whole, first, next) => first.toLocaleLowerCase() + next) | ||
/* Handle all upper-case words */ | ||
value = value.replace(/^([A-Z]+)([^a-zA-Z]|$)/, (whole, first, next) => first.toLocaleLowerCase() + next) | ||
/* If the string starts with a capital letter, lower-case it */ | ||
// /* If the string starts with a capital letter, lower-case it */ | ||
value = value.replace(/^[A-Z]/, (whole) => whole.toLocaleLowerCase()) | ||
@@ -19,0 +21,0 @@ return value |
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
37467
600