first commit
This commit is contained in:
3
build/node_modules/shasum/.npmignore
generated
vendored
Normal file
3
build/node_modules/shasum/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
4
build/node_modules/shasum/.travis.yml
generated
vendored
Normal file
4
build/node_modules/shasum/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
22
build/node_modules/shasum/LICENSE
generated
vendored
Normal file
22
build/node_modules/shasum/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 'Dominic Tarr'
|
||||
|
||||
Permission is hereby granted, free of charge,
|
||||
to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
15
build/node_modules/shasum/README.md
generated
vendored
Normal file
15
build/node_modules/shasum/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# shasum
|
||||
|
||||
Single function that return the sha1sum.
|
||||
Installing this is just a little bit quicker than reading the crypto documentation.
|
||||
|
||||
``` js
|
||||
var shasum = require('shasum')
|
||||
shasum(string || buffer || object)
|
||||
```
|
||||
|
||||
Oh yeah, it works in the browser too, with [browserify](https://npmjs.org/package/browserify)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
13
build/node_modules/shasum/browser.js
generated
vendored
Normal file
13
build/node_modules/shasum/browser.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
var createHash = require('sha.js')
|
||||
var Buffer = require('buffer').Buffer
|
||||
var stringify = require('json-stable-stringify')
|
||||
|
||||
module.exports = function hash (str, alg, format) {
|
||||
str = 'string' === typeof str ? str
|
||||
: Buffer.isBuffer(str) ? str
|
||||
: stringify(str)
|
||||
return createHash(alg || 'sha1')
|
||||
.update(str, Buffer.isBuffer(str) ? null : 'utf8').digest(format || 'hex')
|
||||
}
|
||||
|
||||
13
build/node_modules/shasum/index.js
generated
vendored
Normal file
13
build/node_modules/shasum/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
var createHash = require('crypto').createHash
|
||||
var Buffer = require('buffer').Buffer
|
||||
var stringify = require('json-stable-stringify')
|
||||
|
||||
module.exports = function hash (str, alg, format) {
|
||||
str = 'string' === typeof str ? str
|
||||
: Buffer.isBuffer(str) ? str
|
||||
: stringify(str)
|
||||
return createHash(alg || 'sha1')
|
||||
.update(str, Buffer.isBuffer(str) ? null : 'utf8').digest(format || 'hex')
|
||||
}
|
||||
|
||||
4
build/node_modules/shasum/node_modules/json-stable-stringify/.travis.yml
generated
vendored
Normal file
4
build/node_modules/shasum/node_modules/json-stable-stringify/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
18
build/node_modules/shasum/node_modules/json-stable-stringify/LICENSE
generated
vendored
Normal file
18
build/node_modules/shasum/node_modules/json-stable-stringify/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
7
build/node_modules/shasum/node_modules/json-stable-stringify/example/key_cmp.js
generated
vendored
Normal file
7
build/node_modules/shasum/node_modules/json-stable-stringify/example/key_cmp.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var stringify = require('../');
|
||||
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
var s = stringify(obj, function (a, b) {
|
||||
return a.key < b.key ? 1 : -1;
|
||||
});
|
||||
console.log(s);
|
||||
3
build/node_modules/shasum/node_modules/json-stable-stringify/example/nested.js
generated
vendored
Normal file
3
build/node_modules/shasum/node_modules/json-stable-stringify/example/nested.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var stringify = require('../');
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
console.log(stringify(obj));
|
||||
3
build/node_modules/shasum/node_modules/json-stable-stringify/example/str.js
generated
vendored
Normal file
3
build/node_modules/shasum/node_modules/json-stable-stringify/example/str.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var stringify = require('../');
|
||||
var obj = { c: 6, b: [4,5], a: 3 };
|
||||
console.log(stringify(obj));
|
||||
7
build/node_modules/shasum/node_modules/json-stable-stringify/example/value_cmp.js
generated
vendored
Normal file
7
build/node_modules/shasum/node_modules/json-stable-stringify/example/value_cmp.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var stringify = require('../');
|
||||
|
||||
var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 };
|
||||
var s = stringify(obj, function (a, b) {
|
||||
return a.value < b.value ? 1 : -1;
|
||||
});
|
||||
console.log(s);
|
||||
50
build/node_modules/shasum/node_modules/json-stable-stringify/index.js
generated
vendored
Normal file
50
build/node_modules/shasum/node_modules/json-stable-stringify/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var json = typeof JSON !== 'undefined' ? JSON : require('jsonify');
|
||||
|
||||
module.exports = function (obj, opts) {
|
||||
if (!opts) opts = {};
|
||||
if (typeof opts === 'function') opts = { cmp: opts };
|
||||
var cmp = opts.cmp && (function (f) {
|
||||
return function (node) {
|
||||
return function (a, b) {
|
||||
var aobj = { key: a, value: node[a] };
|
||||
var bobj = { key: b, value: node[b] };
|
||||
return f(aobj, bobj);
|
||||
};
|
||||
};
|
||||
})(opts.cmp);
|
||||
|
||||
return (function stringify (node) {
|
||||
if (typeof node !== 'object' || node === null) {
|
||||
return json.stringify(node);
|
||||
}
|
||||
if (isArray(node)) {
|
||||
var out = [];
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
out.push(stringify(node[i]));
|
||||
}
|
||||
return '[' + out.join(',') + ']';
|
||||
}
|
||||
else {
|
||||
var keys = objectKeys(node).sort(cmp && cmp(node));
|
||||
var out = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
out.push(stringify(key) + ':' + stringify(node[key]));
|
||||
}
|
||||
return '{' + out.join(',') + '}';
|
||||
}
|
||||
})(obj);
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (x) {
|
||||
return {}.toString.call(x) === '[object Array]';
|
||||
};
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var has = Object.prototype.hasOwnProperty || function () { return true };
|
||||
var keys = [];
|
||||
for (var key in obj) {
|
||||
if (has.call(obj, key)) keys.push(key);
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
74
build/node_modules/shasum/node_modules/json-stable-stringify/package.json
generated
vendored
Normal file
74
build/node_modules/shasum/node_modules/json-stable-stringify/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "json-stable-stringify@~0.0.0",
|
||||
"_id": "json-stable-stringify@0.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=",
|
||||
"_location": "/shasum/json-stable-stringify",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "json-stable-stringify@~0.0.0",
|
||||
"name": "json-stable-stringify",
|
||||
"escapedName": "json-stable-stringify",
|
||||
"rawSpec": "~0.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/shasum"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz",
|
||||
"_shasum": "611c23e814db375527df851193db59dd2af27f45",
|
||||
"_spec": "json-stable-stringify@~0.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/shasum",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/json-stable-stringify/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"jsonify": "~0.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results",
|
||||
"devDependencies": {
|
||||
"tape": "~1.0.4"
|
||||
},
|
||||
"homepage": "https://github.com/substack/json-stable-stringify",
|
||||
"keywords": [
|
||||
"json",
|
||||
"stringify",
|
||||
"deterministic",
|
||||
"hash",
|
||||
"sort",
|
||||
"stable"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "json-stable-stringify",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/json-stable-stringify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"ff/5",
|
||||
"ff/latest",
|
||||
"chrome/15",
|
||||
"chrome/latest",
|
||||
"safari/latest",
|
||||
"opera/latest"
|
||||
]
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
||||
90
build/node_modules/shasum/node_modules/json-stable-stringify/readme.markdown
generated
vendored
Normal file
90
build/node_modules/shasum/node_modules/json-stable-stringify/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
# json-stable-stringify
|
||||
|
||||
deterministic version of `JSON.stringify()` so you can get a consistent hash
|
||||
from stringified results
|
||||
|
||||
You can also pass in a custom comparison function.
|
||||
|
||||
[](https://ci.testling.com/substack/json-stable-stringify)
|
||||
|
||||
[](http://travis-ci.org/substack/json-stable-stringify)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var stringify = require('json-stable-stringify');
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
console.log(stringify(obj));
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var stringify = require('json-stable-stringify')
|
||||
```
|
||||
|
||||
## var str = stringify(obj, opts)
|
||||
|
||||
Return a deterministic stringified string `str` from the object `obj`.
|
||||
|
||||
If `opts` is given, you can supply an `opts.cmp` to have a custom comparison
|
||||
function for object keys. Your function `opts.cmp` is called with these
|
||||
parameters:
|
||||
|
||||
``` js
|
||||
opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue })
|
||||
```
|
||||
|
||||
For example, to sort on the object key names in reverse order you could write:
|
||||
|
||||
``` js
|
||||
var stringify = require('json-stable-stringify');
|
||||
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
var s = stringify(obj, function (a, b) {
|
||||
return a.key < b.key ? 1 : -1;
|
||||
});
|
||||
console.log(s);
|
||||
```
|
||||
|
||||
which results in the output string:
|
||||
|
||||
```
|
||||
{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}
|
||||
```
|
||||
|
||||
Or if you wanted to sort on the object values in reverse order, you could write:
|
||||
|
||||
```
|
||||
var stringify = require('json-stable-stringify');
|
||||
|
||||
var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 };
|
||||
var s = stringify(obj, function (a, b) {
|
||||
return a.value < b.value ? 1 : -1;
|
||||
});
|
||||
console.log(s);
|
||||
```
|
||||
|
||||
which outputs:
|
||||
|
||||
```
|
||||
{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10}
|
||||
```
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install json-stable-stringify
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
11
build/node_modules/shasum/node_modules/json-stable-stringify/test/cmp.js
generated
vendored
Normal file
11
build/node_modules/shasum/node_modules/json-stable-stringify/test/cmp.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var test = require('tape');
|
||||
var stringify = require('../');
|
||||
|
||||
test('custom comparison function', function (t) {
|
||||
t.plan(1);
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
var s = stringify(obj, function (a, b) {
|
||||
return a.key < b.key ? 1 : -1;
|
||||
});
|
||||
t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}');
|
||||
});
|
||||
8
build/node_modules/shasum/node_modules/json-stable-stringify/test/nested.js
generated
vendored
Normal file
8
build/node_modules/shasum/node_modules/json-stable-stringify/test/nested.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var test = require('tape');
|
||||
var stringify = require('../');
|
||||
|
||||
test('nested', function (t) {
|
||||
t.plan(1);
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}');
|
||||
});
|
||||
8
build/node_modules/shasum/node_modules/json-stable-stringify/test/str.js
generated
vendored
Normal file
8
build/node_modules/shasum/node_modules/json-stable-stringify/test/str.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var test = require('tape');
|
||||
var stringify = require('../');
|
||||
|
||||
test('simple object', function (t) {
|
||||
t.plan(1);
|
||||
var obj = { c: 6, b: [4,5], a: 3, z: null };
|
||||
t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}');
|
||||
});
|
||||
58
build/node_modules/shasum/package.json
generated
vendored
Normal file
58
build/node_modules/shasum/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "shasum@^1.0.0",
|
||||
"_id": "shasum@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=",
|
||||
"_location": "/shasum",
|
||||
"_phantomChildren": {
|
||||
"jsonify": "0.0.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "shasum@^1.0.0",
|
||||
"name": "shasum",
|
||||
"escapedName": "shasum",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserify",
|
||||
"/deps-sort"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz",
|
||||
"_shasum": "e7012310d8f417f4deb5712150e5678b87ae565f",
|
||||
"_spec": "shasum@^1.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/browserify",
|
||||
"author": {
|
||||
"name": "'Dominic Tarr'",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "http://dominictarr.com"
|
||||
},
|
||||
"browser": {
|
||||
"./index.js": "./browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/shasum/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"json-stable-stringify": "~0.0.0",
|
||||
"sha.js": "~2.4.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Single function that return the sha1sum. Installing this is just a little bit quicker than reading the crypto documentation.",
|
||||
"devDependencies": {},
|
||||
"homepage": "https://github.com/dominictarr/shasum",
|
||||
"license": "MIT",
|
||||
"name": "shasum",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/shasum.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/index.js && node test/index.js browser"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
18
build/node_modules/shasum/test/index.js
generated
vendored
Normal file
18
build/node_modules/shasum/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var equal = require('assert').equal
|
||||
var hash = require(process.argv[2] === 'browser' ? '../browser.js' : '..')
|
||||
|
||||
|
||||
equal(hash('abc'), 'a9993e364706816aba3e25717850c26c9cd0d89d')
|
||||
equal(hash('abce'), '0a431a7631cabf6b11b984a943127b5e0aa9d687')
|
||||
equal(hash({}), 'bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f')
|
||||
equal(hash([]), '97d170e1550eee4afc0af065b78cda302a97674c')
|
||||
equal(hash(new Buffer('abc')),
|
||||
'a9993e364706816aba3e25717850c26c9cd0d89d')
|
||||
equal(hash('ab\xff'),'ba5142a8207bd61baddf325088732e71cbfe8eb6')
|
||||
equal(hash(new Buffer('ab\xff').toString()),
|
||||
'ba5142a8207bd61baddf325088732e71cbfe8eb6')
|
||||
equal(hash({a:1,b:2,c:3}), hash({c:3,b:2,a:1}))
|
||||
equal(hash({a:1,b:2,c:3}), hash({c:3,b:2,a:1}))
|
||||
equal(hash({a:1,b:[2,3],c:4}), hash({c:4,b:[2,3],a:1}))
|
||||
equal(hash({a:1,b:[2,{c:3,d:4}],e:5}), hash({e:5,b:[2,{d:4,c:3}],a:1}))
|
||||
|
||||
Reference in New Issue
Block a user