typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
414 stars 75 forks source link

Support for inserting values of type BigInt #154

Closed EarthlingDavey closed 1 year ago

EarthlingDavey commented 1 year ago

Change Summary

I created values of type BigInt in nodejs by using something like BigInt('1679052926043890575') When inserting values with this type it was throwing an error at line 232 because JSON.stringify doesn't support BigInt.

I added a 2 step process as I have commented in the code.

  1. In JSON.stringify, cast BigInt to a string and wrap in an object for identifying in replace later.
  2. Replace the BigInt object wrap to leave an unquoted BigInt remaining.

Thanks for your consideration, Davey

PR Checklist

jasonbosco commented 1 year ago

@EarthlingDavey That's interesting to hear and an interesting solution! Could you add a test for this?

EarthlingDavey commented 1 year ago

Hi, sorry, I have to abandon this PR. As I think I can import JSONL without this 'hacky' workaround.