mocha-compat 3.6.4 → 10.8.2
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/LICENSE +1 -1
- package/README.md +61 -110
- package/bin/_mocha +10 -0
- package/bin/mocha.js +142 -0
- package/browser-entry.js +61 -22
- package/lib/browser/highlight-tags.js +39 -0
- package/lib/browser/parse-query.js +24 -0
- package/lib/{template.html → browser/template.html} +7 -5
- package/lib/cli/cli.js +89 -0
- package/lib/cli/collect-files.js +137 -0
- package/lib/cli/commands.js +14 -0
- package/lib/cli/config.js +100 -0
- package/lib/cli/index.js +3 -0
- package/lib/cli/init.js +36 -0
- package/lib/cli/lookup-files.js +150 -0
- package/lib/cli/node-flags.js +85 -0
- package/lib/cli/one-and-dones.js +69 -0
- package/lib/cli/options.js +284 -0
- package/lib/cli/run-helpers.js +304 -0
- package/lib/cli/run-option-metadata.js +116 -0
- package/lib/cli/run.js +380 -0
- package/lib/cli/watch-run.js +377 -0
- package/lib/context.js +16 -42
- package/lib/errors.js +563 -0
- package/lib/hook.js +50 -9
- package/lib/interfaces/bdd.js +28 -29
- package/lib/interfaces/common.js +56 -21
- package/lib/interfaces/exports.js +4 -7
- package/lib/interfaces/qunit.js +10 -11
- package/lib/interfaces/tdd.js +15 -15
- package/lib/mocha.js +1073 -292
- package/lib/mocharc.json +10 -0
- package/lib/nodejs/buffered-worker-pool.js +188 -0
- package/lib/nodejs/esm-utils.js +106 -0
- package/lib/nodejs/file-unloader.js +15 -0
- package/lib/nodejs/parallel-buffered-runner.js +433 -0
- package/lib/nodejs/reporters/parallel-buffered.js +165 -0
- package/lib/nodejs/serializer.js +414 -0
- package/lib/nodejs/worker.js +151 -0
- package/lib/pending.js +3 -3
- package/lib/plugin-loader.js +286 -0
- package/lib/reporters/base.js +305 -205
- package/lib/reporters/doc.js +52 -21
- package/lib/reporters/dot.js +31 -18
- package/lib/reporters/html.js +153 -81
- package/lib/reporters/json-stream.js +53 -24
- package/lib/reporters/json.js +88 -18
- package/lib/reporters/landing.js +38 -16
- package/lib/reporters/list.js +34 -19
- package/lib/reporters/markdown.js +28 -15
- package/lib/reporters/min.js +22 -8
- package/lib/reporters/nyan.js +62 -58
- package/lib/reporters/progress.js +32 -19
- package/lib/reporters/spec.js +41 -23
- package/lib/reporters/tap.js +255 -32
- package/lib/reporters/xunit.js +89 -39
- package/lib/runnable.js +233 -148
- package/lib/runner.js +679 -380
- package/lib/stats-collector.js +83 -0
- package/lib/suite.js +376 -112
- package/lib/test.js +82 -21
- package/lib/utils.js +364 -477
- package/mocha.css +183 -54
- package/mocha.js +19840 -15846
- package/mocha.js.map +1 -0
- package/package.json +163 -336
- package/{lib/to-iso-string → vendor/serialize-javascript}/LICENSE +8 -6
- package/vendor/serialize-javascript/README.md +10 -0
- package/vendor/serialize-javascript/index.js +349 -0
- package/bin/_mocha-compat +0 -572
- package/bin/mocha-compat +0 -87
- package/bin/options.js +0 -41
- package/bower.json +0 -38
- package/images/error.png +0 -0
- package/images/ok.png +0 -0
- package/lib/browser/.eslintrc.yaml +0 -4
- package/lib/browser/debug.js +0 -7
- package/lib/browser/events.js +0 -195
- package/lib/browser/progress.js +0 -119
- package/lib/browser/tty.js +0 -13
- package/lib/ms.js +0 -130
- package/lib/to-iso-string/index.js +0 -37
- package/vendor/glob/LICENSE +0 -15
- package/vendor/glob/README.md +0 -399
- package/vendor/glob/common.js +0 -244
- package/vendor/glob/glob.js +0 -788
- package/vendor/glob/package.json +0 -55
- package/vendor/glob/sync.js +0 -486
- package/vendor/inflight/LICENSE +0 -15
- package/vendor/inflight/README.md +0 -37
- package/vendor/inflight/inflight.js +0 -54
- package/vendor/inflight/package.json +0 -29
package/bower.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mocha",
|
|
3
|
-
"homepage": "https://mochajs.org",
|
|
4
|
-
"description": "simple, flexible, fun test framework",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git://github.com/mochajs/mocha.git"
|
|
8
|
-
},
|
|
9
|
-
"main": [
|
|
10
|
-
"mocha.js",
|
|
11
|
-
"mocha.css"
|
|
12
|
-
],
|
|
13
|
-
"ignore": [
|
|
14
|
-
"bin",
|
|
15
|
-
"editors",
|
|
16
|
-
"images",
|
|
17
|
-
"lib",
|
|
18
|
-
"scripts",
|
|
19
|
-
"test",
|
|
20
|
-
"assets",
|
|
21
|
-
"media",
|
|
22
|
-
".*",
|
|
23
|
-
"index.js",
|
|
24
|
-
"karma.conf.js",
|
|
25
|
-
"browser-entry.js",
|
|
26
|
-
"Makefile",
|
|
27
|
-
"package.json",
|
|
28
|
-
"appveyor.yml"
|
|
29
|
-
],
|
|
30
|
-
"keywords": [
|
|
31
|
-
"mocha",
|
|
32
|
-
"test",
|
|
33
|
-
"bdd",
|
|
34
|
-
"tdd",
|
|
35
|
-
"tap"
|
|
36
|
-
],
|
|
37
|
-
"license": "MIT"
|
|
38
|
-
}
|
package/images/error.png
DELETED
|
Binary file
|
package/images/ok.png
DELETED
|
Binary file
|
package/lib/browser/debug.js
DELETED
package/lib/browser/events.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module exports.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
exports.EventEmitter = EventEmitter;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Object#toString reference.
|
|
11
|
-
*/
|
|
12
|
-
var objToString = Object.prototype.toString;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check if a value is an array.
|
|
16
|
-
*
|
|
17
|
-
* @api private
|
|
18
|
-
* @param {*} val The value to test.
|
|
19
|
-
* @return {boolean} true if the value is an array, otherwise false.
|
|
20
|
-
*/
|
|
21
|
-
function isArray (val) {
|
|
22
|
-
return objToString.call(val) === '[object Array]';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Event emitter constructor.
|
|
27
|
-
*
|
|
28
|
-
* @api public
|
|
29
|
-
*/
|
|
30
|
-
function EventEmitter () {}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Add a listener.
|
|
34
|
-
*
|
|
35
|
-
* @api public
|
|
36
|
-
* @param {string} name Event name.
|
|
37
|
-
* @param {Function} fn Event handler.
|
|
38
|
-
* @return {EventEmitter} Emitter instance.
|
|
39
|
-
*/
|
|
40
|
-
EventEmitter.prototype.on = function (name, fn) {
|
|
41
|
-
if (!this.$events) {
|
|
42
|
-
this.$events = {};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!this.$events[name]) {
|
|
46
|
-
this.$events[name] = fn;
|
|
47
|
-
} else if (isArray(this.$events[name])) {
|
|
48
|
-
this.$events[name].push(fn);
|
|
49
|
-
} else {
|
|
50
|
-
this.$events[name] = [this.$events[name], fn];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return this;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Adds a volatile listener.
|
|
60
|
-
*
|
|
61
|
-
* @api public
|
|
62
|
-
* @param {string} name Event name.
|
|
63
|
-
* @param {Function} fn Event handler.
|
|
64
|
-
* @return {EventEmitter} Emitter instance.
|
|
65
|
-
*/
|
|
66
|
-
EventEmitter.prototype.once = function (name, fn) {
|
|
67
|
-
var self = this;
|
|
68
|
-
|
|
69
|
-
function on () {
|
|
70
|
-
self.removeListener(name, on);
|
|
71
|
-
fn.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
on.listener = fn;
|
|
75
|
-
this.on(name, on);
|
|
76
|
-
|
|
77
|
-
return this;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Remove a listener.
|
|
82
|
-
*
|
|
83
|
-
* @api public
|
|
84
|
-
* @param {string} name Event name.
|
|
85
|
-
* @param {Function} fn Event handler.
|
|
86
|
-
* @return {EventEmitter} Emitter instance.
|
|
87
|
-
*/
|
|
88
|
-
EventEmitter.prototype.removeListener = function (name, fn) {
|
|
89
|
-
if (this.$events && this.$events[name]) {
|
|
90
|
-
var list = this.$events[name];
|
|
91
|
-
|
|
92
|
-
if (isArray(list)) {
|
|
93
|
-
var pos = -1;
|
|
94
|
-
|
|
95
|
-
for (var i = 0, l = list.length; i < l; i++) {
|
|
96
|
-
if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
|
|
97
|
-
pos = i;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (pos < 0) {
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
list.splice(pos, 1);
|
|
107
|
-
|
|
108
|
-
if (!list.length) {
|
|
109
|
-
delete this.$events[name];
|
|
110
|
-
}
|
|
111
|
-
} else if (list === fn || (list.listener && list.listener === fn)) {
|
|
112
|
-
delete this.$events[name];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return this;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Remove all listeners for an event.
|
|
121
|
-
*
|
|
122
|
-
* @api public
|
|
123
|
-
* @param {string} name Event name.
|
|
124
|
-
* @return {EventEmitter} Emitter instance.
|
|
125
|
-
*/
|
|
126
|
-
EventEmitter.prototype.removeAllListeners = function (name) {
|
|
127
|
-
if (name === undefined) {
|
|
128
|
-
this.$events = {};
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (this.$events && this.$events[name]) {
|
|
133
|
-
this.$events[name] = null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return this;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get all listeners for a given event.
|
|
141
|
-
*
|
|
142
|
-
* @api public
|
|
143
|
-
* @param {string} name Event name.
|
|
144
|
-
* @return {EventEmitter} Emitter instance.
|
|
145
|
-
*/
|
|
146
|
-
EventEmitter.prototype.listeners = function (name) {
|
|
147
|
-
if (!this.$events) {
|
|
148
|
-
this.$events = {};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (!this.$events[name]) {
|
|
152
|
-
this.$events[name] = [];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!isArray(this.$events[name])) {
|
|
156
|
-
this.$events[name] = [this.$events[name]];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return this.$events[name];
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Emit an event.
|
|
164
|
-
*
|
|
165
|
-
* @api public
|
|
166
|
-
* @param {string} name Event name.
|
|
167
|
-
* @return {boolean} true if at least one handler was invoked, else false.
|
|
168
|
-
*/
|
|
169
|
-
EventEmitter.prototype.emit = function (name) {
|
|
170
|
-
if (!this.$events) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
var handler = this.$events[name];
|
|
175
|
-
|
|
176
|
-
if (!handler) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
181
|
-
|
|
182
|
-
if (typeof handler === 'function') {
|
|
183
|
-
handler.apply(this, args);
|
|
184
|
-
} else if (isArray(handler)) {
|
|
185
|
-
var listeners = handler.slice();
|
|
186
|
-
|
|
187
|
-
for (var i = 0, l = listeners.length; i < l; i++) {
|
|
188
|
-
listeners[i].apply(this, args);
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return true;
|
|
195
|
-
};
|
package/lib/browser/progress.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Expose `Progress`.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = Progress;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Initialize a new `Progress` indicator.
|
|
11
|
-
*/
|
|
12
|
-
function Progress () {
|
|
13
|
-
this.percent = 0;
|
|
14
|
-
this.size(0);
|
|
15
|
-
this.fontSize(11);
|
|
16
|
-
this.font('helvetica, arial, sans-serif');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Set progress size to `size`.
|
|
21
|
-
*
|
|
22
|
-
* @api public
|
|
23
|
-
* @param {number} size
|
|
24
|
-
* @return {Progress} Progress instance.
|
|
25
|
-
*/
|
|
26
|
-
Progress.prototype.size = function (size) {
|
|
27
|
-
this._size = size;
|
|
28
|
-
return this;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Set text to `text`.
|
|
33
|
-
*
|
|
34
|
-
* @api public
|
|
35
|
-
* @param {string} text
|
|
36
|
-
* @return {Progress} Progress instance.
|
|
37
|
-
*/
|
|
38
|
-
Progress.prototype.text = function (text) {
|
|
39
|
-
this._text = text;
|
|
40
|
-
return this;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Set font size to `size`.
|
|
45
|
-
*
|
|
46
|
-
* @api public
|
|
47
|
-
* @param {number} size
|
|
48
|
-
* @return {Progress} Progress instance.
|
|
49
|
-
*/
|
|
50
|
-
Progress.prototype.fontSize = function (size) {
|
|
51
|
-
this._fontSize = size;
|
|
52
|
-
return this;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Set font to `family`.
|
|
57
|
-
*
|
|
58
|
-
* @param {string} family
|
|
59
|
-
* @return {Progress} Progress instance.
|
|
60
|
-
*/
|
|
61
|
-
Progress.prototype.font = function (family) {
|
|
62
|
-
this._font = family;
|
|
63
|
-
return this;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Update percentage to `n`.
|
|
68
|
-
*
|
|
69
|
-
* @param {number} n
|
|
70
|
-
* @return {Progress} Progress instance.
|
|
71
|
-
*/
|
|
72
|
-
Progress.prototype.update = function (n) {
|
|
73
|
-
this.percent = n;
|
|
74
|
-
return this;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Draw on `ctx`.
|
|
79
|
-
*
|
|
80
|
-
* @param {CanvasRenderingContext2d} ctx
|
|
81
|
-
* @return {Progress} Progress instance.
|
|
82
|
-
*/
|
|
83
|
-
Progress.prototype.draw = function (ctx) {
|
|
84
|
-
try {
|
|
85
|
-
var percent = Math.min(this.percent, 100);
|
|
86
|
-
var size = this._size;
|
|
87
|
-
var half = size / 2;
|
|
88
|
-
var x = half;
|
|
89
|
-
var y = half;
|
|
90
|
-
var rad = half - 1;
|
|
91
|
-
var fontSize = this._fontSize;
|
|
92
|
-
|
|
93
|
-
ctx.font = fontSize + 'px ' + this._font;
|
|
94
|
-
|
|
95
|
-
var angle = Math.PI * 2 * (percent / 100);
|
|
96
|
-
ctx.clearRect(0, 0, size, size);
|
|
97
|
-
|
|
98
|
-
// outer circle
|
|
99
|
-
ctx.strokeStyle = '#9f9f9f';
|
|
100
|
-
ctx.beginPath();
|
|
101
|
-
ctx.arc(x, y, rad, 0, angle, false);
|
|
102
|
-
ctx.stroke();
|
|
103
|
-
|
|
104
|
-
// inner circle
|
|
105
|
-
ctx.strokeStyle = '#eee';
|
|
106
|
-
ctx.beginPath();
|
|
107
|
-
ctx.arc(x, y, rad - 1, 0, angle, true);
|
|
108
|
-
ctx.stroke();
|
|
109
|
-
|
|
110
|
-
// text
|
|
111
|
-
var text = this._text || (percent | 0) + '%';
|
|
112
|
-
var w = ctx.measureText(text).width;
|
|
113
|
-
|
|
114
|
-
ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
|
|
115
|
-
} catch (err) {
|
|
116
|
-
// don't fail if we can't render progress
|
|
117
|
-
}
|
|
118
|
-
return this;
|
|
119
|
-
};
|
package/lib/browser/tty.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.isatty = function isatty () {
|
|
4
|
-
return true;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
exports.getWindowSize = function getWindowSize () {
|
|
8
|
-
if ('innerHeight' in global) {
|
|
9
|
-
return [global.innerHeight, global.innerWidth];
|
|
10
|
-
}
|
|
11
|
-
// In a Web Worker, the DOM Window is not available.
|
|
12
|
-
return [640, 480];
|
|
13
|
-
};
|
package/lib/ms.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Helpers.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var s = 1000;
|
|
8
|
-
var m = s * 60;
|
|
9
|
-
var h = m * 60;
|
|
10
|
-
var d = h * 24;
|
|
11
|
-
var y = d * 365.25;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Parse or format the given `val`.
|
|
15
|
-
*
|
|
16
|
-
* Options:
|
|
17
|
-
*
|
|
18
|
-
* - `long` verbose formatting [false]
|
|
19
|
-
*
|
|
20
|
-
* @api public
|
|
21
|
-
* @param {string|number} val
|
|
22
|
-
* @param {Object} options
|
|
23
|
-
* @return {string|number}
|
|
24
|
-
*/
|
|
25
|
-
module.exports = function (val, options) {
|
|
26
|
-
options = options || {};
|
|
27
|
-
if (typeof val === 'string') {
|
|
28
|
-
return parse(val);
|
|
29
|
-
}
|
|
30
|
-
// https://github.com/mochajs/mocha/pull/1035
|
|
31
|
-
return options['long'] ? longFormat(val) : shortFormat(val);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Parse the given `str` and return milliseconds.
|
|
36
|
-
*
|
|
37
|
-
* @api private
|
|
38
|
-
* @param {string} str
|
|
39
|
-
* @return {number}
|
|
40
|
-
*/
|
|
41
|
-
function parse (str) {
|
|
42
|
-
var match = (/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i).exec(str);
|
|
43
|
-
if (!match) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
var n = parseFloat(match[1]);
|
|
47
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
48
|
-
switch (type) {
|
|
49
|
-
case 'years':
|
|
50
|
-
case 'year':
|
|
51
|
-
case 'y':
|
|
52
|
-
return n * y;
|
|
53
|
-
case 'days':
|
|
54
|
-
case 'day':
|
|
55
|
-
case 'd':
|
|
56
|
-
return n * d;
|
|
57
|
-
case 'hours':
|
|
58
|
-
case 'hour':
|
|
59
|
-
case 'h':
|
|
60
|
-
return n * h;
|
|
61
|
-
case 'minutes':
|
|
62
|
-
case 'minute':
|
|
63
|
-
case 'm':
|
|
64
|
-
return n * m;
|
|
65
|
-
case 'seconds':
|
|
66
|
-
case 'second':
|
|
67
|
-
case 's':
|
|
68
|
-
return n * s;
|
|
69
|
-
case 'ms':
|
|
70
|
-
return n;
|
|
71
|
-
default:
|
|
72
|
-
// No default case
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Short format for `ms`.
|
|
78
|
-
*
|
|
79
|
-
* @api private
|
|
80
|
-
* @param {number} ms
|
|
81
|
-
* @return {string}
|
|
82
|
-
*/
|
|
83
|
-
function shortFormat (ms) {
|
|
84
|
-
if (ms >= d) {
|
|
85
|
-
return Math.round(ms / d) + 'd';
|
|
86
|
-
}
|
|
87
|
-
if (ms >= h) {
|
|
88
|
-
return Math.round(ms / h) + 'h';
|
|
89
|
-
}
|
|
90
|
-
if (ms >= m) {
|
|
91
|
-
return Math.round(ms / m) + 'm';
|
|
92
|
-
}
|
|
93
|
-
if (ms >= s) {
|
|
94
|
-
return Math.round(ms / s) + 's';
|
|
95
|
-
}
|
|
96
|
-
return ms + 'ms';
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Long format for `ms`.
|
|
101
|
-
*
|
|
102
|
-
* @api private
|
|
103
|
-
* @param {number} ms
|
|
104
|
-
* @return {string}
|
|
105
|
-
*/
|
|
106
|
-
function longFormat (ms) {
|
|
107
|
-
return plural(ms, d, 'day') ||
|
|
108
|
-
plural(ms, h, 'hour') ||
|
|
109
|
-
plural(ms, m, 'minute') ||
|
|
110
|
-
plural(ms, s, 'second') ||
|
|
111
|
-
ms + ' ms';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Pluralization helper.
|
|
116
|
-
*
|
|
117
|
-
* @api private
|
|
118
|
-
* @param {number} ms
|
|
119
|
-
* @param {number} n
|
|
120
|
-
* @param {string} name
|
|
121
|
-
*/
|
|
122
|
-
function plural (ms, n, name) {
|
|
123
|
-
if (ms < n) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (ms < n * 1.5) {
|
|
127
|
-
return Math.floor(ms / n) + ' ' + name;
|
|
128
|
-
}
|
|
129
|
-
return Math.ceil(ms / n) + ' ' + name + 's';
|
|
130
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pad a `number` with a ten's place zero.
|
|
5
|
-
*
|
|
6
|
-
* @param {number} number
|
|
7
|
-
* @return {string}
|
|
8
|
-
*/
|
|
9
|
-
function pad(number) {
|
|
10
|
-
var n = number.toString();
|
|
11
|
-
return n.length === 1 ? '0' + n : n;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Turn a `date` into an ISO string.
|
|
16
|
-
*
|
|
17
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
|
18
|
-
*
|
|
19
|
-
* @param {Date} date
|
|
20
|
-
* @return {string}
|
|
21
|
-
*/
|
|
22
|
-
function toISOString(date) {
|
|
23
|
-
return date.getUTCFullYear()
|
|
24
|
-
+ '-' + pad(date.getUTCMonth() + 1)
|
|
25
|
-
+ '-' + pad(date.getUTCDate())
|
|
26
|
-
+ 'T' + pad(date.getUTCHours())
|
|
27
|
-
+ ':' + pad(date.getUTCMinutes())
|
|
28
|
-
+ ':' + pad(date.getUTCSeconds())
|
|
29
|
-
+ '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
|
|
30
|
-
+ 'Z';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* Exports.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
module.exports = toISOString;
|
package/vendor/glob/LICENSE
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
The ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|