-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON
https://github.com/mongodb/js-bson/issues/385
Imho the serializer method heads are bad. The last parameter is isArray but actually all it does is depending if it is true or false it will set the corresponding encoding to ascii or utf8.
Unable to find source-code formatter for language: const. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
? buffer.write(key, index, 'utf8') : buffer.write(key, index, 'ascii');
So actually the last parameter is about encoding and not if the input is an array or not. So probably we should rename it to encoding and insert directly if it should be using utf8 or ascii. This should remove a lot of if checks also.
Also strange is this function call:
Why is serializeFunctions passed to serializeFunction as parameter isArray?