diff options
Diffstat (limited to 'deps/npm/node_modules/sorted-object/README.md')
-rw-r--r-- | deps/npm/node_modules/sorted-object/README.md | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/deps/npm/node_modules/sorted-object/README.md b/deps/npm/node_modules/sorted-object/README.md deleted file mode 100644 index d3f12a2788..0000000000 --- a/deps/npm/node_modules/sorted-object/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Get a Version of an Object with Sorted Keys - -Although objects in JavaScript are theoretically unsorted, in practice most engines use insertion order—at least, ignoring numeric keys. This manifests itself most prominently when dealing with an object's JSON serialization. - -So, for example, you might be trying to serialize some object to a JSON file. But every time you write it, it ends up being output in a different order, depending on how you created it in the first place! This makes for some ugly diffs. - -**sorted-object** gives you the answer. Just use this package to create a version of your object with its keys sorted before serializing, and you'll get a consistent order every time. - -```js -var sortedObject = require("sorted-object"); - -var objectToSerialize = generateStuffNondeterministically(); - -// Before: -fs.writeFileSync("dest.json", JSON.stringify(objectToSerialize)); - -// After: -var sortedVersion = sortedObject(objectToSerialize); -fs.writeFileSync("dest.json", JSON.stringify(sortedVersion)); -``` |