You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/01 21:23:16 UTC

[GitHub] [superset] ktmud commented on a diff in pull request #21996: fix: invalid float number format by json-bigint

ktmud commented on code in PR #21996:
URL: https://github.com/apache/superset/pull/21996#discussion_r1010907163


##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts:
##########
@@ -16,10 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import JSONbig from 'json-bigint-native';
+import JSONbig from 'json-bigint';
+import { cloneDeepWith } from 'lodash';
 
 import { ParseMethod, TextResponse, JsonResponse } from '../types';
 
+// eslint-disable-next-line consistent-return
+function parseFloatBigNumber(value: any) {
+  if (value?.isInteger?.() === false) {
+    return Number(value);
+  }
+}

Review Comment:
   Can we just inline this?
   
   
   ```ts
         // `json-bigint` could not handle floats well, see sidorares/json-bigint#62
         // TODO: clean up after json-bigint>1.0.1 is released
         json: cloneDeepWith(json, (value: any) => (
             value instanceof BigNumber && !value.isInteger() ? Number(value) : value)
         )),
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org