[JS] FlexBuffers Fix for wrong type of offset and length values (#6107)

* Adding FlexBuffers support for Dart language

* Introduce snapshot method.

* Fix docu

* Replacing extension methods with static methods in order to support older Dart version

* Improving code based on PR feedback. Mainly rename refactoring.

* Addressing all PR feedback which does not need clarification

* exchange dynamic type with Object

* Adds better API documentation.
[] operator throws a very descriptive exception in case of a bad key.

* Implementation of JavaScript FlexBuffers decoder

* implements JS FlexBuffers builder

* replacing _toF32 with Math.fround

* Introducing test for BigInt number

* Moving functions from BitWitdth & ValueType object into BitWidthUtil and ValueTypeUtil accordingly.
Removing defensive checks.
Introducing fix for large int numbers by converting them to BigInt type.
Introducing handling for BigInt type in `add` method.
Using TextEncoder and Decoder to handle string / utf8 conversion.

* rename variable

* Lets user turn deduplication strategies for strings, keys and vector of keys off while building FlexBuffer.
Implements quick sort and choses quick sort if the number of keys is bigger then 20.
Removes unnecessary dict lookups in BitWidthUtil helper functions

* make iwidth and uwidth computation simpler and faster

* Making redInt and readUint a bit faster and shim the BigInt / BigUint usage

* Fixing a bug in FlexBuffers JS, where offsets and lengths are stored and read as int and not as uint values.

* Fixing a bug in FlexBuffers Dart, where offset and length values are stored and read as int values instead of uint values
6 files changed
tree: 610c8a2561214a42e11c5e2ed11688e8827f871d
  1. .appveyor/
  2. .bazelci/
  3. .github/
  4. .travis/
  5. android/
  6. bazel/
  7. CMake/
  8. conan/
  9. dart/
  10. docs/
  11. go/
  12. grpc/
  13. include/
  14. java/
  15. js/
  16. lobster/
  17. lua/
  18. net/
  19. php/
  20. python/
  21. reflection/
  22. rust/
  23. samples/
  24. snap/
  25. src/
  26. swift/
  27. tests/
  28. .clang-format
  29. .editorconfig
  30. .gitattributes
  31. .gitignore
  32. .travis.yml
  33. appveyor.yml
  34. BUILD
  35. build_defs.bzl
  36. CMakeLists.txt
  37. composer.json
  38. conanfile.py
  39. CONTRIBUTING.md
  40. LICENSE.txt
  41. package.json
  42. pom.xml
  43. readme.md
  44. WORKSPACE
readme.md

logo FlatBuffers

Build Status Build status Join the chat at https://gitter.im/google/flatbuffers Discord Chat Twitter Follow

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.

Go to our landing page to browse our documentation.

Supported operating systems

  • Windows
  • MacOS X
  • Linux
  • Android
  • And any others with a recent C++ compiler.

Supported programming languages

  • C++
  • C#
  • C
  • Dart
  • Go
  • Java
  • JavaScript
  • Lobster
  • Lua
  • PHP
  • Python
  • Rust
  • TypeScript

and more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.