@react-hive/honey-utils 4.1.0 → 4.2.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/README.md +16 -1
- package/dist/README.md +16 -1
- package/dist/guards.d.ts +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +25 -0
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.dev.cjs
CHANGED
|
@@ -2440,6 +2440,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2440
2440
|
/* harmony export */ isDecimal: () => (/* binding */ isDecimal),
|
|
2441
2441
|
/* harmony export */ isDefined: () => (/* binding */ isDefined),
|
|
2442
2442
|
/* harmony export */ isEmptyObject: () => (/* binding */ isEmptyObject),
|
|
2443
|
+
/* harmony export */ isEnumValue: () => (/* binding */ isEnumValue),
|
|
2443
2444
|
/* harmony export */ isError: () => (/* binding */ isError),
|
|
2444
2445
|
/* harmony export */ isFiniteNumber: () => (/* binding */ isFiniteNumber),
|
|
2445
2446
|
/* harmony export */ isInteger: () => (/* binding */ isInteger),
|
|
@@ -2663,6 +2664,29 @@ const isInteger = (value) => isNumber(value) && Number.isInteger(value);
|
|
|
2663
2664
|
* ```
|
|
2664
2665
|
*/
|
|
2665
2666
|
const isDecimal = (value) => isFiniteNumber(value) && !Number.isInteger(value);
|
|
2667
|
+
/**
|
|
2668
|
+
* Checks if a value is one of a string enum's values.
|
|
2669
|
+
*
|
|
2670
|
+
* @template Value - The type of the enum's values.
|
|
2671
|
+
*
|
|
2672
|
+
* @param enumObject - The enum, or any object whose values are the allowed strings.
|
|
2673
|
+
* @param value - The value to check.
|
|
2674
|
+
*
|
|
2675
|
+
* @returns `true` if the value is one of the enum's values; otherwise, `false`.
|
|
2676
|
+
*
|
|
2677
|
+
* @example
|
|
2678
|
+
* ```ts
|
|
2679
|
+
* enum Fruit {
|
|
2680
|
+
* APPLE = 'apple',
|
|
2681
|
+
* PEAR = 'pear',
|
|
2682
|
+
* }
|
|
2683
|
+
*
|
|
2684
|
+
* isEnumValue(Fruit, 'apple'); // true
|
|
2685
|
+
* isEnumValue(Fruit, 'APPLE'); // false
|
|
2686
|
+
* isEnumValue(Fruit, null); // false
|
|
2687
|
+
* ```
|
|
2688
|
+
*/
|
|
2689
|
+
const isEnumValue = (enumObject, value) => Object.values(enumObject).includes(value);
|
|
2666
2690
|
|
|
2667
2691
|
|
|
2668
2692
|
/***/ },
|
|
@@ -3928,6 +3952,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3928
3952
|
/* harmony export */ isDefined: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_8__.isDefined),
|
|
3929
3953
|
/* harmony export */ isEmptyArray: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.isEmptyArray),
|
|
3930
3954
|
/* harmony export */ isEmptyObject: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_8__.isEmptyObject),
|
|
3955
|
+
/* harmony export */ isEnumValue: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_8__.isEnumValue),
|
|
3931
3956
|
/* harmony export */ isError: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_8__.isError),
|
|
3932
3957
|
/* harmony export */ isFile: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_5__.isFile),
|
|
3933
3958
|
/* harmony export */ isFiniteNumber: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_8__.isFiniteNumber),
|