utilium 2.3.11 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utilium",
3
- "version": "2.3.11",
3
+ "version": "2.3.12",
4
4
  "description": "Typescript utilities",
5
5
  "funding": {
6
6
  "type": "individual",