vulcan 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -80
- data/lib/vulcan/cli.rb +12 -33
- data/lib/vulcan/version.rb +1 -1
- data/server/bin/make +3 -1
- data/server/lib/spawner.js +4 -9
- data/server/node_modules/connect-form/node_modules/formidable/Readme.md +2 -13
- data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +7 -19
- data/server/node_modules/connect-form/node_modules/formidable/lib/multipart_parser.js +1 -12
- data/server/node_modules/connect-form/node_modules/formidable/package.json +1 -1
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +10 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +9 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +1 -1
- data/server/node_modules/cradle/lib/cradle.js +1 -0
- data/server/node_modules/cradle/node_modules/vows/LICENSE +20 -0
- data/server/node_modules/cradle/node_modules/vows/Makefile +7 -0
- data/server/node_modules/cradle/node_modules/vows/README.md +39 -0
- data/server/node_modules/cradle/node_modules/vows/bin/vows +515 -0
- data/server/node_modules/cradle/node_modules/vows/lib/assert/error.js +27 -0
- data/server/node_modules/cradle/node_modules/vows/lib/assert/macros.js +215 -0
- data/server/node_modules/cradle/node_modules/vows/lib/assert/utils.js +77 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows.js +193 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/console.js +131 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/context.js +55 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/file.js +29 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html +2 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html +61 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-html.js +54 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-json.js +54 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-plain.js +38 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/extras.js +28 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/dot-matrix.js +67 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/json.js +16 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/silent.js +8 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/spec.js +44 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/watch.js +39 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/xunit.js +90 -0
- data/server/node_modules/cradle/node_modules/vows/lib/vows/suite.js +319 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/LICENSE +20 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/Makefile +4 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/README.md +72 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/lib/eyes.js +233 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/package.json +14 -0
- data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/test/eyes-test.js +55 -0
- data/server/node_modules/cradle/node_modules/vows/package.json +14 -0
- data/server/node_modules/cradle/node_modules/vows/test/assert-test.js +135 -0
- data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/failing.js +18 -0
- data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/log.js +18 -0
- data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/passing.js +17 -0
- data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/stderr.js +18 -0
- data/server/node_modules/cradle/node_modules/vows/test/isolate-test.js +140 -0
- data/server/node_modules/cradle/node_modules/vows/test/testInherit.js +133 -0
- data/server/node_modules/cradle/node_modules/vows/test/vows-error-test.js +51 -0
- data/server/node_modules/cradle/node_modules/vows/test/vows-test.js +374 -0
- data/server/node_modules/cradle/package.json +3 -3
- data/server/node_modules/cradle/test/cache-test.js +7 -6
- data/server/node_modules/cradle/test/cradle-test.js +5 -4
- data/server/node_modules/cradle/test/response-test.js +6 -5
- data/server/node_modules/express/History.md +1 -53
- data/server/node_modules/express/Makefile +9 -3
- data/server/node_modules/express/Readme.md +1 -3
- data/server/node_modules/express/bin/express +66 -65
- data/server/node_modules/express/lib/express.js +1 -1
- data/server/node_modules/express/lib/request.js +9 -23
- data/server/node_modules/express/lib/response.js +2 -3
- data/server/node_modules/express/lib/utils.js +0 -13
- data/server/node_modules/express/lib/view.js +16 -19
- data/server/node_modules/express/lib/view/view.js +1 -2
- data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
- data/server/node_modules/express/node_modules/connect/lib/http.js +0 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +31 -135
- data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +1 -5
- data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +2 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/static.js +21 -26
- data/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +38 -91
- data/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js +1 -1
- data/server/node_modules/express/node_modules/connect/lib/utils.js +4 -11
- data/server/node_modules/express/node_modules/connect/package.json +6 -7
- data/server/node_modules/express/node_modules/connect/test.js +31 -44
- data/server/node_modules/express/node_modules/mime/index.js +1 -0
- data/server/node_modules/express/node_modules/mime/mime.js +3 -3
- data/server/node_modules/express/node_modules/mime/{types/mime.types → mime.types} +0 -0
- data/server/node_modules/express/node_modules/mime/{types/node.types → node.types} +0 -17
- data/server/node_modules/express/node_modules/mime/package.json +10 -21
- data/server/node_modules/express/node_modules/mime/test.js +3 -2
- data/server/node_modules/express/node_modules/qs/History.md +0 -11
- data/server/node_modules/express/node_modules/qs/Makefile +3 -1
- data/server/node_modules/express/node_modules/qs/Readme.md +4 -2
- data/server/node_modules/express/node_modules/qs/lib/querystring.js +74 -100
- data/server/node_modules/express/node_modules/qs/package.json +2 -9
- data/server/node_modules/express/node_modules/qs/support/expresso/History.md +128 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/Makefile +53 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/Readme.md +61 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/bin/expresso +856 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/docs/api.html +1080 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.html +377 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.md +290 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/lib/bar.js +4 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/lib/foo.js +16 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/package.json +12 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/assert.test.js +91 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/async.test.js +12 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/bar.test.js +13 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/foo.test.js +14 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/http.test.js +146 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
- data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
- data/server/node_modules/express/node_modules/qs/support/should/History.md +22 -0
- data/server/node_modules/express/node_modules/qs/support/should/Makefile +6 -0
- data/server/node_modules/express/node_modules/qs/support/should/Readme.md +248 -0
- data/server/node_modules/express/node_modules/qs/support/should/examples/runner.js +53 -0
- data/server/node_modules/express/node_modules/qs/support/should/index.js +2 -0
- data/server/node_modules/express/node_modules/qs/support/should/lib/eql.js +91 -0
- data/server/node_modules/express/node_modules/qs/support/should/lib/should.js +548 -0
- data/server/node_modules/express/node_modules/qs/support/should/package.json +8 -0
- data/server/node_modules/express/node_modules/qs/support/should/test/should.test.js +358 -0
- data/server/node_modules/express/node_modules/qs/test/{parse.js → parse.test.js} +2 -1
- data/server/node_modules/express/node_modules/qs/test/{stringify.js → stringify.test.js} +0 -0
- data/server/node_modules/express/package.json +8 -9
- data/server/node_modules/node-uuid/README.md +67 -166
- data/server/node_modules/node-uuid/package.json +3 -5
- data/server/node_modules/node-uuid/{benchmark → test}/benchmark-native.c +0 -0
- data/server/node_modules/node-uuid/test/benchmark.js +27 -0
- data/server/node_modules/node-uuid/test/test.html +0 -3
- data/server/node_modules/node-uuid/test/test.js +57 -214
- data/server/node_modules/node-uuid/uuid.js +56 -225
- data/server/node_modules/restler/README.md +7 -20
- data/server/node_modules/restler/bin/restler +1 -1
- data/server/node_modules/restler/lib/multipartform.js +8 -9
- data/server/node_modules/restler/lib/restler.js +22 -64
- data/server/node_modules/restler/package.json +2 -2
- data/server/node_modules/restler/test/restler.js +2 -22
- data/server/node_modules/restler/test/test_helper.js +1 -20
- data/server/package.json +10 -10
- data/server/web.js +7 -30
- metadata +96 -89
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/plain.txt +0 -1
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/no-filename.js +0 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/Makefile +0 -14
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +0 -286
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/TODO +0 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js +0 -70
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js +0 -43
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js +0 -48
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js +0 -1
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js +0 -61
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +0 -377
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js +0 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js +0 -312
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js +0 -25
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js +0 -6
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js +0 -19
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt +0 -1
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt +0 -1
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md +0 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js +0 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +0 -21
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js +0 -72
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js +0 -89
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js +0 -80
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js +0 -104
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +0 -715
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +0 -50
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js +0 -45
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js +0 -72
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js +0 -2
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js +0 -63
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js +0 -47
- data/server/node_modules/express/node_modules/mkdirp/LICENSE +0 -21
- data/server/node_modules/express/node_modules/mkdirp/README.markdown +0 -21
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +0 -6
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.orig +0 -6
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.rej +0 -19
- data/server/node_modules/express/node_modules/mkdirp/index.js +0 -20
- data/server/node_modules/express/node_modules/mkdirp/package.json +0 -23
- data/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js +0 -28
- data/server/node_modules/express/node_modules/mkdirp/test/race.js +0 -41
- data/server/node_modules/express/node_modules/mkdirp/test/rel.js +0 -32
- data/server/node_modules/express/node_modules/qs/test/mocha.opts +0 -2
- data/server/node_modules/express/testing/foo/app.js +0 -35
- data/server/node_modules/express/testing/foo/package.json +0 -9
- data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
- data/server/node_modules/express/testing/foo/routes/index.js +0 -10
- data/server/node_modules/express/testing/foo/views/index.jade +0 -2
- data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
- data/server/node_modules/express/testing/index.js +0 -43
- data/server/node_modules/express/testing/public/test.txt +0 -2971
- data/server/node_modules/express/testing/views/page.html +0 -1
- data/server/node_modules/express/testing/views/page.jade +0 -3
- data/server/node_modules/express/testing/views/test.md +0 -1
- data/server/node_modules/express/testing/views/user/index.jade +0 -1
- data/server/node_modules/express/testing/views/user/list.jade +0 -1
- data/server/node_modules/node-uuid/benchmark/README.md +0 -53
- data/server/node_modules/node-uuid/benchmark/bench.gnu +0 -174
- data/server/node_modules/node-uuid/benchmark/bench.sh +0 -34
- data/server/node_modules/node-uuid/benchmark/benchmark.js +0 -84
- data/server/node_modules/node-uuid/test/benchmark-native +0 -0
- data/server/node_modules/node-uuid/test/compare_v1.js +0 -63
@@ -0,0 +1,8 @@
|
|
1
|
+
{ "name": "should"
|
2
|
+
, "description": "test framework agnostic BDD-style assertions"
|
3
|
+
, "version": "0.0.4"
|
4
|
+
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
5
|
+
, "keywords": ["test", "bdd", "assert"]
|
6
|
+
, "main": "./lib/should.js"
|
7
|
+
, "engines": { "node": ">= 0.2.0" }
|
8
|
+
}
|
@@ -0,0 +1,358 @@
|
|
1
|
+
|
2
|
+
/**
|
3
|
+
* Module dependencies.
|
4
|
+
*/
|
5
|
+
|
6
|
+
var should = require('should');
|
7
|
+
|
8
|
+
function err(fn, msg) {
|
9
|
+
try {
|
10
|
+
fn();
|
11
|
+
should.fail('expected an error');
|
12
|
+
} catch (err) {
|
13
|
+
should.equal(msg, err.message);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
module.exports = {
|
18
|
+
'test .version': function(){
|
19
|
+
should.version.should.match(/^\d+\.\d+\.\d+$/);
|
20
|
+
},
|
21
|
+
|
22
|
+
'test double require': function(){
|
23
|
+
require('should').should.equal(should);
|
24
|
+
},
|
25
|
+
|
26
|
+
'test assertion': function(){
|
27
|
+
'test'.should.be.a.string;
|
28
|
+
should.equal('foo', 'foo');
|
29
|
+
},
|
30
|
+
|
31
|
+
'test true': function(){
|
32
|
+
true.should.be.true;
|
33
|
+
false.should.not.be.true;
|
34
|
+
(1).should.not.be.true;
|
35
|
+
|
36
|
+
err(function(){
|
37
|
+
'test'.should.be.true;
|
38
|
+
}, "expected 'test' to be true")
|
39
|
+
},
|
40
|
+
|
41
|
+
'test ok': function(){
|
42
|
+
true.should.be.ok;
|
43
|
+
false.should.not.be.ok;
|
44
|
+
(1).should.be.ok;
|
45
|
+
(0).should.not.be.ok;
|
46
|
+
|
47
|
+
err(function(){
|
48
|
+
''.should.be.ok;
|
49
|
+
}, "expected '' to be truthy");
|
50
|
+
|
51
|
+
err(function(){
|
52
|
+
'test'.should.not.be.ok;
|
53
|
+
}, "expected 'test' to be falsey");
|
54
|
+
},
|
55
|
+
|
56
|
+
'test false': function(){
|
57
|
+
false.should.be.false;
|
58
|
+
true.should.not.be.false;
|
59
|
+
(0).should.not.be.false;
|
60
|
+
|
61
|
+
err(function(){
|
62
|
+
''.should.be.false;
|
63
|
+
}, "expected '' to be false")
|
64
|
+
},
|
65
|
+
|
66
|
+
'test arguments': function(){
|
67
|
+
var args = (function(){ return arguments; })(1,2,3);
|
68
|
+
args.should.be.arguments;
|
69
|
+
[].should.not.be.arguments;
|
70
|
+
},
|
71
|
+
|
72
|
+
'test .equal()': function(){
|
73
|
+
var foo;
|
74
|
+
should.equal(undefined, foo);
|
75
|
+
},
|
76
|
+
|
77
|
+
'test typeof': function(){
|
78
|
+
'test'.should.be.a('string');
|
79
|
+
|
80
|
+
err(function(){
|
81
|
+
'test'.should.not.be.a('string');
|
82
|
+
}, "expected 'test' not to be a string");
|
83
|
+
|
84
|
+
(5).should.be.a('number');
|
85
|
+
|
86
|
+
err(function(){
|
87
|
+
(5).should.not.be.a('number');
|
88
|
+
}, "expected 5 not to be a number");
|
89
|
+
},
|
90
|
+
|
91
|
+
'test instanceof': function(){
|
92
|
+
function Foo(){}
|
93
|
+
new Foo().should.be.an.instanceof(Foo);
|
94
|
+
|
95
|
+
err(function(){
|
96
|
+
(3).should.an.instanceof(Foo);
|
97
|
+
}, "expected 3 to be an instance of Foo");
|
98
|
+
},
|
99
|
+
|
100
|
+
'test within(start, finish)': function(){
|
101
|
+
(5).should.be.within(5, 10);
|
102
|
+
(5).should.be.within(3,6);
|
103
|
+
(5).should.be.within(3,5);
|
104
|
+
(5).should.not.be.within(1,3);
|
105
|
+
|
106
|
+
err(function(){
|
107
|
+
(5).should.not.be.within(4,6);
|
108
|
+
}, "expected 5 to not be within 4..6");
|
109
|
+
|
110
|
+
err(function(){
|
111
|
+
(10).should.be.within(50,100);
|
112
|
+
}, "expected 10 to be within 50..100");
|
113
|
+
},
|
114
|
+
|
115
|
+
'test above(n)': function(){
|
116
|
+
(5).should.be.above(2);
|
117
|
+
(5).should.be.greaterThan(2);
|
118
|
+
(5).should.not.be.above(5);
|
119
|
+
(5).should.not.be.above(6);
|
120
|
+
|
121
|
+
err(function(){
|
122
|
+
(5).should.be.above(6);
|
123
|
+
}, "expected 5 to be above 6");
|
124
|
+
|
125
|
+
err(function(){
|
126
|
+
(10).should.not.be.above(6);
|
127
|
+
}, "expected 10 to be below 6");
|
128
|
+
},
|
129
|
+
|
130
|
+
'test match(regexp)': function(){
|
131
|
+
'foobar'.should.match(/^foo/)
|
132
|
+
'foobar'.should.not.match(/^bar/)
|
133
|
+
|
134
|
+
err(function(){
|
135
|
+
'foobar'.should.match(/^bar/i)
|
136
|
+
}, "expected 'foobar' to match /^bar/i");
|
137
|
+
|
138
|
+
err(function(){
|
139
|
+
'foobar'.should.not.match(/^foo/i)
|
140
|
+
}, "expected 'foobar' not to match /^foo/i");
|
141
|
+
},
|
142
|
+
|
143
|
+
'test length(n)': function(){
|
144
|
+
'test'.should.have.length(4);
|
145
|
+
'test'.should.not.have.length(3);
|
146
|
+
[1,2,3].should.have.length(3);
|
147
|
+
|
148
|
+
err(function(){
|
149
|
+
(4).should.have.length(3);
|
150
|
+
}, 'expected 4 to have a property \'length\'');
|
151
|
+
|
152
|
+
err(function(){
|
153
|
+
'asd'.should.not.have.length(3);
|
154
|
+
}, "expected 'asd' to not have a length of 3");
|
155
|
+
},
|
156
|
+
|
157
|
+
'test eql(val)': function(){
|
158
|
+
'test'.should.eql('test');
|
159
|
+
({ foo: 'bar' }).should.eql({ foo: 'bar' });
|
160
|
+
(1).should.eql(1);
|
161
|
+
'4'.should.eql(4);
|
162
|
+
|
163
|
+
err(function(){
|
164
|
+
(4).should.eql(3);
|
165
|
+
}, 'expected 4 to equal 3');
|
166
|
+
},
|
167
|
+
|
168
|
+
'test equal(val)': function(){
|
169
|
+
'test'.should.equal('test');
|
170
|
+
(1).should.equal(1);
|
171
|
+
|
172
|
+
err(function(){
|
173
|
+
(4).should.equal(3);
|
174
|
+
}, 'expected 4 to equal 3');
|
175
|
+
|
176
|
+
err(function(){
|
177
|
+
'4'.should.equal(4);
|
178
|
+
}, "expected '4' to equal 4");
|
179
|
+
},
|
180
|
+
|
181
|
+
'test empty': function(){
|
182
|
+
''.should.be.empty;
|
183
|
+
[].should.be.empty;
|
184
|
+
({ length: 0 }).should.be.empty;
|
185
|
+
|
186
|
+
err(function(){
|
187
|
+
({}).should.be.empty;
|
188
|
+
}, 'expected {} to have a property \'length\'');
|
189
|
+
|
190
|
+
err(function(){
|
191
|
+
'asd'.should.be.empty;
|
192
|
+
}, "expected 'asd' to be empty");
|
193
|
+
|
194
|
+
err(function(){
|
195
|
+
''.should.not.be.empty;
|
196
|
+
}, "expected '' not to be empty");
|
197
|
+
},
|
198
|
+
|
199
|
+
'test property(name)': function(){
|
200
|
+
'test'.should.have.property('length');
|
201
|
+
(4).should.not.have.property('length');
|
202
|
+
|
203
|
+
err(function(){
|
204
|
+
'asd'.should.have.property('foo');
|
205
|
+
}, "expected 'asd' to have a property 'foo'");
|
206
|
+
},
|
207
|
+
|
208
|
+
'test property(name, val)': function(){
|
209
|
+
'test'.should.have.property('length', 4);
|
210
|
+
'asd'.should.have.property('constructor', String);
|
211
|
+
|
212
|
+
err(function(){
|
213
|
+
'asd'.should.have.property('length', 4);
|
214
|
+
}, "expected 'asd' to have a property 'length' of 4, but got 3");
|
215
|
+
|
216
|
+
err(function(){
|
217
|
+
'asd'.should.not.have.property('length', 3);
|
218
|
+
}, "expected 'asd' to not have a property 'length' of 3");
|
219
|
+
|
220
|
+
err(function(){
|
221
|
+
'asd'.should.not.have.property('foo', 3);
|
222
|
+
}, "'asd' has no property 'foo'");
|
223
|
+
|
224
|
+
err(function(){
|
225
|
+
'asd'.should.have.property('constructor', Number);
|
226
|
+
}, "expected 'asd' to have a property 'constructor' of [Function: Number], but got [Function: String]");
|
227
|
+
},
|
228
|
+
|
229
|
+
'test ownProperty(name)': function(){
|
230
|
+
'test'.should.have.ownProperty('length');
|
231
|
+
'test'.should.haveOwnProperty('length');
|
232
|
+
({ length: 12 }).should.have.ownProperty('length');
|
233
|
+
|
234
|
+
err(function(){
|
235
|
+
({ length: 12 }).should.not.have.ownProperty('length');
|
236
|
+
}, "expected { length: 12 } to not have own property 'length'");
|
237
|
+
},
|
238
|
+
|
239
|
+
'test string()': function(){
|
240
|
+
'foobar'.should.include.string('bar');
|
241
|
+
'foobar'.should.include.string('foo');
|
242
|
+
'foobar'.should.not.include.string('baz');
|
243
|
+
|
244
|
+
err(function(){
|
245
|
+
(3).should.include.string('baz');
|
246
|
+
}, "expected 3 to be a string");
|
247
|
+
|
248
|
+
err(function(){
|
249
|
+
'foobar'.should.include.string('baz');
|
250
|
+
}, "expected 'foobar' to include 'baz'");
|
251
|
+
|
252
|
+
err(function(){
|
253
|
+
'foobar'.should.not.include.string('bar');
|
254
|
+
}, "expected 'foobar' to not include 'bar'");
|
255
|
+
},
|
256
|
+
|
257
|
+
'test contain()': function(){
|
258
|
+
['foo', 'bar'].should.contain('foo');
|
259
|
+
['foo', 'bar'].should.contain('foo');
|
260
|
+
['foo', 'bar'].should.contain('bar');
|
261
|
+
[1,2].should.contain(1);
|
262
|
+
['foo', 'bar'].should.not.contain('baz');
|
263
|
+
['foo', 'bar'].should.not.contain(1);
|
264
|
+
|
265
|
+
err(function(){
|
266
|
+
['foo'].should.contain('bar');
|
267
|
+
}, "expected [ 'foo' ] to contain 'bar'");
|
268
|
+
|
269
|
+
err(function(){
|
270
|
+
['bar', 'foo'].should.not.contain('foo');
|
271
|
+
}, "expected [ 'bar', 'foo' ] to not contain 'foo'");
|
272
|
+
},
|
273
|
+
|
274
|
+
'test keys(array)': function(){
|
275
|
+
({ foo: 1 }).should.have.keys(['foo']);
|
276
|
+
({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']);
|
277
|
+
({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar');
|
278
|
+
({ foo: 1, bar: 2, baz: 3 }).should.include.keys('foo', 'bar');
|
279
|
+
({ foo: 1, bar: 2, baz: 3 }).should.include.keys('bar', 'foo');
|
280
|
+
({ foo: 1, bar: 2, baz: 3 }).should.include.keys('baz');
|
281
|
+
|
282
|
+
({ foo: 1, bar: 2 }).should.include.keys('foo');
|
283
|
+
({ foo: 1, bar: 2 }).should.include.keys('bar', 'foo');
|
284
|
+
({ foo: 1, bar: 2 }).should.include.keys(['foo']);
|
285
|
+
({ foo: 1, bar: 2 }).should.include.keys(['bar']);
|
286
|
+
({ foo: 1, bar: 2 }).should.include.keys(['bar', 'foo']);
|
287
|
+
|
288
|
+
({ foo: 1, bar: 2 }).should.not.have.keys('baz');
|
289
|
+
({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz');
|
290
|
+
({ foo: 1, bar: 2 }).should.not.include.keys('baz');
|
291
|
+
({ foo: 1, bar: 2 }).should.not.include.keys('foo', 'baz');
|
292
|
+
({ foo: 1, bar: 2 }).should.not.include.keys('baz', 'foo');
|
293
|
+
|
294
|
+
err(function(){
|
295
|
+
({ foo: 1 }).should.have.keys();
|
296
|
+
}, "keys required");
|
297
|
+
|
298
|
+
err(function(){
|
299
|
+
({ foo: 1 }).should.have.keys([]);
|
300
|
+
}, "keys required");
|
301
|
+
|
302
|
+
err(function(){
|
303
|
+
({ foo: 1 }).should.not.have.keys([]);
|
304
|
+
}, "keys required");
|
305
|
+
|
306
|
+
err(function(){
|
307
|
+
({ foo: 1 }).should.include.keys([]);
|
308
|
+
}, "keys required");
|
309
|
+
|
310
|
+
err(function(){
|
311
|
+
({ foo: 1 }).should.have.keys(['bar']);
|
312
|
+
}, "expected { foo: 1 } to have key 'bar'");
|
313
|
+
|
314
|
+
err(function(){
|
315
|
+
({ foo: 1 }).should.have.keys(['bar', 'baz']);
|
316
|
+
}, "expected { foo: 1 } to have keys 'bar', and 'baz'");
|
317
|
+
|
318
|
+
err(function(){
|
319
|
+
({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']);
|
320
|
+
}, "expected { foo: 1 } to have keys 'foo', 'bar', and 'baz'");
|
321
|
+
|
322
|
+
err(function(){
|
323
|
+
({ foo: 1 }).should.not.have.keys(['foo']);
|
324
|
+
}, "expected { foo: 1 } to not have key 'foo'");
|
325
|
+
|
326
|
+
err(function(){
|
327
|
+
({ foo: 1 }).should.not.have.keys(['foo']);
|
328
|
+
}, "expected { foo: 1 } to not have key 'foo'");
|
329
|
+
|
330
|
+
err(function(){
|
331
|
+
({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']);
|
332
|
+
}, "expected { foo: 1, bar: 2 } to not have keys 'foo', and 'bar'");
|
333
|
+
|
334
|
+
err(function(){
|
335
|
+
({ foo: 1 }).should.not.include.keys(['foo']);
|
336
|
+
}, "expected { foo: 1 } to not include key 'foo'");
|
337
|
+
|
338
|
+
err(function(){
|
339
|
+
({ foo: 1 }).should.include.keys('foo', 'bar');
|
340
|
+
}, "expected { foo: 1 } to include keys 'foo', and 'bar'");
|
341
|
+
},
|
342
|
+
|
343
|
+
'test respondTo(method)': function(){
|
344
|
+
'test'.should.respondTo('toString');
|
345
|
+
'test'.should.not.respondTo('toBuffer');
|
346
|
+
},
|
347
|
+
|
348
|
+
'test chaining': function(){
|
349
|
+
var user = { name: 'tj', pets: ['tobi', 'loki', 'jane', 'bandit'] };
|
350
|
+
user.should.have.property('pets').with.lengthOf(4);
|
351
|
+
|
352
|
+
err(function(){
|
353
|
+
user.should.have.property('pets').with.lengthOf(5);
|
354
|
+
}, "expected [ 'tobi', 'loki', 'jane', 'bandit' ] to have a length of 5 but got 4");
|
355
|
+
|
356
|
+
user.should.be.a('object').and.have.property('name', 'tj');
|
357
|
+
}
|
358
|
+
};
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "express",
|
3
3
|
"description": "Sinatra inspired web development framework",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.4.6",
|
5
5
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
6
6
|
"contributors": [
|
7
7
|
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
|
@@ -10,19 +10,18 @@
|
|
10
10
|
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
|
11
11
|
],
|
12
12
|
"dependencies": {
|
13
|
-
"connect": "1.
|
13
|
+
"connect": ">= 1.5.2 < 2.0.0",
|
14
14
|
"mime": ">= 0.0.1",
|
15
|
-
"qs": ">= 0.3.1"
|
16
|
-
"mkdirp": "0.0.7"
|
15
|
+
"qs": ">= 0.3.1"
|
17
16
|
},
|
18
17
|
"devDependencies": {
|
19
18
|
"connect-form": "0.2.1",
|
20
19
|
"ejs": "0.4.2",
|
21
|
-
"expresso": "0.
|
22
|
-
"hamljs": "0.
|
23
|
-
"jade": "0.
|
20
|
+
"expresso": "0.7.2",
|
21
|
+
"hamljs": "0.5.1",
|
22
|
+
"jade": "0.11.0",
|
24
23
|
"stylus": "0.13.0",
|
25
|
-
"should": "0.
|
24
|
+
"should": "0.2.1",
|
26
25
|
"express-messages": "0.0.2",
|
27
26
|
"node-markdown": ">= 0.0.1",
|
28
27
|
"connect-redis": ">= 0.0.1"
|
@@ -35,5 +34,5 @@
|
|
35
34
|
"test": "make test",
|
36
35
|
"prepublish" : "npm prune"
|
37
36
|
},
|
38
|
-
"engines": { "node": ">= 0.4.1 < 0.
|
37
|
+
"engines": { "node": ">= 0.4.1 < 0.5.0" }
|
39
38
|
}
|
@@ -1,199 +1,100 @@
|
|
1
1
|
# node-uuid
|
2
2
|
|
3
|
-
Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
|
3
|
+
Simple, fast generation of RFC4122[RFC4122(v4)](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. It runs in node.js and all major browsers.
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
* Runs in node.js and all browsers.
|
9
|
-
* Cryptographically strong random # generation on supporting platforms
|
10
|
-
* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )
|
11
|
-
* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)
|
7
|
+
npm install node-uuid
|
12
8
|
|
13
|
-
|
9
|
+
### In browser
|
14
10
|
|
15
|
-
|
11
|
+
<script src="uuid.js"></script>
|
16
12
|
|
17
|
-
|
18
|
-
<script src="uuid.js"></script>
|
19
|
-
```
|
13
|
+
### In node.js
|
20
14
|
|
21
|
-
|
15
|
+
var uuid = require('node-uuid');
|
22
16
|
|
23
|
-
|
24
|
-
npm install node-uuid
|
25
|
-
```
|
17
|
+
## Usage
|
26
18
|
|
27
|
-
|
28
|
-
var uuid = require('node-uuid');
|
29
|
-
```
|
19
|
+
### Generate a String UUID
|
30
20
|
|
31
|
-
|
21
|
+
var id = uuid(); // -> '92329D39-6F5C-4520-ABFC-AAB64544E172'
|
32
22
|
|
33
|
-
|
34
|
-
// Generate a v1 (time-based) id
|
35
|
-
uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
|
23
|
+
### Generate a Binary UUID
|
36
24
|
|
37
|
-
//
|
38
|
-
|
39
|
-
|
25
|
+
// Simple form - allocates a Buffer/Array for you
|
26
|
+
var buf = uuid('binary');
|
27
|
+
// node.js -> <Buffer 08 50 05 c8 9c b2 4c 07 ac 07 d1 4f b9 f5 04 51>
|
28
|
+
// browser -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81]
|
40
29
|
|
41
|
-
|
30
|
+
// Provide your own Buffer or Array
|
31
|
+
var buf = new Array(16);
|
32
|
+
uuid('binary', buf); // -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81]
|
33
|
+
var buf = new Buffer(16);
|
34
|
+
uuid('binary', buf); // -> <Buffer 08 50 05 c8 9c b2 4c 07 ac 07 d1 4f b9 f5 04 51>
|
42
35
|
|
43
|
-
|
36
|
+
// Provide your own Buffer/Array, plus specify offset
|
37
|
+
// (e.g. here we fill an array with 3 uuids)
|
38
|
+
var buf = new Buffer(16 \* 3);
|
39
|
+
uuid('binary', id, 0);
|
40
|
+
uuid('binary', id, 16);
|
41
|
+
uuid('binary', id, 32);
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
* `options` - (Object) Optional uuid state to apply. Properties may include:
|
48
|
-
|
49
|
-
* `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomnly generated ID. See note 1.
|
50
|
-
* `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
|
51
|
-
* `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.
|
52
|
-
* `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
|
53
|
-
|
54
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
55
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
56
|
-
|
57
|
-
Returns `buffer`, if specified, otherwise the string form of the UUID
|
58
|
-
|
59
|
-
Notes:
|
60
|
-
|
61
|
-
1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
|
62
|
-
|
63
|
-
Example: Generate string UUID with fully-specified options
|
64
|
-
|
65
|
-
```javascript
|
66
|
-
uuid.v1({
|
67
|
-
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
68
|
-
clockseq: 0x1234,
|
69
|
-
msecs: new Date('2011-11-01').getTime(),
|
70
|
-
nsecs: 5678
|
71
|
-
}); // -> "710b962e-041c-11e1-9234-0123456789ab"
|
72
|
-
```
|
73
|
-
|
74
|
-
Example: In-place generation of two binary IDs
|
75
|
-
|
76
|
-
```javascript
|
77
|
-
// Generate two ids in an array
|
78
|
-
var arr = new Array(32); // -> []
|
79
|
-
uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
|
80
|
-
uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
|
81
|
-
|
82
|
-
// Optionally use uuid.unparse() to get stringify the ids
|
83
|
-
uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'
|
84
|
-
uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'
|
85
|
-
```
|
86
|
-
|
87
|
-
### uuid.v4([`options` [, `buffer` [, `offset`]]])
|
88
|
-
|
89
|
-
Generate and return a RFC4122 v4 UUID.
|
90
|
-
|
91
|
-
* `options` - (Object) Optional uuid state to apply. Properties may include:
|
92
|
-
|
93
|
-
* `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
|
94
|
-
* `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.
|
95
|
-
|
96
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
97
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
98
|
-
|
99
|
-
Returns `buffer`, if specified, otherwise the string form of the UUID
|
100
|
-
|
101
|
-
Example: Generate string UUID with fully-specified options
|
102
|
-
|
103
|
-
```javascript
|
104
|
-
uuid.v4({
|
105
|
-
random: [
|
106
|
-
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
|
107
|
-
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
|
108
|
-
]
|
109
|
-
});
|
110
|
-
// -> "109156be-c4fb-41ea-b1b4-efe1671c5836"
|
111
|
-
```
|
112
|
-
|
113
|
-
Example: Generate two IDs in a single buffer
|
114
|
-
|
115
|
-
```javascript
|
116
|
-
var buffer = new Array(32); // (or 'new Buffer' in node.js)
|
117
|
-
uuid.v4(null, buffer, 0);
|
118
|
-
uuid.v4(null, buffer, 16);
|
119
|
-
```
|
120
|
-
|
121
|
-
### uuid.parse(id[, buffer[, offset]])
|
122
|
-
### uuid.unparse(buffer[, offset])
|
123
|
-
|
124
|
-
Parse and unparse UUIDs
|
125
|
-
|
126
|
-
* `id` - (String) UUID(-like) string
|
127
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used
|
128
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0
|
129
|
-
|
130
|
-
Example parsing and unparsing a UUID string
|
131
|
-
|
132
|
-
```javascript
|
133
|
-
var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>
|
134
|
-
var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'
|
135
|
-
```
|
136
|
-
|
137
|
-
### uuid.noConflict()
|
138
|
-
|
139
|
-
(Browsers only) Set `uuid` property back to it's previous value.
|
140
|
-
|
141
|
-
Returns the node-uuid object.
|
142
|
-
|
143
|
-
Example:
|
144
|
-
|
145
|
-
```javascript
|
146
|
-
var myUuid = uuid.noConflict();
|
147
|
-
myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
|
148
|
-
```
|
149
|
-
|
150
|
-
## Deprecated APIs
|
151
|
-
|
152
|
-
Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.
|
43
|
+
## Testing
|
153
44
|
|
154
|
-
|
45
|
+
test/test.js generates performance data (similar to test/benchmark.js). It also verifies the syntax of 100K string UUIDs, and logs the distribution of hex digits found therein. For example:
|
155
46
|
|
156
|
-
|
47
|
+
- - - Performance Data - - -
|
48
|
+
uuid(): 1052631 uuids/second
|
49
|
+
uuid('binary'): 680272 uuids/second
|
50
|
+
uuid('binary', buffer): 2702702 uuids/second
|
157
51
|
|
158
|
-
|
52
|
+
- - - Distribution of Hex Digits (% deviation from ideal) - - -
|
53
|
+
0 |================================| 187705 (0.11%)
|
54
|
+
1 |================================| 187880 (0.2%)
|
55
|
+
2 |================================| 186875 (-0.33%)
|
56
|
+
3 |================================| 186847 (-0.35%)
|
57
|
+
4 |==================================================| 287433 (-0.02%)
|
58
|
+
5 |================================| 187910 (0.22%)
|
59
|
+
6 |================================| 188172 (0.36%)
|
60
|
+
7 |================================| 187350 (-0.08%)
|
61
|
+
8 |====================================| 211994 (-0.24%)
|
62
|
+
9 |====================================| 212664 (0.08%)
|
63
|
+
A |=====================================| 213185 (0.32%)
|
64
|
+
B |=====================================| 212877 (0.18%)
|
65
|
+
C |================================| 187445 (-0.03%)
|
66
|
+
D |================================| 186737 (-0.41%)
|
67
|
+
E |================================| 187155 (-0.18%)
|
68
|
+
F |================================| 187771 (0.14%)
|
159
69
|
|
160
|
-
|
70
|
+
Note that the increased values for 4 and 8-B are expected as part of the RFC4122 syntax (and are accounted for in the deviation calculation). BTW, if someone wants to do the calculation to determine what a statistically significant deviation would be, I'll gladly add that to the test.
|
161
71
|
|
162
|
-
|
72
|
+
### In browser
|
163
73
|
|
164
|
-
|
74
|
+
Open test/test.html
|
165
75
|
|
166
|
-
|
167
|
-
> cd test
|
168
|
-
> node uuid.js
|
169
|
-
```
|
76
|
+
### In node.js
|
170
77
|
|
171
|
-
|
78
|
+
> node test/test.js
|
172
79
|
|
173
|
-
|
174
|
-
open test/test.html
|
175
|
-
```
|
80
|
+
node.js users can also run the node-uuid .vs. uuid.js benchmark:
|
176
81
|
|
177
|
-
|
82
|
+
> node test/benchmark.js
|
178
83
|
|
179
|
-
|
84
|
+
## Performance
|
180
85
|
|
181
|
-
|
182
|
-
npm install uuid uuid-js
|
183
|
-
node test/benchmark.js
|
184
|
-
```
|
86
|
+
### In node.js
|
185
87
|
|
186
|
-
|
88
|
+
node-uuid is designed to be fast. That said, the target platform is node.js, where it is screaming fast. Here's what I get on my 2.66GHz Macbook Pro for the test/benchmark.js script:
|
187
89
|
|
188
|
-
|
90
|
+
nodeuuid(): 1126126 uuids/second
|
91
|
+
nodeuuid('binary'): 782472 uuids/second
|
92
|
+
nodeuuid('binary', buffer): 2688172 uuids/second
|
93
|
+
uuidjs(): 620347 uuids/second
|
94
|
+
uuidjs('binary'): 1275510 uuids/second
|
189
95
|
|
190
|
-
|
96
|
+
The uuidjs() entries are for Nikhil Marathe's [uuidjs module](https://bitbucket.org/nikhilm/uuidjs), and are provided for comparison. uuidjs is a wrapper around the native libuuid library.
|
191
97
|
|
192
|
-
|
193
|
-
* Improve tests and handling of v1() options (Issue #24)
|
194
|
-
* Expose RNG option to allow for perf testing with different generators
|
98
|
+
### In browser
|
195
99
|
|
196
|
-
|
197
|
-
* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
|
198
|
-
* Support for node.js crypto API
|
199
|
-
* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
100
|
+
node-uuid performance varies dramatically across browsers. For comprehensive test results, please [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).
|