@gateweb/react-utils 1.14.0 → 1.14.1
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/cjs/index.js +1 -5
- package/dist/es/index.mjs +1 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -200,10 +200,6 @@ function createEnumLikeObject(obj, name, scene) {
|
|
|
200
200
|
function getLabel(value) {
|
|
201
201
|
const targetItem = list.find((item)=>item.value === value);
|
|
202
202
|
if (!targetItem) return String(value);
|
|
203
|
-
if ('scenes' in targetItem && scene) {
|
|
204
|
-
const sceneObj = targetItem.scenes?.[scene];
|
|
205
|
-
return sceneObj && sceneObj.label || String(value);
|
|
206
|
-
}
|
|
207
203
|
if ('label' in targetItem) return targetItem.label;
|
|
208
204
|
return String(value);
|
|
209
205
|
}
|
|
@@ -887,7 +883,7 @@ const transformObjectKey = (obj, transformFunName)=>{
|
|
|
887
883
|
*
|
|
888
884
|
* formatAmount(1234567) // '1,234,567'
|
|
889
885
|
*/ const formatAmount = (num)=>{
|
|
890
|
-
if (typeof num !== 'number') return '';
|
|
886
|
+
if (typeof num !== 'number' || isNaN(num)) return '';
|
|
891
887
|
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
892
888
|
};
|
|
893
889
|
/**
|
package/dist/es/index.mjs
CHANGED
|
@@ -193,10 +193,6 @@ function createEnumLikeObject(obj, name, scene) {
|
|
|
193
193
|
function getLabel(value) {
|
|
194
194
|
const targetItem = list.find((item)=>item.value === value);
|
|
195
195
|
if (!targetItem) return String(value);
|
|
196
|
-
if ('scenes' in targetItem && scene) {
|
|
197
|
-
const sceneObj = targetItem.scenes?.[scene];
|
|
198
|
-
return sceneObj && sceneObj.label || String(value);
|
|
199
|
-
}
|
|
200
196
|
if ('label' in targetItem) return targetItem.label;
|
|
201
197
|
return String(value);
|
|
202
198
|
}
|
|
@@ -880,7 +876,7 @@ const transformObjectKey = (obj, transformFunName)=>{
|
|
|
880
876
|
*
|
|
881
877
|
* formatAmount(1234567) // '1,234,567'
|
|
882
878
|
*/ const formatAmount = (num)=>{
|
|
883
|
-
if (typeof num !== 'number') return '';
|
|
879
|
+
if (typeof num !== 'number' || isNaN(num)) return '';
|
|
884
880
|
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
885
881
|
};
|
|
886
882
|
/**
|