@contrast/agent 4.32.11 → 4.32.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/lib/core/config/util.js +2 -1
  2. package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
  3. package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
  4. package/node_modules/file-stream-rotator/README.md +16 -1
  5. package/node_modules/file-stream-rotator/package.json +5 -5
  6. package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
  7. package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
  8. package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
  9. package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
  10. package/node_modules/object-hash/dist/object_hash.js +1 -2
  11. package/node_modules/object-hash/index.js +33 -21
  12. package/node_modules/object-hash/package.json +20 -18
  13. package/node_modules/object-hash/readme.markdown +20 -5
  14. package/node_modules/winston-daily-rotate-file/README.md +81 -12
  15. package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
  16. package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
  17. package/node_modules/winston-daily-rotate-file/package.json +20 -19
  18. package/node_modules/winston-transport/.eslintrc +1 -1
  19. package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  20. package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  21. package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
  22. package/node_modules/winston-transport/CHANGELOG.md +11 -0
  23. package/node_modules/winston-transport/dist/index.js +2 -2
  24. package/node_modules/winston-transport/index.d.ts +2 -0
  25. package/node_modules/winston-transport/index.js +2 -2
  26. package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
  27. package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
  28. package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
  29. package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
  30. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
  31. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
  32. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
  33. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
  34. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
  35. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  36. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  37. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  38. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  39. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  40. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  41. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  42. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  43. package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
  44. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
  45. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
  46. package/node_modules/winston-transport/package.json +16 -14
  47. package/package.json +7 -7
  48. package/node_modules/colors/LICENSE +0 -25
  49. package/node_modules/colors/README.md +0 -221
  50. package/node_modules/colors/examples/normal-usage.js +0 -82
  51. package/node_modules/colors/examples/safe-string.js +0 -79
  52. package/node_modules/colors/index.d.ts +0 -136
  53. package/node_modules/colors/lib/colors.js +0 -211
  54. package/node_modules/colors/lib/custom/trap.js +0 -46
  55. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  56. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  57. package/node_modules/colors/lib/index.js +0 -13
  58. package/node_modules/colors/lib/maps/america.js +0 -10
  59. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  60. package/node_modules/colors/lib/maps/random.js +0 -11
  61. package/node_modules/colors/lib/maps/zebra.js +0 -5
  62. package/node_modules/colors/lib/styles.js +0 -95
  63. package/node_modules/colors/lib/system/has-flag.js +0 -35
  64. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  65. package/node_modules/colors/package.json +0 -49
  66. package/node_modules/colors/safe.d.ts +0 -48
  67. package/node_modules/colors/safe.js +0 -10
  68. package/node_modules/colors/themes/generic-logging.js +0 -12
  69. package/node_modules/core-util-is/LICENSE +0 -19
  70. package/node_modules/core-util-is/README.md +0 -3
  71. package/node_modules/core-util-is/float.patch +0 -604
  72. package/node_modules/core-util-is/lib/util.js +0 -107
  73. package/node_modules/core-util-is/package.json +0 -36
  74. package/node_modules/core-util-is/test.js +0 -68
  75. package/node_modules/cycle/README.md +0 -49
  76. package/node_modules/cycle/cycle.js +0 -170
  77. package/node_modules/cycle/package.json +0 -16
  78. package/node_modules/fast-safe-stringify/.travis.yml +0 -8
  79. package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
  80. package/node_modules/fast-safe-stringify/LICENSE +0 -23
  81. package/node_modules/fast-safe-stringify/benchmark.js +0 -137
  82. package/node_modules/fast-safe-stringify/index.d.ts +0 -8
  83. package/node_modules/fast-safe-stringify/index.js +0 -161
  84. package/node_modules/fast-safe-stringify/package.json +0 -50
  85. package/node_modules/fast-safe-stringify/readme.md +0 -154
  86. package/node_modules/fast-safe-stringify/test-stable.js +0 -311
  87. package/node_modules/fast-safe-stringify/test.js +0 -304
  88. package/node_modules/isarray/.npmignore +0 -1
  89. package/node_modules/isarray/.travis.yml +0 -4
  90. package/node_modules/isarray/Makefile +0 -6
  91. package/node_modules/isarray/README.md +0 -60
  92. package/node_modules/isarray/component.json +0 -19
  93. package/node_modules/isarray/index.js +0 -5
  94. package/node_modules/isarray/package.json +0 -49
  95. package/node_modules/isarray/test.js +0 -20
  96. package/node_modules/object-hash/.jshintrc +0 -19
  97. package/node_modules/object-hash/.travis.yml +0 -35
  98. package/node_modules/object-hash/bower.json +0 -15
  99. package/node_modules/object-hash/dist/object_hash.js.map +0 -1
  100. package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
  101. package/node_modules/object-hash/gulpfile.js +0 -97
  102. package/node_modules/object-hash/karma.conf.js +0 -69
  103. package/node_modules/object-hash/test/blob.js +0 -41
  104. package/node_modules/object-hash/test/index.js +0 -290
  105. package/node_modules/object-hash/test/object-classes.js +0 -106
  106. package/node_modules/object-hash/test/old-crypto.js +0 -60
  107. package/node_modules/object-hash/test/replacer.js +0 -36
  108. package/node_modules/object-hash/test/types.js +0 -174
  109. package/node_modules/object-hash/test/writeToStream.js +0 -27
  110. package/node_modules/process-nextick-args/index.js +0 -45
  111. package/node_modules/process-nextick-args/license.md +0 -19
  112. package/node_modules/process-nextick-args/package.json +0 -29
  113. package/node_modules/process-nextick-args/readme.md +0 -18
  114. package/node_modules/readable-stream/.travis.yml +0 -34
  115. package/node_modules/readable-stream/README.md +0 -58
  116. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  117. package/node_modules/readable-stream/duplex-browser.js +0 -1
  118. package/node_modules/readable-stream/duplex.js +0 -1
  119. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  120. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  121. package/node_modules/readable-stream/package.json +0 -56
  122. package/node_modules/readable-stream/passthrough.js +0 -1
  123. package/node_modules/readable-stream/transform.js +0 -1
  124. package/node_modules/readable-stream/writable-browser.js +0 -1
  125. package/node_modules/readable-stream/writable.js +0 -8
  126. package/node_modules/winston-compat/.gitattributes +0 -1
  127. package/node_modules/winston-compat/.node-version +0 -1
  128. package/node_modules/winston-compat/CHANGELOG.md +0 -17
  129. package/node_modules/winston-compat/LICENSE +0 -22
  130. package/node_modules/winston-compat/README.md +0 -2
  131. package/node_modules/winston-compat/index.js +0 -295
  132. package/node_modules/winston-compat/lib/transport.js +0 -135
  133. package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
  134. package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
  135. package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
  136. package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
  137. package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
  138. package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
  139. package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
  140. package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
  141. package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
  142. package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
  143. package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
  144. package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
  145. package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
  146. package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
  147. package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
  148. package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
  149. package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
  150. package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
  151. package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
  152. package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
  153. package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
  154. package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
  155. package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
  156. package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
  157. package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
  158. package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
  159. package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
  160. package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
  161. package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
  162. package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
  163. package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
  164. package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
  165. package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
  166. package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
  167. package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
  168. package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
  169. package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
  170. package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
  171. package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
  172. package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
  173. package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
  174. package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
  175. package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
  176. package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
  177. package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
  178. package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
  179. package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
  180. package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
  181. package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
  182. package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
  183. package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
  184. package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
  185. package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
  186. package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
  187. package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
  188. package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
  189. package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
  190. package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
  191. package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
  192. package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
  193. package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
  194. package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
  195. package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
  196. package/node_modules/winston-compat/package.json +0 -46
  197. package/node_modules/winston-compat/test/clone.test.js +0 -25
  198. package/node_modules/winston-compat/test/helpers.js +0 -256
  199. package/node_modules/winston-compat/test/timestamp.test.js +0 -14
  200. package/node_modules/winston-compat/test/transports/transport.js +0 -205
  201. package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
  202. package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
  203. package/node_modules/winston-daily-rotate-file/.node-version +0 -1
  204. package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
  205. package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
  206. package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
  207. package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
  208. package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
  209. package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
  210. package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
  211. package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
  212. package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
  213. package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
  214. package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
  215. package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  216. package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  217. package/node_modules/winston-transport/.travis.yml +0 -17
  218. package/node_modules/winston-transport/tsconfig.json +0 -22
  219. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
  220. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
  221. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
  222. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
  223. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
@@ -1,36 +0,0 @@
1
- {
2
- "name": "core-util-is",
3
- "version": "1.0.2",
4
- "description": "The `util.is*` functions introduced in Node v0.12.",
5
- "main": "lib/util.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "git://github.com/isaacs/core-util-is"
9
- },
10
- "keywords": [
11
- "util",
12
- "isBuffer",
13
- "isArray",
14
- "isNumber",
15
- "isString",
16
- "isRegExp",
17
- "isThis",
18
- "isThat",
19
- "polyfill"
20
- ],
21
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/isaacs/core-util-is/issues"
25
- },
26
- "scripts": {
27
- "test": "tap test.js"
28
- },
29
- "devDependencies": {
30
- "tap": "^2.3.0"
31
- }
32
-
33
- ,"_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
34
- ,"_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
35
- ,"_from": "core-util-is@1.0.2"
36
- }
@@ -1,68 +0,0 @@
1
- var assert = require('tap');
2
-
3
- var t = require('./lib/util');
4
-
5
- assert.equal(t.isArray([]), true);
6
- assert.equal(t.isArray({}), false);
7
-
8
- assert.equal(t.isBoolean(null), false);
9
- assert.equal(t.isBoolean(true), true);
10
- assert.equal(t.isBoolean(false), true);
11
-
12
- assert.equal(t.isNull(null), true);
13
- assert.equal(t.isNull(undefined), false);
14
- assert.equal(t.isNull(false), false);
15
- assert.equal(t.isNull(), false);
16
-
17
- assert.equal(t.isNullOrUndefined(null), true);
18
- assert.equal(t.isNullOrUndefined(undefined), true);
19
- assert.equal(t.isNullOrUndefined(false), false);
20
- assert.equal(t.isNullOrUndefined(), true);
21
-
22
- assert.equal(t.isNumber(null), false);
23
- assert.equal(t.isNumber('1'), false);
24
- assert.equal(t.isNumber(1), true);
25
-
26
- assert.equal(t.isString(null), false);
27
- assert.equal(t.isString('1'), true);
28
- assert.equal(t.isString(1), false);
29
-
30
- assert.equal(t.isSymbol(null), false);
31
- assert.equal(t.isSymbol('1'), false);
32
- assert.equal(t.isSymbol(1), false);
33
- assert.equal(t.isSymbol(Symbol()), true);
34
-
35
- assert.equal(t.isUndefined(null), false);
36
- assert.equal(t.isUndefined(undefined), true);
37
- assert.equal(t.isUndefined(false), false);
38
- assert.equal(t.isUndefined(), true);
39
-
40
- assert.equal(t.isRegExp(null), false);
41
- assert.equal(t.isRegExp('1'), false);
42
- assert.equal(t.isRegExp(new RegExp()), true);
43
-
44
- assert.equal(t.isObject({}), true);
45
- assert.equal(t.isObject([]), true);
46
- assert.equal(t.isObject(new RegExp()), true);
47
- assert.equal(t.isObject(new Date()), true);
48
-
49
- assert.equal(t.isDate(null), false);
50
- assert.equal(t.isDate('1'), false);
51
- assert.equal(t.isDate(new Date()), true);
52
-
53
- assert.equal(t.isError(null), false);
54
- assert.equal(t.isError({ err: true }), false);
55
- assert.equal(t.isError(new Error()), true);
56
-
57
- assert.equal(t.isFunction(null), false);
58
- assert.equal(t.isFunction({ }), false);
59
- assert.equal(t.isFunction(function() {}), true);
60
-
61
- assert.equal(t.isPrimitive(null), true);
62
- assert.equal(t.isPrimitive(''), true);
63
- assert.equal(t.isPrimitive(0), true);
64
- assert.equal(t.isPrimitive(new Date()), false);
65
-
66
- assert.equal(t.isBuffer(null), false);
67
- assert.equal(t.isBuffer({}), false);
68
- assert.equal(t.isBuffer(new Buffer(0)), true);
@@ -1,49 +0,0 @@
1
- Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.
2
-
3
- # Contributors
4
-
5
- * Douglas Crockford
6
- * Nuno Job
7
- * Justin Warkentin
8
-
9
- # JSON in JavaScript
10
-
11
- Douglas Crockford
12
- douglas@crockford.com
13
-
14
- 2010-11-18
15
-
16
-
17
- JSON is a light-weight, language independent, data interchange format.
18
- See http://www.JSON.org/
19
-
20
- The files in this collection implement JSON encoders/decoders in JavaScript.
21
-
22
- JSON became a built-in feature of JavaScript when the ECMAScript Programming
23
- Language Standard - Fifth Edition was adopted by the ECMA General Assembly
24
- in December 2009. Most of the files in this collection are for applications
25
- that are expected to run in obsolete web browsers. For most purposes, json2.js
26
- is the best choice.
27
-
28
-
29
- json2.js: This file creates a JSON property in the global object, if there
30
- isn't already one, setting its value to an object containing a stringify
31
- method and a parse method. The parse method uses the eval method to do the
32
- parsing, guarding it with several regular expressions to defend against
33
- accidental code execution hazards. On current browsers, this file does nothing,
34
- prefering the built-in JSON object.
35
-
36
- json.js: This file does everything that json2.js does. It also adds a
37
- toJSONString method and a parseJSON method to Object.prototype. Use of this
38
- file is not recommended.
39
-
40
- json_parse.js: This file contains an alternative JSON parse function that
41
- uses recursive descent instead of eval.
42
-
43
- json_parse_state.js: This files contains an alternative JSON parse function that
44
- uses a state machine instead of eval.
45
-
46
- cycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,
47
- which make it possible to encode cyclical structures and dags in JSON, and to
48
- then recover them. JSONPath is used to represent the links.
49
- http://GOESSNER.net/articles/JsonPath/
@@ -1,170 +0,0 @@
1
- /*
2
- cycle.js
3
- 2013-02-19
4
-
5
- Public Domain.
6
-
7
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
8
-
9
- This code should be minified before deployment.
10
- See http://javascript.crockford.com/jsmin.html
11
-
12
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
13
- NOT CONTROL.
14
- */
15
-
16
- /*jslint evil: true, regexp: true */
17
-
18
- /*members $ref, apply, call, decycle, hasOwnProperty, length, prototype, push,
19
- retrocycle, stringify, test, toString
20
- */
21
-
22
- var cycle = exports;
23
-
24
- cycle.decycle = function decycle(object) {
25
- 'use strict';
26
-
27
- // Make a deep copy of an object or array, assuring that there is at most
28
- // one instance of each object or array in the resulting structure. The
29
- // duplicate references (which might be forming cycles) are replaced with
30
- // an object of the form
31
- // {$ref: PATH}
32
- // where the PATH is a JSONPath string that locates the first occurance.
33
- // So,
34
- // var a = [];
35
- // a[0] = a;
36
- // return JSON.stringify(JSON.decycle(a));
37
- // produces the string '[{"$ref":"$"}]'.
38
-
39
- // JSONPath is used to locate the unique object. $ indicates the top level of
40
- // the object or array. [NUMBER] or [STRING] indicates a child member or
41
- // property.
42
-
43
- var objects = [], // Keep a reference to each unique object or array
44
- paths = []; // Keep the path to each unique object or array
45
-
46
- return (function derez(value, path) {
47
-
48
- // The derez recurses through the object, producing the deep copy.
49
-
50
- var i, // The loop counter
51
- name, // Property name
52
- nu; // The new object or array
53
-
54
- // typeof null === 'object', so go on if this value is really an object but not
55
- // one of the weird builtin objects.
56
-
57
- if (typeof value === 'object' && value !== null &&
58
- !(value instanceof Boolean) &&
59
- !(value instanceof Date) &&
60
- !(value instanceof Number) &&
61
- !(value instanceof RegExp) &&
62
- !(value instanceof String)) {
63
-
64
- // If the value is an object or array, look to see if we have already
65
- // encountered it. If so, return a $ref/path object. This is a hard way,
66
- // linear search that will get slower as the number of unique objects grows.
67
-
68
- for (i = 0; i < objects.length; i += 1) {
69
- if (objects[i] === value) {
70
- return {$ref: paths[i]};
71
- }
72
- }
73
-
74
- // Otherwise, accumulate the unique value and its path.
75
-
76
- objects.push(value);
77
- paths.push(path);
78
-
79
- // If it is an array, replicate the array.
80
-
81
- if (Object.prototype.toString.apply(value) === '[object Array]') {
82
- nu = [];
83
- for (i = 0; i < value.length; i += 1) {
84
- nu[i] = derez(value[i], path + '[' + i + ']');
85
- }
86
- } else {
87
-
88
- // If it is an object, replicate the object.
89
-
90
- nu = {};
91
- for (name in value) {
92
- if (Object.prototype.hasOwnProperty.call(value, name)) {
93
- nu[name] = derez(value[name],
94
- path + '[' + JSON.stringify(name) + ']');
95
- }
96
- }
97
- }
98
- return nu;
99
- }
100
- return value;
101
- }(object, '$'));
102
- };
103
-
104
-
105
- cycle.retrocycle = function retrocycle($) {
106
- 'use strict';
107
-
108
- // Restore an object that was reduced by decycle. Members whose values are
109
- // objects of the form
110
- // {$ref: PATH}
111
- // are replaced with references to the value found by the PATH. This will
112
- // restore cycles. The object will be mutated.
113
-
114
- // The eval function is used to locate the values described by a PATH. The
115
- // root object is kept in a $ variable. A regular expression is used to
116
- // assure that the PATH is extremely well formed. The regexp contains nested
117
- // * quantifiers. That has been known to have extremely bad performance
118
- // problems on some browsers for very long strings. A PATH is expected to be
119
- // reasonably short. A PATH is allowed to belong to a very restricted subset of
120
- // Goessner's JSONPath.
121
-
122
- // So,
123
- // var s = '[{"$ref":"$"}]';
124
- // return JSON.retrocycle(JSON.parse(s));
125
- // produces an array containing a single element which is the array itself.
126
-
127
- var px =
128
- /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;
129
-
130
- (function rez(value) {
131
-
132
- // The rez function walks recursively through the object looking for $ref
133
- // properties. When it finds one that has a value that is a path, then it
134
- // replaces the $ref object with a reference to the value that is found by
135
- // the path.
136
-
137
- var i, item, name, path;
138
-
139
- if (value && typeof value === 'object') {
140
- if (Object.prototype.toString.apply(value) === '[object Array]') {
141
- for (i = 0; i < value.length; i += 1) {
142
- item = value[i];
143
- if (item && typeof item === 'object') {
144
- path = item.$ref;
145
- if (typeof path === 'string' && px.test(path)) {
146
- value[i] = eval(path);
147
- } else {
148
- rez(item);
149
- }
150
- }
151
- }
152
- } else {
153
- for (name in value) {
154
- if (typeof value[name] === 'object') {
155
- item = value[name];
156
- if (item) {
157
- path = item.$ref;
158
- if (typeof path === 'string' && px.test(path)) {
159
- value[name] = eval(path);
160
- } else {
161
- rez(item);
162
- }
163
- }
164
- }
165
- }
166
- }
167
- }
168
- }($));
169
- return $;
170
- };
@@ -1,16 +0,0 @@
1
- { "name" : "cycle"
2
- , "description" : "decycle your json"
3
- , "author" : ""
4
- , "version" : "1.0.3"
5
- , "main" : "./cycle.js"
6
- , "homepage" : "https://github.com/douglascrockford/JSON-js"
7
- , "repository" :
8
- { "type": "git", "url": "http://github.com/dscape/cycle.git" }
9
- , "bugs" : "http://github.com/douglascrockford/JSON-js/issues"
10
- , "keywords" : [ "json", "cycle", "stringify", "parse" ]
11
- , "engines" : { "node" : ">=0.4.0" }
12
-
13
- ,"_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
14
- ,"_integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI="
15
- ,"_from": "cycle@1.0.3"
16
- }
@@ -1,8 +0,0 @@
1
- language: node_js
2
- sudo: false
3
- node_js:
4
- - '4'
5
- - '6'
6
- - '8'
7
- - '9'
8
- - '10'
@@ -1,17 +0,0 @@
1
- # Changelog
2
-
3
- ## v.2.0.0
4
-
5
- Features
6
-
7
- - Added stable-stringify (see documentation)
8
- - Support replacer
9
- - Support spacer
10
- - toJSON support without forceDecirc property
11
- - Improved performance
12
-
13
- Breaking changes
14
-
15
- - Manipulating the input value in a `toJSON` function is not possible anymore in
16
- all cases (see documentation)
17
- - Dropped support for e.g. IE8 and Node.js < 4
@@ -1,23 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 David Mark Clements
4
- Copyright (c) 2017 David Mark Clements & Matteo Collina
5
- Copyright (c) 2018 David Mark Clements, Matteo Collina & Ruben Bridgewater
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
@@ -1,137 +0,0 @@
1
- const Benchmark = require('benchmark')
2
- const suite = new Benchmark.Suite()
3
- const { inspect } = require('util')
4
- const jsonStringifySafe = require('json-stringify-safe')
5
- const fastSafeStringify = require('./')
6
-
7
- const array = new Array(10).fill(0).map((_, i) => i)
8
- const obj = { foo: array }
9
- const circ = JSON.parse(JSON.stringify(obj))
10
- circ.o = { obj: circ, array }
11
- const circGetters = JSON.parse(JSON.stringify(obj))
12
- Object.assign(circGetters, { get o () { return { obj: circGetters, array } } })
13
-
14
- const deep = require('./package.json')
15
- deep.deep = JSON.parse(JSON.stringify(deep))
16
- deep.deep.deep = JSON.parse(JSON.stringify(deep))
17
- deep.deep.deep.deep = JSON.parse(JSON.stringify(deep))
18
- deep.array = array
19
-
20
- const deepCirc = JSON.parse(JSON.stringify(deep))
21
- deepCirc.deep.deep.deep.circ = deepCirc
22
- deepCirc.deep.deep.circ = deepCirc
23
- deepCirc.deep.circ = deepCirc
24
- deepCirc.array = array
25
-
26
- const deepCircGetters = JSON.parse(JSON.stringify(deep))
27
- for (let i = 0; i < 10; i++) {
28
- deepCircGetters[i.toString()] = {
29
- deep: {
30
- deep: {
31
- get circ () { return deep.deep },
32
- deep: { get circ () { return deep.deep.deep } }
33
- },
34
- get circ () { return deep }
35
- },
36
- get array () { return array }
37
- }
38
- }
39
-
40
- const deepCircNonCongifurableGetters = JSON.parse(JSON.stringify(deep))
41
- Object.defineProperty(deepCircNonCongifurableGetters.deep.deep.deep, 'circ', {
42
- get: () => deepCircNonCongifurableGetters,
43
- enumerable: true,
44
- configurable: false
45
- })
46
- Object.defineProperty(deepCircNonCongifurableGetters.deep.deep, 'circ', {
47
- get: () => deepCircNonCongifurableGetters,
48
- enumerable: true,
49
- configurable: false
50
- })
51
- Object.defineProperty(deepCircNonCongifurableGetters.deep, 'circ', {
52
- get: () => deepCircNonCongifurableGetters,
53
- enumerable: true,
54
- configurable: false
55
- })
56
- Object.defineProperty(deepCircNonCongifurableGetters, 'array', {
57
- get: () => array,
58
- enumerable: true,
59
- configurable: false
60
- })
61
-
62
- suite.add('util.inspect: simple object ', function () {
63
- inspect(obj, { showHidden: false, depth: null })
64
- })
65
- suite.add('util.inspect: circular ', function () {
66
- inspect(circ, { showHidden: false, depth: null })
67
- })
68
- suite.add('util.inspect: circular getters ', function () {
69
- inspect(circGetters, { showHidden: false, depth: null })
70
- })
71
- suite.add('util.inspect: deep ', function () {
72
- inspect(deep, { showHidden: false, depth: null })
73
- })
74
- suite.add('util.inspect: deep circular ', function () {
75
- inspect(deepCirc, { showHidden: false, depth: null })
76
- })
77
- suite.add('util.inspect: large deep circular getters ', function () {
78
- inspect(deepCircGetters, { showHidden: false, depth: null })
79
- })
80
- suite.add('util.inspect: deep non-conf circular getters', function () {
81
- inspect(deepCircNonCongifurableGetters, { showHidden: false, depth: null })
82
- })
83
-
84
- suite.add('\njson-stringify-safe: simple object ', function () {
85
- jsonStringifySafe(obj)
86
- })
87
- suite.add('json-stringify-safe: circular ', function () {
88
- jsonStringifySafe(circ)
89
- })
90
- suite.add('json-stringify-safe: circular getters ', function () {
91
- jsonStringifySafe(circGetters)
92
- })
93
- suite.add('json-stringify-safe: deep ', function () {
94
- jsonStringifySafe(deep)
95
- })
96
- suite.add('json-stringify-safe: deep circular ', function () {
97
- jsonStringifySafe(deepCirc)
98
- })
99
- suite.add('json-stringify-safe: large deep circular getters ', function () {
100
- jsonStringifySafe(deepCircGetters)
101
- })
102
- suite.add('json-stringify-safe: deep non-conf circular getters', function () {
103
- jsonStringifySafe(deepCircNonCongifurableGetters)
104
- })
105
-
106
- suite.add('\nfast-safe-stringify: simple object ', function () {
107
- fastSafeStringify(obj)
108
- })
109
- suite.add('fast-safe-stringify: circular ', function () {
110
- fastSafeStringify(circ)
111
- })
112
- suite.add('fast-safe-stringify: circular getters ', function () {
113
- fastSafeStringify(circGetters)
114
- })
115
- suite.add('fast-safe-stringify: deep ', function () {
116
- fastSafeStringify(deep)
117
- })
118
- suite.add('fast-safe-stringify: deep circular ', function () {
119
- fastSafeStringify(deepCirc)
120
- })
121
- suite.add('fast-safe-stringify: large deep circular getters ', function () {
122
- fastSafeStringify(deepCircGetters)
123
- })
124
- suite.add('fast-safe-stringify: deep non-conf circular getters', function () {
125
- fastSafeStringify(deepCircNonCongifurableGetters)
126
- })
127
-
128
- // add listeners
129
- suite.on('cycle', function (event) {
130
- console.log(String(event.target))
131
- })
132
-
133
- suite.on('complete', function () {
134
- console.log('\nFastest is ' + this.filter('fastest').map('name'))
135
- })
136
-
137
- suite.run({ delay: 1, minSamples: 150 })
@@ -1,8 +0,0 @@
1
- declare function stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
2
-
3
- declare namespace stringify {
4
- export function stable(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
5
- export function stableStringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
6
- }
7
-
8
- export default stringify;