stylus-source 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/vendor/lib/nodes/unit.js +1 -1
  4. data/vendor/lib/parser.js +0 -1
  5. data/vendor/lib/renderer.js +2 -0
  6. data/vendor/lib/visitor/compiler.js +6 -0
  7. data/vendor/node_modules/cssom/README.mdown +34 -0
  8. data/vendor/node_modules/cssom/package.json +2 -1
  9. data/vendor/node_modules/debug/History.md +15 -0
  10. data/vendor/node_modules/debug/Readme.md +3 -18
  11. data/vendor/node_modules/debug/component.json +9 -0
  12. data/vendor/node_modules/debug/debug.js +10 -2
  13. data/vendor/node_modules/debug/index.js +5 -2
  14. data/vendor/node_modules/debug/lib/debug.js +5 -6
  15. data/vendor/node_modules/debug/package.json +11 -6
  16. data/vendor/node_modules/mkdirp/package.json +6 -9
  17. data/vendor/node_modules/mkdirp/{README.markdown → readme.markdown} +26 -24
  18. data/vendor/node_modules/mocha/History.md +140 -58
  19. data/vendor/node_modules/mocha/LICENSE +2 -2
  20. data/vendor/node_modules/mocha/Makefile +20 -5
  21. data/vendor/node_modules/mocha/Readme.md +110 -22
  22. data/vendor/node_modules/mocha/_mocha.js +574 -182
  23. data/vendor/node_modules/mocha/bin/_mocha +39 -22
  24. data/vendor/node_modules/mocha/bin/mocha +6 -2
  25. data/vendor/node_modules/mocha/component.json +16 -0
  26. data/vendor/node_modules/mocha/lib/browser/debug.js +1 -2
  27. data/vendor/node_modules/mocha/lib/browser/diff.js +287 -0
  28. data/vendor/node_modules/mocha/lib/browser/tty.js +7 -2
  29. data/vendor/node_modules/mocha/lib/hook.js +0 -1
  30. data/vendor/node_modules/mocha/lib/interfaces/bdd.js +3 -3
  31. data/vendor/node_modules/mocha/lib/interfaces/exports.js +5 -5
  32. data/vendor/node_modules/mocha/lib/interfaces/qunit.js +38 -9
  33. data/vendor/node_modules/mocha/lib/interfaces/tdd.js +15 -2
  34. data/vendor/node_modules/mocha/lib/mocha.js +20 -4
  35. data/vendor/node_modules/mocha/lib/reporters/base.js +57 -37
  36. data/vendor/node_modules/mocha/lib/reporters/html.js +2 -4
  37. data/vendor/node_modules/mocha/lib/reporters/json-stream.js +4 -14
  38. data/vendor/node_modules/mocha/lib/reporters/json.js +9 -19
  39. data/vendor/node_modules/mocha/lib/reporters/markdown.js +0 -1
  40. data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
  41. data/vendor/node_modules/mocha/lib/reporters/nyan.js +33 -39
  42. data/vendor/node_modules/mocha/lib/reporters/tap.js +12 -2
  43. data/vendor/node_modules/mocha/lib/reporters/templates/coverage.jade +3 -3
  44. data/vendor/node_modules/mocha/lib/reporters/templates/menu.jade +1 -1
  45. data/vendor/node_modules/mocha/lib/reporters/xunit.js +4 -4
  46. data/vendor/node_modules/mocha/lib/runnable.js +7 -9
  47. data/vendor/node_modules/mocha/lib/runner.js +24 -9
  48. data/vendor/node_modules/mocha/lib/template.html +2 -1
  49. data/vendor/node_modules/mocha/lib/utils.js +3 -3
  50. data/vendor/node_modules/mocha/mocha.css +37 -13
  51. data/vendor/node_modules/mocha/mocha.js +661 -253
  52. data/vendor/node_modules/mocha/node_modules/commander/package.json +5 -1
  53. data/vendor/node_modules/mocha/node_modules/diff/package.json +5 -1
  54. data/vendor/node_modules/mocha/node_modules/glob/LICENSE +27 -0
  55. data/vendor/node_modules/mocha/node_modules/glob/README.md +250 -0
  56. data/vendor/node_modules/mocha/node_modules/glob/examples/g.js +9 -0
  57. data/vendor/node_modules/mocha/node_modules/glob/examples/usr-local.js +9 -0
  58. data/vendor/node_modules/mocha/node_modules/glob/glob.js +675 -0
  59. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE +27 -0
  60. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md +33 -0
  61. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js +442 -0
  62. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json +49 -0
  63. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js +46 -0
  64. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/ulimit.js +158 -0
  65. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md +51 -0
  66. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js +29 -0
  67. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json +26 -0
  68. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  69. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md +218 -0
  70. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js +1079 -0
  71. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/AUTHORS +8 -0
  72. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  73. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  74. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +257 -0
  75. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json +59 -0
  76. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/s.js +25 -0
  77. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js +329 -0
  78. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  79. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  80. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  81. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  82. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  83. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json +38 -0
  84. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  85. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  86. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json +36 -0
  87. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  88. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js +33 -0
  89. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js +14 -0
  90. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  91. data/vendor/node_modules/mocha/node_modules/glob/package.json +40 -0
  92. data/vendor/node_modules/mocha/node_modules/glob/test/00-setup.js +176 -0
  93. data/vendor/node_modules/mocha/node_modules/glob/test/bash-comparison.js +63 -0
  94. data/vendor/node_modules/mocha/node_modules/glob/test/bash-results.json +350 -0
  95. data/vendor/node_modules/mocha/node_modules/glob/test/cwd-test.js +55 -0
  96. data/vendor/node_modules/mocha/node_modules/glob/test/globstar-match.js +19 -0
  97. data/vendor/node_modules/mocha/node_modules/glob/test/mark.js +74 -0
  98. data/vendor/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js +113 -0
  99. data/vendor/node_modules/mocha/node_modules/glob/test/pause-resume.js +73 -0
  100. data/vendor/node_modules/mocha/node_modules/glob/test/root-nomount.js +39 -0
  101. data/vendor/node_modules/mocha/node_modules/glob/test/root.js +46 -0
  102. data/vendor/node_modules/mocha/node_modules/glob/test/stat.js +32 -0
  103. data/vendor/node_modules/mocha/node_modules/glob/test/zz-cleanup.js +11 -0
  104. data/vendor/node_modules/mocha/node_modules/growl/History.md +5 -0
  105. data/vendor/node_modules/mocha/node_modules/growl/lib/growl.js +2 -0
  106. data/vendor/node_modules/mocha/node_modules/growl/package.json +7 -3
  107. data/vendor/node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json +5 -1
  108. data/vendor/node_modules/mocha/node_modules/jade/package.json +5 -1
  109. data/vendor/node_modules/mocha/node_modules/ms/package.json +5 -1
  110. data/vendor/node_modules/mocha/package.json +13 -7
  111. data/vendor/node_modules/mocha/test.js +10 -21
  112. data/vendor/node_modules/should/History.md +5 -0
  113. data/vendor/node_modules/should/Readme.md +172 -172
  114. data/vendor/node_modules/should/lib/eql.js +2 -0
  115. data/vendor/node_modules/should/lib/should.js +4 -3
  116. data/vendor/node_modules/should/package.json +8 -4
  117. data/vendor/node_modules/should/test/should.test.js +27 -0
  118. data/vendor/package.json +1 -1
  119. metadata +61 -35
  120. data/vendor/node_modules/debug/Makefile +0 -4
  121. data/vendor/node_modules/debug/debug.component.js +0 -120
  122. data/vendor/node_modules/debug/head.js +0 -1
  123. data/vendor/node_modules/debug/tail.js +0 -4
  124. data/vendor/node_modules/mocha/node_modules/mkdirp/LICENSE +0 -21
  125. data/vendor/node_modules/mocha/node_modules/mkdirp/README.markdown +0 -61
  126. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js +0 -6
  127. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig +0 -6
  128. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej +0 -19
  129. data/vendor/node_modules/mocha/node_modules/mkdirp/index.js +0 -94
  130. data/vendor/node_modules/mocha/node_modules/mkdirp/package.json +0 -33
  131. data/vendor/node_modules/mocha/node_modules/mkdirp/test/chmod.js +0 -38
  132. data/vendor/node_modules/mocha/node_modules/mkdirp/test/clobber.js +0 -37
  133. data/vendor/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +0 -28
  134. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm.js +0 -32
  135. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +0 -39
  136. data/vendor/node_modules/mocha/node_modules/mkdirp/test/race.js +0 -41
  137. data/vendor/node_modules/mocha/node_modules/mkdirp/test/rel.js +0 -32
  138. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return.js +0 -25
  139. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +0 -24
  140. data/vendor/node_modules/mocha/node_modules/mkdirp/test/root.js +0 -18
  141. data/vendor/node_modules/mocha/node_modules/mkdirp/test/sync.js +0 -32
  142. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask.js +0 -28
  143. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +0 -32
@@ -0,0 +1,283 @@
1
+ // different ways to id objects
2
+ // use a req/res pair, since it's crazy deep and cyclical
3
+
4
+ // sparseFE10 and sigmund are usually pretty close, which is to be expected,
5
+ // since they are essentially the same algorithm, except that sigmund handles
6
+ // regular expression objects properly.
7
+
8
+
9
+ var http = require('http')
10
+ var util = require('util')
11
+ var sigmund = require('./sigmund.js')
12
+ var sreq, sres, creq, cres, test
13
+
14
+ http.createServer(function (q, s) {
15
+ sreq = q
16
+ sres = s
17
+ sres.end('ok')
18
+ this.close(function () { setTimeout(function () {
19
+ start()
20
+ }, 200) })
21
+ }).listen(1337, function () {
22
+ creq = http.get({ port: 1337 })
23
+ creq.on('response', function (s) { cres = s })
24
+ })
25
+
26
+ function start () {
27
+ test = [sreq, sres, creq, cres]
28
+ // test = sreq
29
+ // sreq.sres = sres
30
+ // sreq.creq = creq
31
+ // sreq.cres = cres
32
+
33
+ for (var i in exports.compare) {
34
+ console.log(i)
35
+ var hash = exports.compare[i]()
36
+ console.log(hash)
37
+ console.log(hash.length)
38
+ console.log('')
39
+ }
40
+
41
+ require('bench').runMain()
42
+ }
43
+
44
+ function customWs (obj, md, d) {
45
+ d = d || 0
46
+ var to = typeof obj
47
+ if (to === 'undefined' || to === 'function' || to === null) return ''
48
+ if (d > md || !obj || to !== 'object') return ('' + obj).replace(/[\n ]+/g, '')
49
+
50
+ if (Array.isArray(obj)) {
51
+ return obj.map(function (i, _, __) {
52
+ return customWs(i, md, d + 1)
53
+ }).reduce(function (a, b) { return a + b }, '')
54
+ }
55
+
56
+ var keys = Object.keys(obj)
57
+ return keys.map(function (k, _, __) {
58
+ return k + ':' + customWs(obj[k], md, d + 1)
59
+ }).reduce(function (a, b) { return a + b }, '')
60
+ }
61
+
62
+ function custom (obj, md, d) {
63
+ d = d || 0
64
+ var to = typeof obj
65
+ if (to === 'undefined' || to === 'function' || to === null) return ''
66
+ if (d > md || !obj || to !== 'object') return '' + obj
67
+
68
+ if (Array.isArray(obj)) {
69
+ return obj.map(function (i, _, __) {
70
+ return custom(i, md, d + 1)
71
+ }).reduce(function (a, b) { return a + b }, '')
72
+ }
73
+
74
+ var keys = Object.keys(obj)
75
+ return keys.map(function (k, _, __) {
76
+ return k + ':' + custom(obj[k], md, d + 1)
77
+ }).reduce(function (a, b) { return a + b }, '')
78
+ }
79
+
80
+ function sparseFE2 (obj, maxDepth) {
81
+ var seen = []
82
+ var soFar = ''
83
+ function ch (v, depth) {
84
+ if (depth > maxDepth) return
85
+ if (typeof v === 'function' || typeof v === 'undefined') return
86
+ if (typeof v !== 'object' || !v) {
87
+ soFar += v
88
+ return
89
+ }
90
+ if (seen.indexOf(v) !== -1 || depth === maxDepth) return
91
+ seen.push(v)
92
+ soFar += '{'
93
+ Object.keys(v).forEach(function (k, _, __) {
94
+ // pseudo-private values. skip those.
95
+ if (k.charAt(0) === '_') return
96
+ var to = typeof v[k]
97
+ if (to === 'function' || to === 'undefined') return
98
+ soFar += k + ':'
99
+ ch(v[k], depth + 1)
100
+ })
101
+ soFar += '}'
102
+ }
103
+ ch(obj, 0)
104
+ return soFar
105
+ }
106
+
107
+ function sparseFE (obj, maxDepth) {
108
+ var seen = []
109
+ var soFar = ''
110
+ function ch (v, depth) {
111
+ if (depth > maxDepth) return
112
+ if (typeof v === 'function' || typeof v === 'undefined') return
113
+ if (typeof v !== 'object' || !v) {
114
+ soFar += v
115
+ return
116
+ }
117
+ if (seen.indexOf(v) !== -1 || depth === maxDepth) return
118
+ seen.push(v)
119
+ soFar += '{'
120
+ Object.keys(v).forEach(function (k, _, __) {
121
+ // pseudo-private values. skip those.
122
+ if (k.charAt(0) === '_') return
123
+ var to = typeof v[k]
124
+ if (to === 'function' || to === 'undefined') return
125
+ soFar += k
126
+ ch(v[k], depth + 1)
127
+ })
128
+ }
129
+ ch(obj, 0)
130
+ return soFar
131
+ }
132
+
133
+ function sparse (obj, maxDepth) {
134
+ var seen = []
135
+ var soFar = ''
136
+ function ch (v, depth) {
137
+ if (depth > maxDepth) return
138
+ if (typeof v === 'function' || typeof v === 'undefined') return
139
+ if (typeof v !== 'object' || !v) {
140
+ soFar += v
141
+ return
142
+ }
143
+ if (seen.indexOf(v) !== -1 || depth === maxDepth) return
144
+ seen.push(v)
145
+ soFar += '{'
146
+ for (var k in v) {
147
+ // pseudo-private values. skip those.
148
+ if (k.charAt(0) === '_') continue
149
+ var to = typeof v[k]
150
+ if (to === 'function' || to === 'undefined') continue
151
+ soFar += k
152
+ ch(v[k], depth + 1)
153
+ }
154
+ }
155
+ ch(obj, 0)
156
+ return soFar
157
+ }
158
+
159
+ function noCommas (obj, maxDepth) {
160
+ var seen = []
161
+ var soFar = ''
162
+ function ch (v, depth) {
163
+ if (depth > maxDepth) return
164
+ if (typeof v === 'function' || typeof v === 'undefined') return
165
+ if (typeof v !== 'object' || !v) {
166
+ soFar += v
167
+ return
168
+ }
169
+ if (seen.indexOf(v) !== -1 || depth === maxDepth) return
170
+ seen.push(v)
171
+ soFar += '{'
172
+ for (var k in v) {
173
+ // pseudo-private values. skip those.
174
+ if (k.charAt(0) === '_') continue
175
+ var to = typeof v[k]
176
+ if (to === 'function' || to === 'undefined') continue
177
+ soFar += k + ':'
178
+ ch(v[k], depth + 1)
179
+ }
180
+ soFar += '}'
181
+ }
182
+ ch(obj, 0)
183
+ return soFar
184
+ }
185
+
186
+
187
+ function flatten (obj, maxDepth) {
188
+ var seen = []
189
+ var soFar = ''
190
+ function ch (v, depth) {
191
+ if (depth > maxDepth) return
192
+ if (typeof v === 'function' || typeof v === 'undefined') return
193
+ if (typeof v !== 'object' || !v) {
194
+ soFar += v
195
+ return
196
+ }
197
+ if (seen.indexOf(v) !== -1 || depth === maxDepth) return
198
+ seen.push(v)
199
+ soFar += '{'
200
+ for (var k in v) {
201
+ // pseudo-private values. skip those.
202
+ if (k.charAt(0) === '_') continue
203
+ var to = typeof v[k]
204
+ if (to === 'function' || to === 'undefined') continue
205
+ soFar += k + ':'
206
+ ch(v[k], depth + 1)
207
+ soFar += ','
208
+ }
209
+ soFar += '}'
210
+ }
211
+ ch(obj, 0)
212
+ return soFar
213
+ }
214
+
215
+ exports.compare =
216
+ {
217
+ // 'custom 2': function () {
218
+ // return custom(test, 2, 0)
219
+ // },
220
+ // 'customWs 2': function () {
221
+ // return customWs(test, 2, 0)
222
+ // },
223
+ 'JSON.stringify (guarded)': function () {
224
+ var seen = []
225
+ return JSON.stringify(test, function (k, v) {
226
+ if (typeof v !== 'object' || !v) return v
227
+ if (seen.indexOf(v) !== -1) return undefined
228
+ seen.push(v)
229
+ return v
230
+ })
231
+ },
232
+
233
+ 'flatten 10': function () {
234
+ return flatten(test, 10)
235
+ },
236
+
237
+ // 'flattenFE 10': function () {
238
+ // return flattenFE(test, 10)
239
+ // },
240
+
241
+ 'noCommas 10': function () {
242
+ return noCommas(test, 10)
243
+ },
244
+
245
+ 'sparse 10': function () {
246
+ return sparse(test, 10)
247
+ },
248
+
249
+ 'sparseFE 10': function () {
250
+ return sparseFE(test, 10)
251
+ },
252
+
253
+ 'sparseFE2 10': function () {
254
+ return sparseFE2(test, 10)
255
+ },
256
+
257
+ sigmund: function() {
258
+ return sigmund(test, 10)
259
+ },
260
+
261
+
262
+ // 'util.inspect 1': function () {
263
+ // return util.inspect(test, false, 1, false)
264
+ // },
265
+ // 'util.inspect undefined': function () {
266
+ // util.inspect(test)
267
+ // },
268
+ // 'util.inspect 2': function () {
269
+ // util.inspect(test, false, 2, false)
270
+ // },
271
+ // 'util.inspect 3': function () {
272
+ // util.inspect(test, false, 3, false)
273
+ // },
274
+ // 'util.inspect 4': function () {
275
+ // util.inspect(test, false, 4, false)
276
+ // },
277
+ // 'util.inspect Infinity': function () {
278
+ // util.inspect(test, false, Infinity, false)
279
+ // }
280
+ }
281
+
282
+ /** results
283
+ **/
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "sigmund",
3
+ "version": "1.0.0",
4
+ "description": "Quick and dirty signatures for Objects.",
5
+ "main": "sigmund.js",
6
+ "directories": {
7
+ "test": "test"
8
+ },
9
+ "dependencies": {},
10
+ "devDependencies": {
11
+ "tap": "~0.3.0"
12
+ },
13
+ "scripts": {
14
+ "test": "tap test/*.js",
15
+ "bench": "node bench.js"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git://github.com/isaacs/sigmund"
20
+ },
21
+ "keywords": [
22
+ "object",
23
+ "signature",
24
+ "key",
25
+ "data",
26
+ "psychoanalysis"
27
+ ],
28
+ "author": {
29
+ "name": "Isaac Z. Schlueter",
30
+ "email": "i@izs.me",
31
+ "url": "http://blog.izs.me/"
32
+ },
33
+ "license": "BSD",
34
+ "readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
35
+ "readmeFilename": "README.md",
36
+ "_id": "sigmund@1.0.0",
37
+ "_from": "sigmund@~1.0.0"
38
+ }
@@ -0,0 +1,39 @@
1
+ module.exports = sigmund
2
+ function sigmund (subject, maxSessions) {
3
+ maxSessions = maxSessions || 10;
4
+ var notes = [];
5
+ var analysis = '';
6
+ var RE = RegExp;
7
+
8
+ function psychoAnalyze (subject, session) {
9
+ if (session > maxSessions) return;
10
+
11
+ if (typeof subject === 'function' ||
12
+ typeof subject === 'undefined') {
13
+ return;
14
+ }
15
+
16
+ if (typeof subject !== 'object' || !subject ||
17
+ (subject instanceof RE)) {
18
+ analysis += subject;
19
+ return;
20
+ }
21
+
22
+ if (notes.indexOf(subject) !== -1 || session === maxSessions) return;
23
+
24
+ notes.push(subject);
25
+ analysis += '{';
26
+ Object.keys(subject).forEach(function (issue, _, __) {
27
+ // pseudo-private values. skip those.
28
+ if (issue.charAt(0) === '_') return;
29
+ var to = typeof subject[issue];
30
+ if (to === 'function' || to === 'undefined') return;
31
+ analysis += issue;
32
+ psychoAnalyze(subject[issue], session + 1);
33
+ });
34
+ }
35
+ psychoAnalyze(subject, 0);
36
+ return analysis;
37
+ }
38
+
39
+ // vim: set softtabstop=4 shiftwidth=4:
@@ -0,0 +1,24 @@
1
+ var test = require('tap').test
2
+ var sigmund = require('../sigmund.js')
3
+
4
+
5
+ // occasionally there are duplicates
6
+ // that's an acceptable edge-case. JSON.stringify and util.inspect
7
+ // have some collision potential as well, though less, and collision
8
+ // detection is expensive.
9
+ var hash = '{abc/def/g{0h1i2{jkl'
10
+ var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
11
+ var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
12
+
13
+ var obj3 = JSON.parse(JSON.stringify(obj1))
14
+ obj3.c = /def/
15
+ obj3.g[2].cycle = obj3
16
+ var cycleHash = '{abc/def/g{0h1i2{jklcycle'
17
+
18
+ test('basic', function (t) {
19
+ t.equal(sigmund(obj1), hash)
20
+ t.equal(sigmund(obj2), hash)
21
+ t.equal(sigmund(obj3), cycleHash)
22
+ t.end()
23
+ })
24
+
@@ -0,0 +1,36 @@
1
+ {
2
+ "author": {
3
+ "name": "Isaac Z. Schlueter",
4
+ "email": "i@izs.me",
5
+ "url": "http://blog.izs.me"
6
+ },
7
+ "name": "minimatch",
8
+ "description": "a glob matcher in javascript",
9
+ "version": "0.2.12",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git://github.com/isaacs/minimatch.git"
13
+ },
14
+ "main": "minimatch.js",
15
+ "scripts": {
16
+ "test": "tap test"
17
+ },
18
+ "engines": {
19
+ "node": "*"
20
+ },
21
+ "dependencies": {
22
+ "lru-cache": "2",
23
+ "sigmund": "~1.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "tap": ""
27
+ },
28
+ "license": {
29
+ "type": "MIT",
30
+ "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE"
31
+ },
32
+ "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n### Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not. **Note that this is different from the way that `**` is\nhandled by ruby's `Dir` class.**\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n",
33
+ "readmeFilename": "README.md",
34
+ "_id": "minimatch@0.2.12",
35
+ "_from": "minimatch@~0.2.11"
36
+ }