Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDomenic Denicola <domenic@domenicdenicola.com>2013-12-27 23:27:33 +0400
committerRobert Kowalski <rok@kowalski.gd>2014-02-21 01:08:07 +0400
commit6fd6ff7e536ea6acd33037b1878d4eca1f931985 (patch)
tree39408f4bf4297da20e61086c147df614e11058cf /node_modules/sorted-object
parent70fd532c91335e76bda9366234b53a0498b9901a (diff)
Sort dependencies when --save'ing.
Uses sorted-object package to abstract away code shared by shrinkwrap and install.
Diffstat (limited to 'node_modules/sorted-object')
-rw-r--r--node_modules/sorted-object/LICENSE.txt19
-rw-r--r--node_modules/sorted-object/README.md20
-rw-r--r--node_modules/sorted-object/lib/sorted-object.js11
-rw-r--r--node_modules/sorted-object/package.json37
4 files changed, 87 insertions, 0 deletions
diff --git a/node_modules/sorted-object/LICENSE.txt b/node_modules/sorted-object/LICENSE.txt
new file mode 100644
index 000000000..a92a60b82
--- /dev/null
+++ b/node_modules/sorted-object/LICENSE.txt
@@ -0,0 +1,19 @@
+Copyright © 2014 Domenic Denicola <domenic@domenicdenicola.com>
+
+This work is free. You can redistribute it and/or modify it under the
+terms of the Do What The Fuck You Want To Public License, Version 2,
+as published by Sam Hocevar. See below for more details.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/node_modules/sorted-object/README.md b/node_modules/sorted-object/README.md
new file mode 100644
index 000000000..d3f12a278
--- /dev/null
+++ b/node_modules/sorted-object/README.md
@@ -0,0 +1,20 @@
+# 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));
+```
diff --git a/node_modules/sorted-object/lib/sorted-object.js b/node_modules/sorted-object/lib/sorted-object.js
new file mode 100644
index 000000000..26ebd500a
--- /dev/null
+++ b/node_modules/sorted-object/lib/sorted-object.js
@@ -0,0 +1,11 @@
+"use strict";
+
+module.exports = function (input) {
+ var output = Object.create(null);
+
+ Object.keys(input).sort().forEach(function (key) {
+ output[key] = input[key];
+ });
+
+ return output;
+};
diff --git a/node_modules/sorted-object/package.json b/node_modules/sorted-object/package.json
new file mode 100644
index 000000000..5bd814207
--- /dev/null
+++ b/node_modules/sorted-object/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "sorted-object",
+ "description": "Returns a copy of an object with its keys sorted",
+ "keywords": [
+ "sort",
+ "keys",
+ "object"
+ ],
+ "version": "1.0.0",
+ "author": {
+ "name": "Domenic Denicola",
+ "email": "domenic@domenicdenicola.com",
+ "url": "http://domenic.me/"
+ },
+ "license": "WTFPL",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/domenic/sorted-object.git"
+ },
+ "bugs": {
+ "url": "http://github.com/domenic/sorted-object/issues"
+ },
+ "main": "lib/sorted-object.js",
+ "scripts": {
+ "test": "tape test/tests.js",
+ "lint": "jshint lib && jshint test"
+ },
+ "devDependencies": {
+ "jshint": "~2.4.3",
+ "tape": "~2.4.2"
+ },
+ "readme": "# Get a Version of an Object with Sorted Keys\n\nAlthough 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.\n\nSo, 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.\n\n**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.\n\n```js\nvar sortedObject = require(\"sorted-object\");\n\nvar objectToSerialize = generateStuffNondeterministically();\n\n// Before:\nfs.writeFileSync(\"dest.json\", JSON.stringify(objectToSerialize));\n\n// After:\nvar sortedVersion = sortedObject(objectToSerialize);\nfs.writeFileSync(\"dest.json\", JSON.stringify(sortedVersion));\n```\n",
+ "readmeFilename": "README.md",
+ "homepage": "https://github.com/domenic/sorted-object",
+ "_id": "sorted-object@1.0.0",
+ "_from": "sorted-object@"
+}