'oauth' was using 'btoa', but it's not supported in IE8-9. We already
had a base64 implementation in 'ejson', so I factored it out into its
own package used by 'ejson' and 'oauth'.
Thus if two objects are EJSON.equals, their serialization strings will
be equal also.
(This should mean that reactive-dict could now allow objects to be
used as the key for `equal`).
Note this change does not affect livedata because livedata uses the
EJSON adjust functions to convert between JSON and EJSON (not
stringify).
Adds a couple options to EJSON.stringify:
* keyOrderSensitive: in parallel with EJSON.equals, outputs objects in
native key order (the old behavior).
* indent: pretty-prints the output.
The serialization code is based json2, which makes it easy to preserve
the indentation functionality provided by JSON.stringify. Only enough
code is included to serialize arrays and objects; serializing
primitive values such as strings is delegated to the native
JSON.stringify to reduce code and in case the native implementation is
more efficient.
Include underscore as an explicit dependency in package.js.
Document options to EJSON.equals and EJSON.stringify.
Some Android browser versions of JSON.parse can crash when passed null
(https://code.google.com/p/android/issues/detail?id=11973), so it's
better not to pass on a non-string argument to JSON.parse.
Thanks to @raix for raising the issue in #1401.
Opera seems to have some consistent but difficult to diagnose bugs related to
using _.map in this context. (As in, minifying the test was difficult because
there seemed to be some odd action at a distance, but a given test failure was
fully reproducible.) This appears to work while still preserving the feature
added in 583508e.
Also fix a missing var (which does not appear to be the original problem).
- Delete dead EJSON._each2.
- Make OrderedDict.remove throw if the key isn't in it.
- Make changed callbacks in two places throw if the document isn't in the
dictionary. (Other callbacks implicitly throw via OrderedDict.)
- Remove OrderedDict.pop (which didn't return the key) and push.
This reverts commit c10c7f7c91.
Only revert the non-test portions, leaving failing tests. Will implement
binary-in-Mongo in a different way on this branch before merging back to
ddp-pre1. (Assuming that works, will also delete the 0.2.15 dev bundles from s3
and production.)
Unfortunately, the Node Mongo driver wants to use its own proprietary
Binary type for binary data. We want to use Uint8Array, instead, so
we're going to be using a patched version of the BSON library that
allows this.
It allows us to install a handler for USER_DEFINED binary types, which
in our case we set up to recognize, accept, and provide Uint8Array