https://github.com/themost-framework/schemer
A collection of utilities for working with database schemas across environments with different naming conventions
https://github.com/themost-framework/schemer
Last synced: 6 months ago
JSON representation
A collection of utilities for working with database schemas across environments with different naming conventions
- Host: GitHub
- URL: https://github.com/themost-framework/schemer
- Owner: themost-framework
- License: bsd-3-clause
- Created: 2024-10-06T10:45:09.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-07T07:53:42.000Z (9 months ago)
- Last Synced: 2024-12-16T19:51:44.520Z (7 months ago)
- Language: JavaScript
- Size: 2.29 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @themost/schemer
A collection of utilities for working with database schemas across environments with different naming conventions.
## Installation
```bash
npm install @themost/schemer
```## Usage
Use FieldNaming class to format field names according to a specific naming convention.
```javascript
const { FieldNaming } = require('@themost/schemer');
const naming = new FieldNaming();
const fieldName = naming.format('first_name');
console.log(fieldName); // Output: 'firstName'```
We can customize the naming convention by passing a configuration object to the FieldNaming constructor.
```javascript
const { FieldNaming } = require('@themost/schemer');
const naming = new FieldNaming({
camelCase: false,
separator: '_',
});
const fieldName = naming.format('firstname');
console.log(fieldName); // Output: 'first_name'
````camelCase` property is used to specify whether the naming convention is camel case or not. Default value is `true`.
`separator` property is used to specify the separator character. Default value is `''`.