baja-lite 1.5.3 → 1.5.5

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 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[]) => void;
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,15 @@ 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
+ os.forEach(o => Object.entries(o).forEach(([key, value]) => value !== null && value !== undefined && `${value}`.trim() !== '' && (source[key] = value)));
248
+ };
240
249
  const P2CEX = /[A-Z]/g;
241
250
  export const P2C = (pro, IF = true) => (IF ? pro.replace(P2CEX, (a) => `_${a.toLowerCase()}`) : pro);
242
251
  const C2PEX = /_([a-z])/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {