typespeed 2.0.21 → 2.0.22

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 (219) hide show
  1. package/dist/core.decorator.js +1 -30
  2. package/dist/default/default-authentication.class.js +25 -0
  3. package/dist/default/express-server.class.js +11 -4
  4. package/dist/default/log-default.class.js +0 -6
  5. package/dist/factory/authentication-factory.class.js +11 -0
  6. package/dist/factory/log-factory.class.js +9 -0
  7. package/dist/route.decorator.js +92 -2
  8. package/dist/typespeed.d.ts +25 -3
  9. package/dist/typespeed.js +3 -1
  10. package/package.json +1 -1
  11. package/src/core.decorator.ts +1 -29
  12. package/src/default/default-authentication.class.ts +10 -0
  13. package/src/default/express-server.class.ts +12 -5
  14. package/src/default/log-default.class.ts +0 -10
  15. package/src/factory/authentication-factory.class.ts +9 -0
  16. package/src/factory/log-factory.class.ts +9 -2
  17. package/src/route.decorator.ts +91 -3
  18. package/src/typespeed.d.ts +25 -3
  19. package/src/typespeed.ts +1 -0
  20. package/test/node_modules/.package-lock.json +65 -101
  21. package/test/node_modules/@types/body-parser/LICENSE +21 -0
  22. package/test/node_modules/@types/body-parser/README.md +16 -0
  23. package/test/node_modules/@types/body-parser/index.d.ts +107 -0
  24. package/test/node_modules/@types/body-parser/package.json +58 -0
  25. package/test/node_modules/@types/connect/LICENSE +21 -0
  26. package/test/node_modules/@types/connect/README.md +16 -0
  27. package/test/node_modules/@types/connect/index.d.ts +93 -0
  28. package/test/node_modules/@types/connect/package.json +32 -0
  29. package/test/node_modules/@types/express/LICENSE +21 -0
  30. package/test/node_modules/@types/express/README.md +16 -0
  31. package/test/node_modules/@types/express/index.d.ts +136 -0
  32. package/test/node_modules/@types/express/package.json +45 -0
  33. package/test/node_modules/@types/express-serve-static-core/LICENSE +21 -0
  34. package/test/node_modules/@types/express-serve-static-core/README.md +16 -0
  35. package/test/node_modules/@types/express-serve-static-core/index.d.ts +1281 -0
  36. package/test/node_modules/@types/express-serve-static-core/package.json +55 -0
  37. package/test/node_modules/@types/mime/LICENSE +21 -0
  38. package/test/node_modules/@types/mime/Mime.d.ts +10 -0
  39. package/test/node_modules/@types/mime/README.md +16 -0
  40. package/test/node_modules/@types/mime/index.d.ts +35 -0
  41. package/test/node_modules/@types/mime/lite.d.ts +7 -0
  42. package/test/node_modules/@types/mime/package.json +29 -0
  43. package/test/node_modules/@types/qs/LICENSE +21 -0
  44. package/test/node_modules/@types/qs/README.md +16 -0
  45. package/test/node_modules/@types/qs/index.d.ts +62 -0
  46. package/test/node_modules/@types/qs/package.json +65 -0
  47. package/test/node_modules/@types/range-parser/LICENSE +21 -0
  48. package/test/node_modules/@types/range-parser/README.md +55 -0
  49. package/test/node_modules/@types/range-parser/index.d.ts +35 -0
  50. package/test/node_modules/@types/range-parser/package.json +25 -0
  51. package/test/node_modules/@types/send/LICENSE +21 -0
  52. package/test/node_modules/@types/send/README.md +16 -0
  53. package/test/node_modules/@types/send/index.d.ts +231 -0
  54. package/test/node_modules/@types/send/package.json +33 -0
  55. package/test/node_modules/@types/serve-static/LICENSE +21 -0
  56. package/test/node_modules/@types/serve-static/README.md +16 -0
  57. package/test/node_modules/@types/serve-static/index.d.ts +113 -0
  58. package/test/node_modules/@types/serve-static/package.json +38 -0
  59. package/test/src/config.json +5 -0
  60. package/test/src/custom-log.class.ts +6 -0
  61. package/test/src/jwt-authentication.class.ts +29 -0
  62. package/test/src/test-request.class.ts +36 -0
  63. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +0 -17
  64. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +0 -30
  65. package/test/node_modules/@acuminous/bitsyntax/LICENSE +0 -6
  66. package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +0 -21
  67. package/test/node_modules/@acuminous/bitsyntax/Makefile +0 -15
  68. package/test/node_modules/@acuminous/bitsyntax/README.md +0 -308
  69. package/test/node_modules/@acuminous/bitsyntax/index.js +0 -10
  70. package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +0 -303
  71. package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +0 -142
  72. package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +0 -67
  73. package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +0 -232
  74. package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +0 -32
  75. package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +0 -1173
  76. package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +0 -119
  77. package/test/node_modules/@acuminous/bitsyntax/package.json +0 -36
  78. package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +0 -50
  79. package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +0 -193
  80. package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  81. package/test/node_modules/amqplib/.github/workflows/test.yml +0 -38
  82. package/test/node_modules/amqplib/CHANGELOG.md +0 -430
  83. package/test/node_modules/amqplib/LICENSE +0 -6
  84. package/test/node_modules/amqplib/LICENSE-MIT +0 -21
  85. package/test/node_modules/amqplib/Makefile +0 -47
  86. package/test/node_modules/amqplib/README.md +0 -157
  87. package/test/node_modules/amqplib/bin/generate-defs.js +0 -722
  88. package/test/node_modules/amqplib/callback_api.js +0 -22
  89. package/test/node_modules/amqplib/channel_api.js +0 -16
  90. package/test/node_modules/amqplib/examples/headers.js +0 -42
  91. package/test/node_modules/amqplib/examples/receive_generator.js +0 -39
  92. package/test/node_modules/amqplib/examples/send_generators.js +0 -42
  93. package/test/node_modules/amqplib/examples/ssl.js +0 -64
  94. package/test/node_modules/amqplib/examples/tutorials/README.md +0 -93
  95. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +0 -28
  96. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +0 -30
  97. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +0 -27
  98. package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +0 -27
  99. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +0 -30
  100. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +0 -36
  101. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +0 -56
  102. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +0 -55
  103. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +0 -49
  104. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +0 -45
  105. package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +0 -29
  106. package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +0 -35
  107. package/test/node_modules/amqplib/examples/tutorials/emit_log.js +0 -19
  108. package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +0 -20
  109. package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +0 -19
  110. package/test/node_modules/amqplib/examples/tutorials/new_task.js +0 -18
  111. package/test/node_modules/amqplib/examples/tutorials/package.json +0 -16
  112. package/test/node_modules/amqplib/examples/tutorials/receive.js +0 -21
  113. package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +0 -28
  114. package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +0 -44
  115. package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +0 -43
  116. package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +0 -52
  117. package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +0 -39
  118. package/test/node_modules/amqplib/examples/tutorials/send.js +0 -23
  119. package/test/node_modules/amqplib/examples/tutorials/worker.js +0 -28
  120. package/test/node_modules/amqplib/examples/waitForConfirms.js +0 -22
  121. package/test/node_modules/amqplib/lib/api_args.js +0 -314
  122. package/test/node_modules/amqplib/lib/bitset.js +0 -130
  123. package/test/node_modules/amqplib/lib/callback_model.js +0 -327
  124. package/test/node_modules/amqplib/lib/channel.js +0 -499
  125. package/test/node_modules/amqplib/lib/channel_model.js +0 -302
  126. package/test/node_modules/amqplib/lib/codec.js +0 -321
  127. package/test/node_modules/amqplib/lib/connect.js +0 -189
  128. package/test/node_modules/amqplib/lib/connection.js +0 -663
  129. package/test/node_modules/amqplib/lib/credentials.js +0 -42
  130. package/test/node_modules/amqplib/lib/defs.js +0 -4966
  131. package/test/node_modules/amqplib/lib/error.js +0 -24
  132. package/test/node_modules/amqplib/lib/format.js +0 -40
  133. package/test/node_modules/amqplib/lib/frame.js +0 -113
  134. package/test/node_modules/amqplib/lib/heartbeat.js +0 -89
  135. package/test/node_modules/amqplib/lib/mux.js +0 -129
  136. package/test/node_modules/amqplib/package.json +0 -37
  137. package/test/node_modules/amqplib/test/bitset.js +0 -69
  138. package/test/node_modules/amqplib/test/callback_api.js +0 -312
  139. package/test/node_modules/amqplib/test/channel.js +0 -621
  140. package/test/node_modules/amqplib/test/channel_api.js +0 -596
  141. package/test/node_modules/amqplib/test/codec.js +0 -237
  142. package/test/node_modules/amqplib/test/connect.js +0 -197
  143. package/test/node_modules/amqplib/test/connection.js +0 -390
  144. package/test/node_modules/amqplib/test/data.js +0 -254
  145. package/test/node_modules/amqplib/test/frame.js +0 -198
  146. package/test/node_modules/amqplib/test/mux.js +0 -204
  147. package/test/node_modules/amqplib/test/util.js +0 -219
  148. package/test/node_modules/buffer-more-ints/.travis.yml +0 -6
  149. package/test/node_modules/buffer-more-ints/LICENSE +0 -19
  150. package/test/node_modules/buffer-more-ints/README.md +0 -69
  151. package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +0 -183
  152. package/test/node_modules/buffer-more-ints/buffer-more-ints.js +0 -432
  153. package/test/node_modules/buffer-more-ints/package.json +0 -19
  154. package/test/node_modules/buffer-more-ints/polyfill.js +0 -71
  155. package/test/node_modules/core-util-is/LICENSE +0 -19
  156. package/test/node_modules/core-util-is/README.md +0 -3
  157. package/test/node_modules/core-util-is/lib/util.js +0 -107
  158. package/test/node_modules/core-util-is/package.json +0 -38
  159. package/test/node_modules/debug/LICENSE +0 -20
  160. package/test/node_modules/debug/README.md +0 -481
  161. package/test/node_modules/debug/package.json +0 -59
  162. package/test/node_modules/debug/src/browser.js +0 -269
  163. package/test/node_modules/debug/src/common.js +0 -274
  164. package/test/node_modules/debug/src/index.js +0 -10
  165. package/test/node_modules/debug/src/node.js +0 -263
  166. package/test/node_modules/inherits/LICENSE +0 -16
  167. package/test/node_modules/inherits/README.md +0 -42
  168. package/test/node_modules/inherits/inherits.js +0 -9
  169. package/test/node_modules/inherits/inherits_browser.js +0 -27
  170. package/test/node_modules/inherits/package.json +0 -29
  171. package/test/node_modules/isarray/README.md +0 -54
  172. package/test/node_modules/isarray/build/build.js +0 -209
  173. package/test/node_modules/isarray/component.json +0 -19
  174. package/test/node_modules/isarray/index.js +0 -3
  175. package/test/node_modules/isarray/package.json +0 -25
  176. package/test/node_modules/ms/index.js +0 -162
  177. package/test/node_modules/ms/license.md +0 -21
  178. package/test/node_modules/ms/package.json +0 -37
  179. package/test/node_modules/ms/readme.md +0 -60
  180. package/test/node_modules/querystringify/LICENSE +0 -22
  181. package/test/node_modules/querystringify/README.md +0 -61
  182. package/test/node_modules/querystringify/index.js +0 -118
  183. package/test/node_modules/querystringify/package.json +0 -38
  184. package/test/node_modules/readable-stream/LICENSE +0 -18
  185. package/test/node_modules/readable-stream/README.md +0 -15
  186. package/test/node_modules/readable-stream/duplex.js +0 -1
  187. package/test/node_modules/readable-stream/float.patch +0 -923
  188. package/test/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
  189. package/test/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
  190. package/test/node_modules/readable-stream/lib/_stream_readable.js +0 -951
  191. package/test/node_modules/readable-stream/lib/_stream_transform.js +0 -209
  192. package/test/node_modules/readable-stream/lib/_stream_writable.js +0 -477
  193. package/test/node_modules/readable-stream/package.json +0 -32
  194. package/test/node_modules/readable-stream/passthrough.js +0 -1
  195. package/test/node_modules/readable-stream/readable.js +0 -10
  196. package/test/node_modules/readable-stream/transform.js +0 -1
  197. package/test/node_modules/readable-stream/writable.js +0 -1
  198. package/test/node_modules/requires-port/.travis.yml +0 -19
  199. package/test/node_modules/requires-port/LICENSE +0 -22
  200. package/test/node_modules/requires-port/README.md +0 -47
  201. package/test/node_modules/requires-port/index.js +0 -38
  202. package/test/node_modules/requires-port/package.json +0 -47
  203. package/test/node_modules/requires-port/test.js +0 -98
  204. package/test/node_modules/safe-buffer/LICENSE +0 -21
  205. package/test/node_modules/safe-buffer/README.md +0 -584
  206. package/test/node_modules/safe-buffer/index.d.ts +0 -187
  207. package/test/node_modules/safe-buffer/index.js +0 -62
  208. package/test/node_modules/safe-buffer/package.json +0 -37
  209. package/test/node_modules/string_decoder/LICENSE +0 -20
  210. package/test/node_modules/string_decoder/README.md +0 -7
  211. package/test/node_modules/string_decoder/index.js +0 -221
  212. package/test/node_modules/string_decoder/package.json +0 -25
  213. package/test/node_modules/url-parse/LICENSE +0 -22
  214. package/test/node_modules/url-parse/README.md +0 -153
  215. package/test/node_modules/url-parse/dist/url-parse.js +0 -755
  216. package/test/node_modules/url-parse/dist/url-parse.min.js +0 -1
  217. package/test/node_modules/url-parse/dist/url-parse.min.js.map +0 -1
  218. package/test/node_modules/url-parse/index.js +0 -589
  219. package/test/node_modules/url-parse/package.json +0 -49
@@ -1,162 +0,0 @@
1
- /**
2
- * Helpers.
3
- */
4
-
5
- var s = 1000;
6
- var m = s * 60;
7
- var h = m * 60;
8
- var d = h * 24;
9
- var w = d * 7;
10
- var y = d * 365.25;
11
-
12
- /**
13
- * Parse or format the given `val`.
14
- *
15
- * Options:
16
- *
17
- * - `long` verbose formatting [false]
18
- *
19
- * @param {String|Number} val
20
- * @param {Object} [options]
21
- * @throws {Error} throw an error if val is not a non-empty string or a number
22
- * @return {String|Number}
23
- * @api public
24
- */
25
-
26
- module.exports = function(val, options) {
27
- options = options || {};
28
- var type = typeof val;
29
- if (type === 'string' && val.length > 0) {
30
- return parse(val);
31
- } else if (type === 'number' && isFinite(val)) {
32
- return options.long ? fmtLong(val) : fmtShort(val);
33
- }
34
- throw new Error(
35
- 'val is not a non-empty string or a valid number. val=' +
36
- JSON.stringify(val)
37
- );
38
- };
39
-
40
- /**
41
- * Parse the given `str` and return milliseconds.
42
- *
43
- * @param {String} str
44
- * @return {Number}
45
- * @api private
46
- */
47
-
48
- function parse(str) {
49
- str = String(str);
50
- if (str.length > 100) {
51
- return;
52
- }
53
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
54
- str
55
- );
56
- if (!match) {
57
- return;
58
- }
59
- var n = parseFloat(match[1]);
60
- var type = (match[2] || 'ms').toLowerCase();
61
- switch (type) {
62
- case 'years':
63
- case 'year':
64
- case 'yrs':
65
- case 'yr':
66
- case 'y':
67
- return n * y;
68
- case 'weeks':
69
- case 'week':
70
- case 'w':
71
- return n * w;
72
- case 'days':
73
- case 'day':
74
- case 'd':
75
- return n * d;
76
- case 'hours':
77
- case 'hour':
78
- case 'hrs':
79
- case 'hr':
80
- case 'h':
81
- return n * h;
82
- case 'minutes':
83
- case 'minute':
84
- case 'mins':
85
- case 'min':
86
- case 'm':
87
- return n * m;
88
- case 'seconds':
89
- case 'second':
90
- case 'secs':
91
- case 'sec':
92
- case 's':
93
- return n * s;
94
- case 'milliseconds':
95
- case 'millisecond':
96
- case 'msecs':
97
- case 'msec':
98
- case 'ms':
99
- return n;
100
- default:
101
- return undefined;
102
- }
103
- }
104
-
105
- /**
106
- * Short format for `ms`.
107
- *
108
- * @param {Number} ms
109
- * @return {String}
110
- * @api private
111
- */
112
-
113
- function fmtShort(ms) {
114
- var msAbs = Math.abs(ms);
115
- if (msAbs >= d) {
116
- return Math.round(ms / d) + 'd';
117
- }
118
- if (msAbs >= h) {
119
- return Math.round(ms / h) + 'h';
120
- }
121
- if (msAbs >= m) {
122
- return Math.round(ms / m) + 'm';
123
- }
124
- if (msAbs >= s) {
125
- return Math.round(ms / s) + 's';
126
- }
127
- return ms + 'ms';
128
- }
129
-
130
- /**
131
- * Long format for `ms`.
132
- *
133
- * @param {Number} ms
134
- * @return {String}
135
- * @api private
136
- */
137
-
138
- function fmtLong(ms) {
139
- var msAbs = Math.abs(ms);
140
- if (msAbs >= d) {
141
- return plural(ms, msAbs, d, 'day');
142
- }
143
- if (msAbs >= h) {
144
- return plural(ms, msAbs, h, 'hour');
145
- }
146
- if (msAbs >= m) {
147
- return plural(ms, msAbs, m, 'minute');
148
- }
149
- if (msAbs >= s) {
150
- return plural(ms, msAbs, s, 'second');
151
- }
152
- return ms + ' ms';
153
- }
154
-
155
- /**
156
- * Pluralization helper.
157
- */
158
-
159
- function plural(ms, msAbs, n, name) {
160
- var isPlural = msAbs >= n * 1.5;
161
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
162
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Zeit, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,37 +0,0 @@
1
- {
2
- "name": "ms",
3
- "version": "2.1.2",
4
- "description": "Tiny millisecond conversion utility",
5
- "repository": "zeit/ms",
6
- "main": "./index",
7
- "files": [
8
- "index.js"
9
- ],
10
- "scripts": {
11
- "precommit": "lint-staged",
12
- "lint": "eslint lib/* bin/*",
13
- "test": "mocha tests.js"
14
- },
15
- "eslintConfig": {
16
- "extends": "eslint:recommended",
17
- "env": {
18
- "node": true,
19
- "es6": true
20
- }
21
- },
22
- "lint-staged": {
23
- "*.js": [
24
- "npm run lint",
25
- "prettier --single-quote --write",
26
- "git add"
27
- ]
28
- },
29
- "license": "MIT",
30
- "devDependencies": {
31
- "eslint": "4.12.1",
32
- "expect.js": "0.3.1",
33
- "husky": "0.14.3",
34
- "lint-staged": "5.0.0",
35
- "mocha": "4.0.1"
36
- }
37
- }
@@ -1,60 +0,0 @@
1
- # ms
2
-
3
- [![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
4
- [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
5
-
6
- Use this package to easily convert various time formats to milliseconds.
7
-
8
- ## Examples
9
-
10
- ```js
11
- ms('2 days') // 172800000
12
- ms('1d') // 86400000
13
- ms('10h') // 36000000
14
- ms('2.5 hrs') // 9000000
15
- ms('2h') // 7200000
16
- ms('1m') // 60000
17
- ms('5s') // 5000
18
- ms('1y') // 31557600000
19
- ms('100') // 100
20
- ms('-3 days') // -259200000
21
- ms('-1h') // -3600000
22
- ms('-200') // -200
23
- ```
24
-
25
- ### Convert from Milliseconds
26
-
27
- ```js
28
- ms(60000) // "1m"
29
- ms(2 * 60000) // "2m"
30
- ms(-3 * 60000) // "-3m"
31
- ms(ms('10 hours')) // "10h"
32
- ```
33
-
34
- ### Time Format Written-Out
35
-
36
- ```js
37
- ms(60000, { long: true }) // "1 minute"
38
- ms(2 * 60000, { long: true }) // "2 minutes"
39
- ms(-3 * 60000, { long: true }) // "-3 minutes"
40
- ms(ms('10 hours'), { long: true }) // "10 hours"
41
- ```
42
-
43
- ## Features
44
-
45
- - Works both in [Node.js](https://nodejs.org) and in the browser
46
- - If a number is supplied to `ms`, a string with a unit is returned
47
- - If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
48
- - If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
49
-
50
- ## Related Packages
51
-
52
- - [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
53
-
54
- ## Caught a Bug?
55
-
56
- 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
57
- 2. Link the package to the global module directory: `npm link`
58
- 3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
59
-
60
- As always, you can run the tests using: `npm test`
@@ -1,22 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
@@ -1,61 +0,0 @@
1
- # querystringify
2
-
3
- [![Version npm](http://img.shields.io/npm/v/querystringify.svg?style=flat-square)](https://www.npmjs.com/package/querystringify)[![Build Status](http://img.shields.io/travis/unshiftio/querystringify/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/querystringify)[![Dependencies](https://img.shields.io/david/unshiftio/querystringify.svg?style=flat-square)](https://david-dm.org/unshiftio/querystringify)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/querystringify/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/querystringify?branch=master)
4
-
5
- A somewhat JSON compatible interface for query string parsing. This query string
6
- parser is dumb, don't expect to much from it as it only wants to parse simple
7
- query strings. If you want to parse complex, multi level and deeply nested
8
- query strings then you should ask your self. WTF am I doing?
9
-
10
- ## Installation
11
-
12
- This module is released in npm as `querystringify`. It's also compatible with
13
- `browserify` so it can be used on the server as well as on the client. To
14
- install it simply run the following command from your CLI:
15
-
16
- ```
17
- npm install --save querystringify
18
- ```
19
-
20
- ## Usage
21
-
22
- In the following examples we assume that you've already required the library as:
23
-
24
- ```js
25
- 'use strict';
26
-
27
- var qs = require('querystringify');
28
- ```
29
-
30
- ### qs.parse()
31
-
32
- The parse method transforms a given query string in to an object. Parameters
33
- without values are set to empty strings. It does not care if your query string
34
- is prefixed with a `?`, a `#`, or not prefixed. It just extracts the parts
35
- between the `=` and `&`:
36
-
37
- ```js
38
- qs.parse('?foo=bar'); // { foo: 'bar' }
39
- qs.parse('#foo=bar'); // { foo: 'bar' }
40
- qs.parse('foo=bar'); // { foo: 'bar' }
41
- qs.parse('foo=bar&bar=foo'); // { foo: 'bar', bar: 'foo' }
42
- qs.parse('foo&bar=foo'); // { foo: '', bar: 'foo' }
43
- ```
44
-
45
- ### qs.stringify()
46
-
47
- This transforms a given object in to a query string. By default we return the
48
- query string without a `?` prefix. If you want to prefix it by default simply
49
- supply `true` as second argument. If it should be prefixed by something else
50
- simply supply a string with the prefix value as second argument:
51
-
52
- ```js
53
- qs.stringify({ foo: bar }); // foo=bar
54
- qs.stringify({ foo: bar }, true); // ?foo=bar
55
- qs.stringify({ foo: bar }, '#'); // #foo=bar
56
- qs.stringify({ foo: '' }, '&'); // &foo=
57
- ```
58
-
59
- ## License
60
-
61
- MIT
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- var has = Object.prototype.hasOwnProperty
4
- , undef;
5
-
6
- /**
7
- * Decode a URI encoded string.
8
- *
9
- * @param {String} input The URI encoded string.
10
- * @returns {String|Null} The decoded string.
11
- * @api private
12
- */
13
- function decode(input) {
14
- try {
15
- return decodeURIComponent(input.replace(/\+/g, ' '));
16
- } catch (e) {
17
- return null;
18
- }
19
- }
20
-
21
- /**
22
- * Attempts to encode a given input.
23
- *
24
- * @param {String} input The string that needs to be encoded.
25
- * @returns {String|Null} The encoded string.
26
- * @api private
27
- */
28
- function encode(input) {
29
- try {
30
- return encodeURIComponent(input);
31
- } catch (e) {
32
- return null;
33
- }
34
- }
35
-
36
- /**
37
- * Simple query string parser.
38
- *
39
- * @param {String} query The query string that needs to be parsed.
40
- * @returns {Object}
41
- * @api public
42
- */
43
- function querystring(query) {
44
- var parser = /([^=?#&]+)=?([^&]*)/g
45
- , result = {}
46
- , part;
47
-
48
- while (part = parser.exec(query)) {
49
- var key = decode(part[1])
50
- , value = decode(part[2]);
51
-
52
- //
53
- // Prevent overriding of existing properties. This ensures that build-in
54
- // methods like `toString` or __proto__ are not overriden by malicious
55
- // querystrings.
56
- //
57
- // In the case if failed decoding, we want to omit the key/value pairs
58
- // from the result.
59
- //
60
- if (key === null || value === null || key in result) continue;
61
- result[key] = value;
62
- }
63
-
64
- return result;
65
- }
66
-
67
- /**
68
- * Transform a query string to an object.
69
- *
70
- * @param {Object} obj Object that should be transformed.
71
- * @param {String} prefix Optional prefix.
72
- * @returns {String}
73
- * @api public
74
- */
75
- function querystringify(obj, prefix) {
76
- prefix = prefix || '';
77
-
78
- var pairs = []
79
- , value
80
- , key;
81
-
82
- //
83
- // Optionally prefix with a '?' if needed
84
- //
85
- if ('string' !== typeof prefix) prefix = '?';
86
-
87
- for (key in obj) {
88
- if (has.call(obj, key)) {
89
- value = obj[key];
90
-
91
- //
92
- // Edge cases where we actually want to encode the value to an empty
93
- // string instead of the stringified value.
94
- //
95
- if (!value && (value === null || value === undef || isNaN(value))) {
96
- value = '';
97
- }
98
-
99
- key = encode(key);
100
- value = encode(value);
101
-
102
- //
103
- // If we failed to encode the strings, we should bail out as we don't
104
- // want to add invalid strings to the query.
105
- //
106
- if (key === null || value === null) continue;
107
- pairs.push(key +'='+ value);
108
- }
109
- }
110
-
111
- return pairs.length ? prefix + pairs.join('&') : '';
112
- }
113
-
114
- //
115
- // Expose the module.
116
- //
117
- exports.stringify = querystringify;
118
- exports.parse = querystring;
@@ -1,38 +0,0 @@
1
- {
2
- "name": "querystringify",
3
- "version": "2.2.0",
4
- "description": "Querystringify - Small, simple but powerful query string parser.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "nyc --reporter=html --reporter=text mocha test.js",
8
- "watch": "mocha --watch test.js"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/unshiftio/querystringify"
13
- },
14
- "keywords": [
15
- "query",
16
- "string",
17
- "query-string",
18
- "querystring",
19
- "qs",
20
- "stringify",
21
- "parse",
22
- "decode",
23
- "encode"
24
- ],
25
- "author": "Arnout Kazemier",
26
- "license": "MIT",
27
- "bugs": {
28
- "url": "https://github.com/unshiftio/querystringify/issues"
29
- },
30
- "homepage": "https://github.com/unshiftio/querystringify",
31
- "devDependencies": {
32
- "assume": "^2.1.0",
33
- "coveralls": "^3.1.0",
34
- "mocha": "^8.1.1",
35
- "nyc": "^15.1.0",
36
- "pre-commit": "^1.2.2"
37
- }
38
- }
@@ -1,18 +0,0 @@
1
- Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
- Permission is hereby granted, free of charge, to any person obtaining a copy
3
- of this software and associated documentation files (the "Software"), to
4
- deal in the Software without restriction, including without limitation the
5
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6
- sell copies of the Software, and to permit persons to whom the Software is
7
- furnished to do so, subject to the following conditions:
8
-
9
- The above copyright notice and this permission notice shall be included in
10
- all copies or substantial portions of the Software.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18
- IN THE SOFTWARE.
@@ -1,15 +0,0 @@
1
- # readable-stream
2
-
3
- ***Node-core streams for userland***
4
-
5
- [![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
6
- [![NPM](https://nodei.co/npm-dl/readable-stream.png&months=6&height=3)](https://nodei.co/npm/readable-stream/)
7
-
8
- This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
9
-
10
- If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
11
-
12
- **readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
13
-
14
- **readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
15
-
@@ -1 +0,0 @@
1
- module.exports = require("./lib/_stream_duplex.js")