typespeed 2.0.13 → 2.0.16
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.
- package/dist/core.decorator.js +0 -1
- package/dist/database.decorator.js +0 -1
- package/dist/default/express-server.class.js +0 -1
- package/dist/default/log-default.class.js +0 -1
- package/dist/default/node-cache.class.js +0 -1
- package/dist/default/rabbitmq.class.js +0 -1
- package/dist/default/read-write-db.class.js +0 -1
- package/dist/default/redis.class.js +0 -1
- package/dist/factory/cache-factory.class.js +0 -1
- package/dist/factory/data-source-factory.class.js +0 -1
- package/dist/factory/log-factory.class.js +0 -1
- package/dist/factory/server-factory.class.js +0 -1
- package/dist/route.decorator.js +0 -1
- package/dist/scaffold/command.js +0 -1
- package/dist/typespeed.d.ts +133 -12
- package/dist/typespeed.js +1 -1
- package/package.json +2 -2
- package/src/typespeed.d.ts +133 -0
- package/src/typespeed.ts +2 -1
- package/test/node_modules/.package-lock.json +112 -4
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +17 -0
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +30 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE +6 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +21 -0
- package/test/node_modules/@acuminous/bitsyntax/Makefile +15 -0
- package/test/node_modules/@acuminous/bitsyntax/README.md +308 -0
- package/test/node_modules/@acuminous/bitsyntax/index.js +10 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +303 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +142 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +67 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +232 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +32 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +1173 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +119 -0
- package/test/node_modules/@acuminous/bitsyntax/package.json +36 -0
- package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +50 -0
- package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +193 -0
- package/test/node_modules/@types/node/README.md +1 -1
- package/test/node_modules/@types/node/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/globals.d.ts +1 -0
- package/test/node_modules/@types/node/package.json +2 -2
- package/test/node_modules/@types/node/test.d.ts +43 -20
- package/test/node_modules/@types/node/ts4.8/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/ts4.8/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
- package/test/node_modules/@types/node/ts4.8/test.d.ts +43 -19
- package/test/node_modules/@types/node/ts4.8/url.d.ts +3 -3
- package/test/node_modules/@types/node/ts4.8/util.d.ts +1 -1
- package/test/node_modules/@types/node/url.d.ts +3 -3
- package/test/node_modules/@types/node/util.d.ts +1 -1
- package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/test/node_modules/amqplib/.github/workflows/test.yml +38 -0
- package/test/node_modules/amqplib/CHANGELOG.md +430 -0
- package/test/node_modules/amqplib/LICENSE +6 -0
- package/test/node_modules/amqplib/LICENSE-MIT +21 -0
- package/test/node_modules/amqplib/Makefile +47 -0
- package/test/node_modules/amqplib/README.md +157 -0
- package/test/node_modules/amqplib/bin/generate-defs.js +722 -0
- package/test/node_modules/amqplib/callback_api.js +22 -0
- package/test/node_modules/amqplib/channel_api.js +16 -0
- package/test/node_modules/amqplib/examples/headers.js +42 -0
- package/test/node_modules/amqplib/examples/receive_generator.js +39 -0
- package/test/node_modules/amqplib/examples/send_generators.js +42 -0
- package/test/node_modules/amqplib/examples/ssl.js +64 -0
- package/test/node_modules/amqplib/examples/tutorials/README.md +93 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +36 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +56 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +55 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +49 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +45 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +29 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +35 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +20 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/new_task.js +18 -0
- package/test/node_modules/amqplib/examples/tutorials/package.json +16 -0
- package/test/node_modules/amqplib/examples/tutorials/receive.js +21 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +44 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +43 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +52 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +39 -0
- package/test/node_modules/amqplib/examples/tutorials/send.js +23 -0
- package/test/node_modules/amqplib/examples/tutorials/worker.js +28 -0
- package/test/node_modules/amqplib/examples/waitForConfirms.js +22 -0
- package/test/node_modules/amqplib/lib/api_args.js +314 -0
- package/test/node_modules/amqplib/lib/bitset.js +130 -0
- package/test/node_modules/amqplib/lib/callback_model.js +327 -0
- package/test/node_modules/amqplib/lib/channel.js +499 -0
- package/test/node_modules/amqplib/lib/channel_model.js +302 -0
- package/test/node_modules/amqplib/lib/codec.js +321 -0
- package/test/node_modules/amqplib/lib/connect.js +189 -0
- package/test/node_modules/amqplib/lib/connection.js +663 -0
- package/test/node_modules/amqplib/lib/credentials.js +42 -0
- package/test/node_modules/amqplib/lib/defs.js +4966 -0
- package/test/node_modules/amqplib/lib/error.js +24 -0
- package/test/node_modules/amqplib/lib/format.js +40 -0
- package/test/node_modules/amqplib/lib/frame.js +113 -0
- package/test/node_modules/amqplib/lib/heartbeat.js +89 -0
- package/test/node_modules/amqplib/lib/mux.js +129 -0
- package/test/node_modules/amqplib/package.json +37 -0
- package/test/node_modules/amqplib/test/bitset.js +69 -0
- package/test/node_modules/amqplib/test/callback_api.js +312 -0
- package/test/node_modules/amqplib/test/channel.js +621 -0
- package/test/node_modules/amqplib/test/channel_api.js +596 -0
- package/test/node_modules/amqplib/test/codec.js +237 -0
- package/test/node_modules/amqplib/test/connect.js +197 -0
- package/test/node_modules/amqplib/test/connection.js +390 -0
- package/test/node_modules/amqplib/test/data.js +254 -0
- package/test/node_modules/amqplib/test/frame.js +198 -0
- package/test/node_modules/amqplib/test/mux.js +204 -0
- package/test/node_modules/amqplib/test/util.js +219 -0
- package/test/node_modules/buffer-more-ints/.travis.yml +6 -0
- package/test/node_modules/buffer-more-ints/LICENSE +19 -0
- package/test/node_modules/buffer-more-ints/README.md +69 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +183 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints.js +432 -0
- package/test/node_modules/buffer-more-ints/package.json +19 -0
- package/test/node_modules/buffer-more-ints/polyfill.js +71 -0
- package/test/node_modules/core-util-is/LICENSE +19 -0
- package/test/node_modules/core-util-is/README.md +3 -0
- package/test/node_modules/core-util-is/lib/util.js +107 -0
- package/test/node_modules/core-util-is/package.json +38 -0
- package/test/node_modules/debug/LICENSE +20 -0
- package/test/node_modules/debug/README.md +481 -0
- package/test/node_modules/debug/package.json +59 -0
- package/test/node_modules/debug/src/browser.js +269 -0
- package/test/node_modules/debug/src/common.js +274 -0
- package/test/node_modules/debug/src/index.js +10 -0
- package/test/node_modules/debug/src/node.js +263 -0
- package/test/node_modules/inherits/LICENSE +16 -0
- package/test/node_modules/inherits/README.md +42 -0
- package/test/node_modules/inherits/inherits.js +9 -0
- package/test/node_modules/inherits/inherits_browser.js +27 -0
- package/test/node_modules/inherits/package.json +29 -0
- package/test/node_modules/isarray/README.md +54 -0
- package/test/node_modules/isarray/build/build.js +209 -0
- package/test/node_modules/isarray/component.json +19 -0
- package/test/node_modules/isarray/index.js +3 -0
- package/test/node_modules/isarray/package.json +25 -0
- package/test/node_modules/ms/index.js +162 -0
- package/test/node_modules/ms/license.md +21 -0
- package/test/node_modules/ms/package.json +37 -0
- package/test/node_modules/ms/readme.md +60 -0
- package/test/node_modules/querystringify/LICENSE +22 -0
- package/test/node_modules/querystringify/README.md +61 -0
- package/test/node_modules/querystringify/index.js +118 -0
- package/test/node_modules/querystringify/package.json +38 -0
- package/test/node_modules/readable-stream/LICENSE +18 -0
- package/test/node_modules/readable-stream/README.md +15 -0
- package/test/node_modules/readable-stream/duplex.js +1 -0
- package/test/node_modules/readable-stream/float.patch +923 -0
- package/test/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
- package/test/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
- package/test/node_modules/readable-stream/lib/_stream_readable.js +951 -0
- package/test/node_modules/readable-stream/lib/_stream_transform.js +209 -0
- package/test/node_modules/readable-stream/lib/_stream_writable.js +477 -0
- package/test/node_modules/readable-stream/package.json +32 -0
- package/test/node_modules/readable-stream/passthrough.js +1 -0
- package/test/node_modules/readable-stream/readable.js +10 -0
- package/test/node_modules/readable-stream/transform.js +1 -0
- package/test/node_modules/readable-stream/writable.js +1 -0
- package/test/node_modules/requires-port/.travis.yml +19 -0
- package/test/node_modules/requires-port/LICENSE +22 -0
- package/test/node_modules/requires-port/README.md +47 -0
- package/test/node_modules/requires-port/index.js +38 -0
- package/test/node_modules/requires-port/package.json +47 -0
- package/test/node_modules/requires-port/test.js +98 -0
- package/test/node_modules/safe-buffer/LICENSE +21 -0
- package/test/node_modules/safe-buffer/README.md +584 -0
- package/test/node_modules/safe-buffer/index.d.ts +187 -0
- package/test/node_modules/safe-buffer/index.js +62 -0
- package/test/node_modules/safe-buffer/package.json +37 -0
- package/test/node_modules/string_decoder/LICENSE +20 -0
- package/test/node_modules/string_decoder/README.md +7 -0
- package/test/node_modules/string_decoder/index.js +221 -0
- package/test/node_modules/string_decoder/package.json +25 -0
- package/test/node_modules/url-parse/LICENSE +22 -0
- package/test/node_modules/url-parse/README.md +153 -0
- package/test/node_modules/url-parse/dist/url-parse.js +755 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js +1 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js.map +1 -0
- package/test/node_modules/url-parse/index.js +589 -0
- package/test/node_modules/url-parse/package.json +49 -0
- package/test/src/test-mq.class.ts +1 -2
- package/tsconfig.json +4 -3
- package/dist/core.decorator.d.ts +0 -18
- package/dist/core.decorator.js.map +0 -1
- package/dist/database.decorator.d.ts +0 -24
- package/dist/database.decorator.js.map +0 -1
- package/dist/default/express-server.class.d.ts +0 -15
- package/dist/default/express-server.class.js.map +0 -1
- package/dist/default/log-default.class.d.ts +0 -6
- package/dist/default/log-default.class.js.map +0 -1
- package/dist/default/node-cache.class.d.ts +0 -13
- package/dist/default/node-cache.class.js.map +0 -1
- package/dist/default/rabbitmq.class.d.ts +0 -9
- package/dist/default/rabbitmq.class.js.map +0 -1
- package/dist/default/read-write-db.class.d.ts +0 -10
- package/dist/default/read-write-db.class.js.map +0 -1
- package/dist/default/redis.class.d.ts +0 -5
- package/dist/default/redis.class.js.map +0 -1
- package/dist/factory/cache-factory.class.d.ts +0 -7
- package/dist/factory/cache-factory.class.js.map +0 -1
- package/dist/factory/data-source-factory.class.d.ts +0 -4
- package/dist/factory/data-source-factory.class.js.map +0 -1
- package/dist/factory/log-factory.class.d.ts +0 -4
- package/dist/factory/log-factory.class.js.map +0 -1
- package/dist/factory/server-factory.class.d.ts +0 -6
- package/dist/factory/server-factory.class.js.map +0 -1
- package/dist/route.decorator.d.ts +0 -8
- package/dist/route.decorator.js.map +0 -1
- package/dist/scaffold/command.d.ts +0 -2
- package/dist/scaffold/command.js.map +0 -1
- package/dist/typespeed.js.map +0 -1
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ms
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/zeit/ms)
|
|
4
|
+
[](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`
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# querystringify
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/querystringify)[](https://travis-ci.org/unshiftio/querystringify)[](https://david-dm.org/unshiftio/querystringify)[](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
|
|
@@ -0,0 +1,118 @@
|
|
|
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;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# readable-stream
|
|
2
|
+
|
|
3
|
+
***Node-core streams for userland***
|
|
4
|
+
|
|
5
|
+
[](https://nodei.co/npm/readable-stream/)
|
|
6
|
+
[](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
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./lib/_stream_duplex.js")
|