xjs-common 10.1.0 → 10.1.2

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.
@@ -4,4 +4,6 @@ export declare namespace UHttp {
4
4
  function concatParamsWithEncoding(end: string, params: {
5
5
  [k: string]: string | string[];
6
6
  }): string;
7
+ /** normalize object keys to lower case. */
8
+ function normalizeHeaders(headers: Record<string, any>): Record<string, any>;
7
9
  }
@@ -22,4 +22,11 @@ var UHttp;
22
22
  return result.substring(0, result.length - 1);
23
23
  }
24
24
  UHttp.concatParamsWithEncoding = concatParamsWithEncoding;
25
+ /** normalize object keys to lower case. */
26
+ function normalizeHeaders(headers) {
27
+ if (!headers)
28
+ return {};
29
+ return Object.entries(headers).reduce((a, b) => { a[b[0].toLowerCase()] = b[1]; return a; }, {});
30
+ }
31
+ UHttp.normalizeHeaders = normalizeHeaders;
25
32
  })(UHttp = exports.UHttp || (exports.UHttp = {}));
@@ -1,6 +1,7 @@
1
1
  import { TimeUnit } from "../const/time-unit";
2
2
  export declare namespace UString {
3
3
  function eq(s1: string, s2: string): boolean;
4
+ function repeat(token: string, mlt: number): string;
4
5
  /**
5
6
  * generate date time number as fixed length (depends on `unit`) string without separator charactor.
6
7
  * For example, `2025-06-08T10:15:06.366Z` is to be `20250608101506366`.
@@ -11,7 +12,6 @@ export declare namespace UString {
11
12
  date?: Date;
12
13
  unit?: TimeUnit;
13
14
  }): string;
14
- function trimProps(obj: any): void;
15
15
  function generateRandomString(len: number): string;
16
16
  function idx2az(idx: number): string;
17
17
  function az2idx(az: string): number;
@@ -12,6 +12,10 @@ var UString;
12
12
  return !u_type_1.UType.isString(s1) || !u_type_1.UType.isString(s2) ? s1 === s2 : s1.trim() === s2.trim();
13
13
  }
14
14
  UString.eq = eq;
15
+ function repeat(token, mlt) {
16
+ return (0, u_1.int2array)(mlt).map(_ => token).join("");
17
+ }
18
+ UString.repeat = repeat;
15
19
  /**
16
20
  * generate date time number as fixed length (depends on `unit`) string without separator charactor.
17
21
  * For example, `2025-06-08T10:15:06.366Z` is to be `20250608101506366`.
@@ -25,12 +29,6 @@ var UString;
25
29
  return t.substring(0, 14 - (6 - (op?.unit ?? time_unit_1.TimeUnit.Sec)) * 2);
26
30
  }
27
31
  UString.simpleTime = simpleTime;
28
- function trimProps(obj) {
29
- Object.keys(obj)
30
- .filter(k => typeof obj[k] === "string")
31
- .forEach(k => obj[k] = obj[k]?.trim());
32
- }
33
- UString.trimProps = trimProps;
34
32
  function generateRandomString(len) {
35
33
  return (0, u_1.int2array)(len).map(_ => {
36
34
  let rnd = Math.floor(62 * Math.random());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xjs-common",
3
- "version": "10.1.0",
3
+ "version": "10.1.2",
4
4
  "description": "library modules for typescript that bundled general-purpose implementations.",
5
5
  "repository": {
6
6
  "type": "git",