utilium 2.3.10 → 2.3.12

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/dist/objects.d.ts CHANGED
@@ -42,8 +42,8 @@ export interface ConstMap<T extends Partial<Record<keyof any, any>>, K extends k
42
42
  has(key: keyof T | K): boolean;
43
43
  }
44
44
  export declare function map<const T extends Partial<Record<any, any>>>(items: T): Map<keyof T, T[keyof T]>;
45
- export declare function getByString(object: Record<string, any>, path: string, separator?: RegExp): Record<string, any>;
46
- export declare function setByString(object: Record<string, any>, path: string, value: unknown, separator?: RegExp): Record<string, any>;
45
+ export declare function getByString<T>(object: Record<string, any>, path: string, separator?: RegExp): T;
46
+ export declare function setByString<T>(object: Record<string, any>, path: string, value: unknown, separator?: RegExp): T;
47
47
  export type JSONPrimitive = null | string | number | boolean;
48
48
  export interface JSONObject {
49
49
  [K: string]: JSONValue | undefined;
package/dist/objects.js CHANGED
@@ -86,13 +86,13 @@ export function map(items) {
86
86
  export function getByString(object, path, separator = /[.[\]'"]/) {
87
87
  return path
88
88
  .split(separator)
89
- .filter(p => p)
89
+ .filter(p => p && p != '__proto__')
90
90
  .reduce((o, p) => o?.[p], object);
91
91
  }
92
92
  export function setByString(object, path, value, separator = /[.[\]'"]/) {
93
93
  return path
94
94
  .split(separator)
95
- .filter(p => p)
95
+ .filter(p => p && p != '__proto__')
96
96
  .reduce((o, p, i) => (o[p] = path.split(separator).filter(p => p).length === ++i ? value : o[p] || {}), object);
97
97
  }
98
98
  /**
package/dist/string.d.ts CHANGED
@@ -10,15 +10,15 @@ export type Trim<T extends string> = T extends `${Whitespace}${infer R extends s
10
10
  /**
11
11
  * Encodes a UTF-8 string into a buffer
12
12
  */
13
- export declare function encodeUTF8(input: string): Uint8Array;
13
+ export declare function encodeUTF8(input: string): Uint8Array<ArrayBuffer>;
14
14
  /**
15
15
  * Decodes a UTF-8 string from a buffer
16
16
  */
17
17
  export declare function decodeUTF8(input?: Uint8Array): string;
18
- export declare function encodeASCII(input: string): Uint8Array;
18
+ export declare function encodeASCII(input: string): Uint8Array<ArrayBuffer>;
19
19
  export declare function decodeASCII(input: Uint8Array): string;
20
20
  export type UUID = `${string}-${string}-${string}-${string}-${string}`;
21
21
  export declare function decodeUUID(uuid: Uint8Array): UUID;
22
- export declare function encodeUUID(uuid: UUID): Uint8Array;
22
+ export declare function encodeUUID(uuid: UUID): Uint8Array<ArrayBuffer>;
23
23
  export declare function stringifyUUID(uuid: bigint): UUID;
24
24
  export declare function parseUUID(uuid: UUID): bigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utilium",
3
- "version": "2.3.10",
3
+ "version": "2.3.12",
4
4
  "description": "Typescript utilities",
5
5
  "funding": {
6
6
  "type": "individual",