shelving 1.92.2 → 1.93.0

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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.92.2",
14
+ "version": "1.93.0",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
package/util/object.d.ts CHANGED
@@ -77,6 +77,10 @@ export declare function getKeys<T>(obj: T | Partial<T>): ImmutableArray<Key<T>>;
77
77
  export declare function getKeys<T>(obj: T | Partial<T> | Iterable<Key<T>>): Iterable<Key<T>>;
78
78
  /** Extract the value of a named prop from an object. */
79
79
  export declare function getProp<T, K extends Key<T>>(obj: T, key: K): T[K];
80
+ /** Create an object from a single prop. */
81
+ export declare function fromProp<K extends PropertyKey, V>(key: K, value: V): {
82
+ readonly [KK in K]: V;
83
+ };
80
84
  /** Set a prop on an object (immutably) and return a new object including that prop. */
81
85
  export declare function withProp<T extends ImmutableObject, K extends Key<T>>(input: T, key: K, value: T[K]): T;
82
86
  /** Set several props on an object (immutably) and return a new object including those props. */
package/util/object.js CHANGED
@@ -36,6 +36,10 @@ export function getKeys(obj) {
36
36
  export function getProp(obj, key) {
37
37
  return obj[key];
38
38
  }
39
+ /** Create an object from a single prop. */
40
+ export function fromProp(key, value) {
41
+ return { [key]: value };
42
+ }
39
43
  /** Set a prop on an object (immutably) and return a new object including that prop. */
40
44
  export function withProp(input, key, value) {
41
45
  return input[key] === value ? input : { __proto__: getPrototype(input), ...input, [key]: value };