baja-lite 1.5.2 → 1.5.4
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.
- package/object.d.ts +7 -0
- package/object.js +11 -0
- package/package.json +1 -1
- package/sql.js +2 -2
package/object.d.ts
CHANGED
|
@@ -104,6 +104,13 @@ export declare const arraySplit: <T = any>(datas: T[], { everyLength, groupCount
|
|
|
104
104
|
everyLength?: number | undefined;
|
|
105
105
|
groupCount?: number | undefined;
|
|
106
106
|
}) => T[][];
|
|
107
|
+
/**
|
|
108
|
+
* 合并对象(浅),忽略后续参数的null、undefined、空字符串
|
|
109
|
+
* @param source
|
|
110
|
+
* @param os
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
export declare const assginObject: <T extends Object>(source: T, ...os: T[]) => T;
|
|
107
114
|
export declare const P2C: (pro: string, IF?: boolean) => string;
|
|
108
115
|
export declare const C2P: (pro: string, IF?: boolean) => string;
|
|
109
116
|
export declare function C2P2<T extends Object = any, L extends Object = T>(datas: L[], hump?: boolean, convert?: Record<string, (data: any) => any>): T[];
|
package/object.js
CHANGED
|
@@ -237,6 +237,17 @@ export const arraySplit = (datas, { everyLength = 0, groupCount = 0 } = {}) => {
|
|
|
237
237
|
throw new Error('参数错误!');
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* 合并对象(浅),忽略后续参数的null、undefined、空字符串
|
|
242
|
+
* @param source
|
|
243
|
+
* @param os
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
export const assginObject = (source, ...os) => {
|
|
247
|
+
const result = { ...source };
|
|
248
|
+
os.forEach(o => Object.entries(o).forEach(([key, value]) => value !== null && value !== undefined && `${value}`.trim() !== '' && (result[key] = value)));
|
|
249
|
+
return result;
|
|
250
|
+
};
|
|
240
251
|
const P2CEX = /[A-Z]/g;
|
|
241
252
|
export const P2C = (pro, IF = true) => (IF ? pro.replace(P2CEX, (a) => `_${a.toLowerCase()}`) : pro);
|
|
242
253
|
const C2PEX = /_([a-z])/g;
|
package/package.json
CHANGED
package/sql.js
CHANGED
|
@@ -2907,12 +2907,12 @@ export class SqlService {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
transaction(option) {
|
|
2909
2909
|
if (option.sync === SyncMode.Sync) {
|
|
2910
|
-
return option.dao.transaction(SyncMode.Sync, option.fn);
|
|
2910
|
+
return option.dao.transaction(SyncMode.Sync, option.fn, option.conn);
|
|
2911
2911
|
}
|
|
2912
2912
|
else {
|
|
2913
2913
|
return new Promise(async (resolve, reject) => {
|
|
2914
2914
|
try {
|
|
2915
|
-
const rt = await option.dao.transaction(SyncMode.Async, option.fn);
|
|
2915
|
+
const rt = await option.dao.transaction(SyncMode.Async, option.fn, option.conn);
|
|
2916
2916
|
resolve(rt);
|
|
2917
2917
|
}
|
|
2918
2918
|
catch (error) {
|