ismx-nexo-node-app 0.4.155 → 0.4.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class ObjectUtils {
|
|
4
|
+
static camelToSnake(str) {
|
|
5
|
+
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
6
|
+
}
|
|
4
7
|
static snakeToCamel(obj) {
|
|
5
8
|
if (typeof obj === 'string')
|
|
6
9
|
return obj.toLowerCase().replace(/([-_][a-z])/g, group => group.toUpperCase().replace('-', '').replace('_', ''));
|
package/package.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default class ObjectUtils {
|
|
2
2
|
|
|
3
|
+
static camelToSnake(str: string) {
|
|
4
|
+
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
static snakeToCamel(obj: any): any {
|
|
4
8
|
if (typeof obj === 'string')
|
|
5
9
|
return obj.toLowerCase().replace(/([-_][a-z])/g, group =>
|
|
@@ -213,6 +213,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
|
|
|
213
213
|
let [ table, schema, column ] = [ this.tables[tableName], this.tables[tableName][0].schema, PostgresUtils.camelToSnake(select) ];
|
|
214
214
|
if (PostgresUtils.isReservedWord(column)) column = `"${column}"`;
|
|
215
215
|
|
|
216
|
+
|
|
216
217
|
if (!PostgresUtils.columns(table).includes(column)) throw new Error(`column ${column} does not exist in table ${tableName}`);
|
|
217
218
|
let { where, values } = this.toWhere(tableName, filters);
|
|
218
219
|
|