Commit Graph

4 Commits

Author SHA1 Message Date
Luigi Pinca
efc8a3525d Fix variable scope (#10526)
Currenlty the `v` variable is only visible in the `if` block but it is
also used in the outer scope. Move the declaration to the outer scope.
2019-04-26 17:40:53 -04:00
Hugh Willson
c6bddb331a Remove underscore dependency. 2017-08-02 15:33:15 -04:00
Naomi Seyfer
0d8bfbae8a fix tests, rename option, more style fixes 2013-10-02 12:01:21 -07:00
Andrew Wilcox
da6bc1d835 EJSON.stringify objects in sorted key order.
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.
2013-10-02 11:43:44 -07:00