@voiceflow/common 7.26.1 → 7.27.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.
@@ -23,4 +23,7 @@ export declare const omitBy: PickOmitBy;
23
23
  * @deprecated use pickBy instead
24
24
  */
25
25
  export declare const filterEntries: PickOmitBy;
26
+ export declare const mapValue: <T, R>(obj: Record<string | number | symbol, T>, callback: (value: T) => R) => {
27
+ [k: string]: R;
28
+ };
26
29
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filterEntries = exports.omitBy = exports.pickBy = exports.pick = exports.omit = exports.hasProperty = exports.isObject = exports.selectValue = exports.selectKey = exports.selectID = exports.selectField = void 0;
3
+ exports.mapValue = exports.filterEntries = exports.omitBy = exports.pickBy = exports.pick = exports.omit = exports.hasProperty = exports.isObject = exports.selectValue = exports.selectKey = exports.selectID = exports.selectField = void 0;
4
4
  const selectField = (field) => (obj) => obj[field];
5
5
  exports.selectField = selectField;
6
6
  exports.selectID = (0, exports.selectField)('id');
@@ -61,3 +61,5 @@ exports.omitBy = omitBy;
61
61
  * @deprecated use pickBy instead
62
62
  */
63
63
  exports.filterEntries = exports.pickBy;
64
+ const mapValue = (obj, callback) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, callback(value)]));
65
+ exports.mapValue = mapValue;
@@ -23,4 +23,7 @@ export declare const omitBy: PickOmitBy;
23
23
  * @deprecated use pickBy instead
24
24
  */
25
25
  export declare const filterEntries: PickOmitBy;
26
+ export declare const mapValue: <T, R>(obj: Record<string | number | symbol, T>, callback: (value: T) => R) => {
27
+ [k: string]: R;
28
+ };
26
29
  export {};
@@ -51,3 +51,4 @@ export const omitBy = (obj, predicate) => Object.entries(obj).reduce((acc, [key,
51
51
  * @deprecated use pickBy instead
52
52
  */
53
53
  export const filterEntries = pickBy;
54
+ export const mapValue = (obj, callback) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, callback(value)]));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@voiceflow/common",
3
3
  "description": "Junk drawer of utility functions",
4
- "version": "7.26.1",
4
+ "version": "7.27.0",
5
5
  "author": "Voiceflow",
6
6
  "bugs": {
7
7
  "url": "https://github.com/voiceflow/libs/issues"
@@ -76,5 +76,5 @@
76
76
  "test:single": "NODE_ENV=test ts-mocha --paths --config config/tests/mocharc.yml",
77
77
  "test:unit": "NODE_ENV=test nyc --report-dir=nyc_coverage_unit ts-mocha --paths --config config/tests/mocharc.yml 'tests/**/*.unit.ts'"
78
78
  },
79
- "gitHead": "d3c1af71d24f5b17dd6d78538b2c92c7fdfc3c43"
79
+ "gitHead": "aad20f39f18f98da96b48ad4ee7ff0c95e096421"
80
80
  }