proper(str='')
- Merciglobal Cloud ERP Custom JavaScript Function¶
Overview¶
The proper(str='')
function is a custom JavaScript utility developed for Merciglobal Cloud ERP. It is designed to convert a given string into camel case format — an essential feature for ensuring uniformity across variable names, field IDs, and UI labels.
Purpose¶
This utility helps standardize string values into camel case, which is useful for:
- Developer-friendly variable naming conventions
- Dynamic generation of form field names or IDs
- API payload key standardization
- Enhancing readability and consistency across internal ERP modules
Syntax¶
proper(str = '')
Parameters¶
Parameter | Type | Description |
---|---|---|
str |
String | The input string to be camel-cased |
Returns¶
Returns a camelCase version of the input string.
Example Usage¶
proper('customer name') // Output: 'Customer Name'
proper('Product CODE') // Output: 'Product Code'
proper(' Sales_invoice ') // Output: 'Sales_invoice'
How It Works¶
The proper()
function typically performs the following:
- Trim: Removes any leading or trailing spaces.
- Lowercase: Converts the entire string to lowercase.
- Split: Breaks the string into words by spaces or underscores.
- Capitalize: Capitalizes the first letter of each word except the first one.
- Join: Concatenates the words into a single camelCase string.
Usage in Merciglobal ERP Modules¶
- Form Builder: Automatically converts label text to field IDs
- API Endpoints: Ensures request/response payload keys are camelCase
- Configuration Screens: Dynamic setting key generation
Best Practices¶
- Always validate the input to be a string
- Use this function when generating code or dynamic content to avoid naming mismatches
- Useful in VueJS components, Node.js APIs, or even browser-based custom ERP plugins
For questions or improvements, please contact the Merci DevOps Team.