test-filesystem 1.0.0
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 +674 -0
- package/README.md +163 -0
- package/browser/test-fs.js +2856 -0
- package/browser/test-fs.min.js +1 -0
- package/dist/cjs/functions/circularObject.js +54 -0
- package/dist/cjs/functions/circularObject.min.js +1 -0
- package/dist/cjs/functions/countMatches.js +17 -0
- package/dist/cjs/functions/countMatches.min.js +1 -0
- package/dist/cjs/functions/deepReferenceObject.js +24 -0
- package/dist/cjs/functions/deepReferenceObject.min.js +1 -0
- package/dist/cjs/functions/domItem.js +37 -0
- package/dist/cjs/functions/domItem.min.js +1 -0
- package/dist/cjs/functions/jsonDom.js +24 -0
- package/dist/cjs/functions/jsonDom.min.js +1 -0
- package/dist/cjs/functions/linkedList.js +27 -0
- package/dist/cjs/functions/linkedList.min.js +1 -0
- package/dist/cjs/functions/logObject.js +24 -0
- package/dist/cjs/functions/logObject.min.js +1 -0
- package/dist/cjs/functions/multiReferenceObject.js +24 -0
- package/dist/cjs/functions/multiReferenceObject.min.js +1 -0
- package/dist/cjs/functions/nodeTree.js +32 -0
- package/dist/cjs/functions/nodeTree.min.js +1 -0
- package/dist/cjs/functions/removeDirectory.js +19 -0
- package/dist/cjs/functions/removeDirectory.min.js +1 -0
- package/dist/cjs/functions/setUp.js +87 -0
- package/dist/cjs/functions/setUp.min.js +1 -0
- package/dist/cjs/main.js +58 -0
- package/dist/cjs/main.min.js +1 -0
- package/dist/mjs/functions/circularObject.d.ts +14 -0
- package/dist/mjs/functions/circularObject.min.mjs +1 -0
- package/dist/mjs/functions/circularObject.mjs +33 -0
- package/dist/mjs/functions/countMatches.d.ts +10 -0
- package/dist/mjs/functions/countMatches.min.mjs +1 -0
- package/dist/mjs/functions/countMatches.mjs +10 -0
- package/dist/mjs/functions/deepReferenceObject.d.ts +18 -0
- package/dist/mjs/functions/deepReferenceObject.min.mjs +1 -0
- package/dist/mjs/functions/deepReferenceObject.mjs +24 -0
- package/dist/mjs/functions/domItem.d.ts +24 -0
- package/dist/mjs/functions/domItem.min.mjs +1 -0
- package/dist/mjs/functions/domItem.mjs +30 -0
- package/dist/mjs/functions/jsonDom.d.ts +8 -0
- package/dist/mjs/functions/jsonDom.min.mjs +1 -0
- package/dist/mjs/functions/jsonDom.mjs +15 -0
- package/dist/mjs/functions/linkedList.d.ts +12 -0
- package/dist/mjs/functions/linkedList.min.mjs +1 -0
- package/dist/mjs/functions/linkedList.mjs +9 -0
- package/dist/mjs/functions/logObject.d.ts +11 -0
- package/dist/mjs/functions/logObject.min.mjs +1 -0
- package/dist/mjs/functions/logObject.mjs +17 -0
- package/dist/mjs/functions/multiReferenceObject.d.ts +18 -0
- package/dist/mjs/functions/multiReferenceObject.min.mjs +1 -0
- package/dist/mjs/functions/multiReferenceObject.mjs +24 -0
- package/dist/mjs/functions/nodeTree.d.ts +12 -0
- package/dist/mjs/functions/nodeTree.min.mjs +1 -0
- package/dist/mjs/functions/nodeTree.mjs +10 -0
- package/dist/mjs/functions/removeDirectory.d.ts +9 -0
- package/dist/mjs/functions/removeDirectory.min.mjs +1 -0
- package/dist/mjs/functions/removeDirectory.mjs +12 -0
- package/dist/mjs/functions/setUp.d.ts +30 -0
- package/dist/mjs/functions/setUp.min.mjs +1 -0
- package/dist/mjs/functions/setUp.mjs +56 -0
- package/dist/mjs/main.d.ts +93 -0
- package/dist/mjs/main.min.mjs +1 -0
- package/dist/mjs/main.mjs +50 -0
- package/gulpfile.js +221 -0
- package/package.json +58 -0
|
@@ -0,0 +1,2856 @@
|
|
|
1
|
+
(function () { function r (e, n, t) { function o (i, f) { if (!n[i]) { if (!e[i]) { var c = typeof require === 'function' && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = 'MODULE_NOT_FOUND', a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = typeof require === 'function' && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
|
|
2
|
+
1: [function (require, module, exports) {
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, '__esModule', {
|
|
6
|
+
value: true
|
|
7
|
+
})
|
|
8
|
+
exports.default = exports.circularObject = void 0
|
|
9
|
+
/**
|
|
10
|
+
* Multilayered node tree-like structure with parent references
|
|
11
|
+
* @memberOf module:test-fs
|
|
12
|
+
* @type {Object.<string, string|Object|Array>}
|
|
13
|
+
*/
|
|
14
|
+
const circularObject = exports.circularObject = {
|
|
15
|
+
name: 'root',
|
|
16
|
+
parent: null,
|
|
17
|
+
body: null,
|
|
18
|
+
head: null,
|
|
19
|
+
children: []
|
|
20
|
+
}
|
|
21
|
+
circularObject.children = [{
|
|
22
|
+
name: 'body',
|
|
23
|
+
parent: null,
|
|
24
|
+
children: []
|
|
25
|
+
}, {
|
|
26
|
+
name: 'head',
|
|
27
|
+
parent: null,
|
|
28
|
+
children: []
|
|
29
|
+
}]
|
|
30
|
+
circularObject.body = circularObject.children[0]
|
|
31
|
+
circularObject.head = circularObject.children[1]
|
|
32
|
+
circularObject.body.parent = circularObject
|
|
33
|
+
circularObject.head.parent = circularObject
|
|
34
|
+
circularObject.body.children = [{
|
|
35
|
+
name: 'body child one',
|
|
36
|
+
parent: null,
|
|
37
|
+
children: []
|
|
38
|
+
}, {
|
|
39
|
+
name: 'body child two',
|
|
40
|
+
parent: null,
|
|
41
|
+
children: []
|
|
42
|
+
}]
|
|
43
|
+
circularObject.body.children[0].parent = circularObject.body
|
|
44
|
+
circularObject.body.children[1].parent = circularObject.body
|
|
45
|
+
circularObject.head.children = [{
|
|
46
|
+
name: 'head child one',
|
|
47
|
+
parent: null,
|
|
48
|
+
children: []
|
|
49
|
+
}, {
|
|
50
|
+
name: 'head child two',
|
|
51
|
+
parent: null,
|
|
52
|
+
children: []
|
|
53
|
+
}]
|
|
54
|
+
circularObject.head.children[0].parent = circularObject.head
|
|
55
|
+
circularObject.head.children[1].parent = circularObject.head
|
|
56
|
+
var _default = exports.default = circularObject
|
|
57
|
+
}, {}],
|
|
58
|
+
2: [function (require, module, exports) {
|
|
59
|
+
'use strict'
|
|
60
|
+
|
|
61
|
+
Object.defineProperty(exports, '__esModule', {
|
|
62
|
+
value: true
|
|
63
|
+
})
|
|
64
|
+
exports.default = exports.countMatches = void 0
|
|
65
|
+
/**
|
|
66
|
+
* Simple way to count string occurrences for testing.
|
|
67
|
+
* @function
|
|
68
|
+
* @memberOf module:test-fs
|
|
69
|
+
* @param {string} content
|
|
70
|
+
* @param {string} search
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
73
|
+
const countMatches = (content, search) => content.split(search).length - 1
|
|
74
|
+
exports.countMatches = countMatches
|
|
75
|
+
var _default = exports.default = countMatches
|
|
76
|
+
}, {}],
|
|
77
|
+
3: [function (require, module, exports) {
|
|
78
|
+
'use strict'
|
|
79
|
+
|
|
80
|
+
Object.defineProperty(exports, '__esModule', {
|
|
81
|
+
value: true
|
|
82
|
+
})
|
|
83
|
+
exports.default = exports.deepReferenceObject = void 0
|
|
84
|
+
/**
|
|
85
|
+
* Sample object with deep references.
|
|
86
|
+
* @memberOf module:test-fs
|
|
87
|
+
* @type {Object.<string, string|number|Object>}
|
|
88
|
+
*/
|
|
89
|
+
const deepReferenceObject = exports.deepReferenceObject = {
|
|
90
|
+
object1: {
|
|
91
|
+
name: 'someName',
|
|
92
|
+
object2: {
|
|
93
|
+
age: 12,
|
|
94
|
+
array1: ['someString', 'anotherString']
|
|
95
|
+
},
|
|
96
|
+
array2: [89, 32]
|
|
97
|
+
},
|
|
98
|
+
title: 'Some Title',
|
|
99
|
+
item: 45
|
|
100
|
+
}
|
|
101
|
+
var _default = exports.default = deepReferenceObject
|
|
102
|
+
}, {}],
|
|
103
|
+
4: [function (require, module, exports) {
|
|
104
|
+
'use strict'
|
|
105
|
+
|
|
106
|
+
Object.defineProperty(exports, '__esModule', {
|
|
107
|
+
value: true
|
|
108
|
+
})
|
|
109
|
+
exports.domItem = exports.default = void 0
|
|
110
|
+
/**
|
|
111
|
+
* Sample of domItem child with nested child and optional details
|
|
112
|
+
* @memberOf module:test-fs
|
|
113
|
+
* @type {Object.<string, string|number|Array|Object>}
|
|
114
|
+
*/
|
|
115
|
+
const domItem = exports.domItem = [{
|
|
116
|
+
attributes: {
|
|
117
|
+
className: 'row',
|
|
118
|
+
style: {}
|
|
119
|
+
},
|
|
120
|
+
axis: 'y',
|
|
121
|
+
children: [{
|
|
122
|
+
attributes: {
|
|
123
|
+
style: {}
|
|
124
|
+
},
|
|
125
|
+
axis: 'x',
|
|
126
|
+
children: [],
|
|
127
|
+
element: {},
|
|
128
|
+
eventListeners: {},
|
|
129
|
+
hasShip: false,
|
|
130
|
+
isHit: false,
|
|
131
|
+
parentItem: {},
|
|
132
|
+
point: {},
|
|
133
|
+
tagName: 'div'
|
|
134
|
+
}],
|
|
135
|
+
element: null,
|
|
136
|
+
eventListeners: {},
|
|
137
|
+
parentItem: {},
|
|
138
|
+
tagName: 'div'
|
|
139
|
+
}]
|
|
140
|
+
var _default = exports.default = domItem
|
|
141
|
+
}, {}],
|
|
142
|
+
5: [function (require, module, exports) {
|
|
143
|
+
'use strict'
|
|
144
|
+
|
|
145
|
+
Object.defineProperty(exports, '__esModule', {
|
|
146
|
+
value: true
|
|
147
|
+
})
|
|
148
|
+
exports.jsonDom = exports.default = void 0
|
|
149
|
+
/**
|
|
150
|
+
* Sample of jsonDom object containing an empty nested array and objects
|
|
151
|
+
* @memberOf module:test-fs
|
|
152
|
+
* @type {Object.<string, string|number|Array|Object>}
|
|
153
|
+
*/
|
|
154
|
+
const jsonDom = exports.jsonDom = {
|
|
155
|
+
tagName: 'div',
|
|
156
|
+
attributes: {
|
|
157
|
+
style: {},
|
|
158
|
+
className: 'column'
|
|
159
|
+
},
|
|
160
|
+
element: null,
|
|
161
|
+
eventListeners: {},
|
|
162
|
+
parentItem: {},
|
|
163
|
+
children: [],
|
|
164
|
+
axis: 'x'
|
|
165
|
+
}
|
|
166
|
+
var _default = exports.default = jsonDom
|
|
167
|
+
}, {}],
|
|
168
|
+
6: [function (require, module, exports) {
|
|
169
|
+
'use strict'
|
|
170
|
+
|
|
171
|
+
Object.defineProperty(exports, '__esModule', {
|
|
172
|
+
value: true
|
|
173
|
+
})
|
|
174
|
+
exports.linkedList = exports.default = void 0
|
|
175
|
+
/**
|
|
176
|
+
* Sample LinkedList for testing circular references.
|
|
177
|
+
* @memberOf module:test-fs
|
|
178
|
+
* @type {Object.<string, string|Object>}
|
|
179
|
+
*/
|
|
180
|
+
const linkedList = exports.linkedList = {
|
|
181
|
+
name: 'one',
|
|
182
|
+
prev: null,
|
|
183
|
+
next: null
|
|
184
|
+
}
|
|
185
|
+
linkedList.next = {
|
|
186
|
+
name: 'two',
|
|
187
|
+
prev: linkedList,
|
|
188
|
+
next: null
|
|
189
|
+
}
|
|
190
|
+
linkedList.next.next = {
|
|
191
|
+
name: 'three',
|
|
192
|
+
prev: linkedList.next,
|
|
193
|
+
next: null
|
|
194
|
+
}
|
|
195
|
+
var _default = exports.default = linkedList
|
|
196
|
+
}, {}],
|
|
197
|
+
7: [function (require, module, exports) {
|
|
198
|
+
'use strict'
|
|
199
|
+
|
|
200
|
+
Object.defineProperty(exports, '__esModule', {
|
|
201
|
+
value: true
|
|
202
|
+
})
|
|
203
|
+
exports.logObject = exports.default = void 0
|
|
204
|
+
/**
|
|
205
|
+
* Log out an object in a nicely formatted way.
|
|
206
|
+
* @function
|
|
207
|
+
* @memberOf module:test-fs
|
|
208
|
+
* @param {Object} object
|
|
209
|
+
* @param {string} [label=logging]
|
|
210
|
+
* @param {string} [outputType=log]
|
|
211
|
+
* @returns {string|undefined}
|
|
212
|
+
*/
|
|
213
|
+
const logObject = (object, label = 'logging', outputType = 'log') => {
|
|
214
|
+
const logger = outputType === 'string' ? (label, object) => `'${label}' | ` + JSON.stringify(object) : console[outputType]
|
|
215
|
+
if (typeof require === 'undefined' || outputType === 'string') {
|
|
216
|
+
return logger(label, object)
|
|
217
|
+
}
|
|
218
|
+
return logger(label, require('util').inspect(object, false, null, true))
|
|
219
|
+
}
|
|
220
|
+
exports.logObject = logObject
|
|
221
|
+
var _default = exports.default = logObject
|
|
222
|
+
}, { util: 38 }],
|
|
223
|
+
8: [function (require, module, exports) {
|
|
224
|
+
'use strict'
|
|
225
|
+
|
|
226
|
+
Object.defineProperty(exports, '__esModule', {
|
|
227
|
+
value: true
|
|
228
|
+
})
|
|
229
|
+
exports.multiReferenceObject = exports.default = void 0
|
|
230
|
+
/**
|
|
231
|
+
* Sample of an object containing multiple references.
|
|
232
|
+
* @memberOf module:test-fs
|
|
233
|
+
* @type {Object.<string, string|number|Object>}
|
|
234
|
+
*/
|
|
235
|
+
const multiReferenceObject = exports.multiReferenceObject = {
|
|
236
|
+
object1: {
|
|
237
|
+
name: 'someName'
|
|
238
|
+
},
|
|
239
|
+
object2: {
|
|
240
|
+
age: 12
|
|
241
|
+
},
|
|
242
|
+
array1: ['someString', 'anotherString'],
|
|
243
|
+
array2: [89, 32],
|
|
244
|
+
title: 'Some Title',
|
|
245
|
+
item: 45
|
|
246
|
+
}
|
|
247
|
+
var _default = exports.default = multiReferenceObject
|
|
248
|
+
}, {}],
|
|
249
|
+
9: [function (require, module, exports) {
|
|
250
|
+
'use strict'
|
|
251
|
+
|
|
252
|
+
Object.defineProperty(exports, '__esModule', {
|
|
253
|
+
value: true
|
|
254
|
+
})
|
|
255
|
+
exports.nodeTree = exports.default = void 0
|
|
256
|
+
/**
|
|
257
|
+
* Sample NodeTree for testing circular references and arrays.
|
|
258
|
+
* @memberOf module:test-fs
|
|
259
|
+
* @type {Object.<string, string|Object|Array>}
|
|
260
|
+
*/
|
|
261
|
+
const nodeTree = exports.nodeTree = {
|
|
262
|
+
name: 'one',
|
|
263
|
+
parent: null,
|
|
264
|
+
children: []
|
|
265
|
+
}
|
|
266
|
+
nodeTree.children[0] = {
|
|
267
|
+
name: 'child one',
|
|
268
|
+
parent: nodeTree,
|
|
269
|
+
children: []
|
|
270
|
+
}
|
|
271
|
+
nodeTree.children[1] = {
|
|
272
|
+
name: 'child two',
|
|
273
|
+
parent: nodeTree,
|
|
274
|
+
children: []
|
|
275
|
+
}
|
|
276
|
+
nodeTree.children[0].children[0] = {
|
|
277
|
+
name: 'grandchild one',
|
|
278
|
+
parent: nodeTree.children[0],
|
|
279
|
+
children: []
|
|
280
|
+
}
|
|
281
|
+
var _default = exports.default = nodeTree
|
|
282
|
+
}, {}],
|
|
283
|
+
10: [function (require, module, exports) {
|
|
284
|
+
'use strict'
|
|
285
|
+
|
|
286
|
+
Object.defineProperty(exports, '__esModule', {
|
|
287
|
+
value: true
|
|
288
|
+
})
|
|
289
|
+
exports.removeDirectory = exports.default = void 0
|
|
290
|
+
var _fs = require('fs')
|
|
291
|
+
/**
|
|
292
|
+
* Return a promise to be completed once the specified directory is deleted.
|
|
293
|
+
* @function
|
|
294
|
+
* @memberOf module:test-fs
|
|
295
|
+
* @param {string} dirPath
|
|
296
|
+
* @returns {Promise<*>}
|
|
297
|
+
*/
|
|
298
|
+
const removeDirectory = dirPath => new Promise((resolve, reject) => (0, _fs.access)(dirPath, _fs.constants.F_OK, removed => removed ? resolve(dirPath) : (0, _fs.rm)(dirPath, {
|
|
299
|
+
recursive: true
|
|
300
|
+
}, error => error ? reject(error) : resolve(dirPath))))
|
|
301
|
+
exports.removeDirectory = removeDirectory
|
|
302
|
+
var _default = exports.default = removeDirectory
|
|
303
|
+
}, { fs: 14 }],
|
|
304
|
+
11: [function (require, module, exports) {
|
|
305
|
+
'use strict'
|
|
306
|
+
|
|
307
|
+
Object.defineProperty(exports, '__esModule', {
|
|
308
|
+
value: true
|
|
309
|
+
})
|
|
310
|
+
exports.setUp = exports.setDefaults = exports.default = exports.createTempDir = exports.beforeEach = exports.afterEach = void 0
|
|
311
|
+
var _fs = require('fs')
|
|
312
|
+
var _removeDirectory = _interopRequireDefault(require('./removeDirectory'))
|
|
313
|
+
function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
|
|
314
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
315
|
+
function adopt (value) {
|
|
316
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
317
|
+
resolve(value)
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
321
|
+
function fulfilled (value) {
|
|
322
|
+
try {
|
|
323
|
+
step(generator.next(value))
|
|
324
|
+
} catch (e) {
|
|
325
|
+
reject(e)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function rejected (value) {
|
|
329
|
+
try {
|
|
330
|
+
step(generator.throw(value))
|
|
331
|
+
} catch (e) {
|
|
332
|
+
reject(e)
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function step (result) {
|
|
336
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected)
|
|
337
|
+
}
|
|
338
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next())
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Import the configurations and override some of them to direct to the temp directory.
|
|
343
|
+
|
|
344
|
+
let tempDir = 'test-temp/'
|
|
345
|
+
let srcPath = `${tempDir}src`
|
|
346
|
+
/**
|
|
347
|
+
* In the Jest.afterEach function call this one to clean up and remove the temp directory.
|
|
348
|
+
* @function
|
|
349
|
+
* @memberOf module:test-fs
|
|
350
|
+
* @returns {Promise<*>}
|
|
351
|
+
*/
|
|
352
|
+
const afterEach = () => (0, _removeDirectory.default)(tempDir)
|
|
353
|
+
/**
|
|
354
|
+
* Ensure that the del has completed, recursively attempt to delete and recreate
|
|
355
|
+
* @function
|
|
356
|
+
* @memberOf module:test-fs
|
|
357
|
+
* @param {boolean} [exists=true]
|
|
358
|
+
* @returns {Promise<*|void>}
|
|
359
|
+
*/
|
|
360
|
+
exports.afterEach = afterEach
|
|
361
|
+
const createTempDir = (exists = true) => __awaiter(void 0, void 0, void 0, function * () {
|
|
362
|
+
if (exists) {
|
|
363
|
+
return (0, _removeDirectory.default)(tempDir).then(removedDir => createTempDir((0, _fs.existsSync)(removedDir))).catch(error => console.error('Error: ', error))
|
|
364
|
+
}
|
|
365
|
+
return (0, _fs.mkdirSync)(srcPath, {
|
|
366
|
+
recursive: true
|
|
367
|
+
})
|
|
368
|
+
})
|
|
369
|
+
/**
|
|
370
|
+
* In the Jest.beforeEach function call this one to set up the temp directory.
|
|
371
|
+
* @function
|
|
372
|
+
* @memberOf module:test-fs
|
|
373
|
+
* @returns {Promise<*|void>}
|
|
374
|
+
*/
|
|
375
|
+
exports.createTempDir = createTempDir
|
|
376
|
+
const beforeEach = () => createTempDir()
|
|
377
|
+
exports.beforeEach = beforeEach
|
|
378
|
+
const setDefaults = (dirPath = null) => {
|
|
379
|
+
if (dirPath) {
|
|
380
|
+
tempDir = dirPath
|
|
381
|
+
srcPath = `${tempDir}src`
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
exports.setDefaults = setDefaults
|
|
385
|
+
const setUp = exports.setUp = {
|
|
386
|
+
afterEach,
|
|
387
|
+
beforeEach,
|
|
388
|
+
createTempDir,
|
|
389
|
+
setDefaults
|
|
390
|
+
}
|
|
391
|
+
var _default = exports.default = setUp
|
|
392
|
+
}, { './removeDirectory': 10, fs: 14 }],
|
|
393
|
+
12: [function (require, module, exports) {
|
|
394
|
+
'use strict'
|
|
395
|
+
|
|
396
|
+
Object.defineProperty(exports, '__esModule', {
|
|
397
|
+
value: true
|
|
398
|
+
})
|
|
399
|
+
exports.testFsBrowser = exports.testFs = exports.default = void 0
|
|
400
|
+
var _circularObject = _interopRequireDefault(require('./functions/circularObject'))
|
|
401
|
+
var _countMatches = _interopRequireDefault(require('./functions/countMatches'))
|
|
402
|
+
var _deepReferenceObject = _interopRequireDefault(require('./functions/deepReferenceObject'))
|
|
403
|
+
var _domItem = _interopRequireDefault(require('./functions/domItem'))
|
|
404
|
+
var _jsonDom = _interopRequireDefault(require('./functions/jsonDom'))
|
|
405
|
+
var _linkedList = _interopRequireDefault(require('./functions/linkedList'))
|
|
406
|
+
var _logObject = _interopRequireDefault(require('./functions/logObject'))
|
|
407
|
+
var _multiReferenceObject = _interopRequireDefault(require('./functions/multiReferenceObject'))
|
|
408
|
+
var _nodeTree = _interopRequireDefault(require('./functions/nodeTree'))
|
|
409
|
+
var _removeDirectory = _interopRequireDefault(require('./functions/removeDirectory'))
|
|
410
|
+
var _setUp = _interopRequireDefault(require('./functions/setUp'))
|
|
411
|
+
function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
|
|
412
|
+
/**
|
|
413
|
+
* An assortment of objects that can be used in tests and some functions to help debug and write tests.
|
|
414
|
+
* @file
|
|
415
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
416
|
+
* @version 1.0.0
|
|
417
|
+
* @module test-fs
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
const testFs = exports.testFs = {
|
|
421
|
+
circularObject: _circularObject.default,
|
|
422
|
+
countMatches: _countMatches.default,
|
|
423
|
+
deepReferenceObject: _deepReferenceObject.default,
|
|
424
|
+
domItem: _domItem.default,
|
|
425
|
+
jsonDom: _jsonDom.default,
|
|
426
|
+
linkedList: _linkedList.default,
|
|
427
|
+
logObject: _logObject.default,
|
|
428
|
+
multiReferenceObject: _multiReferenceObject.default,
|
|
429
|
+
nodeTree: _nodeTree.default,
|
|
430
|
+
removeDirectory: _removeDirectory.default,
|
|
431
|
+
setUp: _setUp.default
|
|
432
|
+
}
|
|
433
|
+
var _default = exports.default = testFs
|
|
434
|
+
const testFsBrowser = exports.testFsBrowser = {
|
|
435
|
+
circularObject: _circularObject.default,
|
|
436
|
+
countMatches: _countMatches.default,
|
|
437
|
+
deepReferenceObject: _deepReferenceObject.default,
|
|
438
|
+
domItem: _domItem.default,
|
|
439
|
+
jsonDom: _jsonDom.default,
|
|
440
|
+
linkedList: _linkedList.default,
|
|
441
|
+
logObject: _logObject.default,
|
|
442
|
+
multiReferenceObject: _multiReferenceObject.default,
|
|
443
|
+
nodeTree: _nodeTree.default
|
|
444
|
+
}
|
|
445
|
+
if (void 0) {
|
|
446
|
+
// @ts-ignore
|
|
447
|
+
(void 0).testFs = testFsBrowser
|
|
448
|
+
} else if (typeof window !== 'undefined') {
|
|
449
|
+
// @ts-ignore
|
|
450
|
+
window.testFs = testFsBrowser
|
|
451
|
+
}
|
|
452
|
+
}, { './functions/circularObject': 1, './functions/countMatches': 2, './functions/deepReferenceObject': 3, './functions/domItem': 4, './functions/jsonDom': 5, './functions/linkedList': 6, './functions/logObject': 7, './functions/multiReferenceObject': 8, './functions/nodeTree': 9, './functions/removeDirectory': 10, './functions/setUp': 11 }],
|
|
453
|
+
13: [function (require, module, exports) {
|
|
454
|
+
(function (global) {
|
|
455
|
+
(function () {
|
|
456
|
+
'use strict'
|
|
457
|
+
|
|
458
|
+
var possibleNames = [
|
|
459
|
+
'BigInt64Array',
|
|
460
|
+
'BigUint64Array',
|
|
461
|
+
'Float32Array',
|
|
462
|
+
'Float64Array',
|
|
463
|
+
'Int16Array',
|
|
464
|
+
'Int32Array',
|
|
465
|
+
'Int8Array',
|
|
466
|
+
'Uint16Array',
|
|
467
|
+
'Uint32Array',
|
|
468
|
+
'Uint8Array',
|
|
469
|
+
'Uint8ClampedArray'
|
|
470
|
+
]
|
|
471
|
+
|
|
472
|
+
var g = typeof globalThis === 'undefined' ? global : globalThis
|
|
473
|
+
|
|
474
|
+
module.exports = function availableTypedArrays () {
|
|
475
|
+
var out = []
|
|
476
|
+
for (var i = 0; i < possibleNames.length; i++) {
|
|
477
|
+
if (typeof g[possibleNames[i]] === 'function') {
|
|
478
|
+
out[out.length] = possibleNames[i]
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return out
|
|
482
|
+
}
|
|
483
|
+
}).call(this)
|
|
484
|
+
}).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {})
|
|
485
|
+
}, {}],
|
|
486
|
+
14: [function (require, module, exports) {
|
|
487
|
+
|
|
488
|
+
}, {}],
|
|
489
|
+
15: [function (require, module, exports) {
|
|
490
|
+
'use strict'
|
|
491
|
+
|
|
492
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
493
|
+
|
|
494
|
+
var callBind = require('./')
|
|
495
|
+
|
|
496
|
+
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'))
|
|
497
|
+
|
|
498
|
+
module.exports = function callBoundIntrinsic (name, allowMissing) {
|
|
499
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing)
|
|
500
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
501
|
+
return callBind(intrinsic)
|
|
502
|
+
}
|
|
503
|
+
return intrinsic
|
|
504
|
+
}
|
|
505
|
+
}, { './': 16, 'get-intrinsic': 21 }],
|
|
506
|
+
16: [function (require, module, exports) {
|
|
507
|
+
'use strict'
|
|
508
|
+
|
|
509
|
+
var bind = require('function-bind')
|
|
510
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
511
|
+
var setFunctionLength = require('set-function-length')
|
|
512
|
+
|
|
513
|
+
var $TypeError = GetIntrinsic('%TypeError%')
|
|
514
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%')
|
|
515
|
+
var $call = GetIntrinsic('%Function.prototype.call%')
|
|
516
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply)
|
|
517
|
+
|
|
518
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true)
|
|
519
|
+
var $max = GetIntrinsic('%Math.max%')
|
|
520
|
+
|
|
521
|
+
if ($defineProperty) {
|
|
522
|
+
try {
|
|
523
|
+
$defineProperty({}, 'a', { value: 1 })
|
|
524
|
+
} catch (e) {
|
|
525
|
+
// IE 8 has a broken defineProperty
|
|
526
|
+
$defineProperty = null
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
module.exports = function callBind (originalFunction) {
|
|
531
|
+
if (typeof originalFunction !== 'function') {
|
|
532
|
+
throw new $TypeError('a function is required')
|
|
533
|
+
}
|
|
534
|
+
var func = $reflectApply(bind, $call, arguments)
|
|
535
|
+
return setFunctionLength(
|
|
536
|
+
func,
|
|
537
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
538
|
+
true
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
var applyBind = function applyBind () {
|
|
543
|
+
return $reflectApply(bind, $apply, arguments)
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if ($defineProperty) {
|
|
547
|
+
$defineProperty(module.exports, 'apply', { value: applyBind })
|
|
548
|
+
} else {
|
|
549
|
+
module.exports.apply = applyBind
|
|
550
|
+
}
|
|
551
|
+
}, { 'function-bind': 20, 'get-intrinsic': 21, 'set-function-length': 35 }],
|
|
552
|
+
17: [function (require, module, exports) {
|
|
553
|
+
'use strict'
|
|
554
|
+
|
|
555
|
+
var hasPropertyDescriptors = require('has-property-descriptors')()
|
|
556
|
+
|
|
557
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
558
|
+
|
|
559
|
+
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true)
|
|
560
|
+
if ($defineProperty) {
|
|
561
|
+
try {
|
|
562
|
+
$defineProperty({}, 'a', { value: 1 })
|
|
563
|
+
} catch (e) {
|
|
564
|
+
// IE 8 has a broken defineProperty
|
|
565
|
+
$defineProperty = false
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
var $SyntaxError = GetIntrinsic('%SyntaxError%')
|
|
570
|
+
var $TypeError = GetIntrinsic('%TypeError%')
|
|
571
|
+
|
|
572
|
+
var gopd = require('gopd')
|
|
573
|
+
|
|
574
|
+
/** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
|
|
575
|
+
module.exports = function defineDataProperty (
|
|
576
|
+
obj,
|
|
577
|
+
property,
|
|
578
|
+
value
|
|
579
|
+
) {
|
|
580
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
581
|
+
throw new $TypeError('`obj` must be an object or a function`')
|
|
582
|
+
}
|
|
583
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
|
584
|
+
throw new $TypeError('`property` must be a string or a symbol`')
|
|
585
|
+
}
|
|
586
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
|
587
|
+
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null')
|
|
588
|
+
}
|
|
589
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
|
590
|
+
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null')
|
|
591
|
+
}
|
|
592
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
|
593
|
+
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null')
|
|
594
|
+
}
|
|
595
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
|
596
|
+
throw new $TypeError('`loose`, if provided, must be a boolean')
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null
|
|
600
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null
|
|
601
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null
|
|
602
|
+
var loose = arguments.length > 6 ? arguments[6] : false
|
|
603
|
+
|
|
604
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
|
605
|
+
var desc = !!gopd && gopd(obj, property)
|
|
606
|
+
|
|
607
|
+
if ($defineProperty) {
|
|
608
|
+
$defineProperty(obj, property, {
|
|
609
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
610
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
611
|
+
value: value,
|
|
612
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
613
|
+
})
|
|
614
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
|
615
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
|
616
|
+
obj[property] = value // eslint-disable-line no-param-reassign
|
|
617
|
+
} else {
|
|
618
|
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.')
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}, { 'get-intrinsic': 21, gopd: 22, 'has-property-descriptors': 23 }],
|
|
622
|
+
18: [function (require, module, exports) {
|
|
623
|
+
'use strict'
|
|
624
|
+
|
|
625
|
+
var isCallable = require('is-callable')
|
|
626
|
+
|
|
627
|
+
var toStr = Object.prototype.toString
|
|
628
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty
|
|
629
|
+
|
|
630
|
+
var forEachArray = function forEachArray (array, iterator, receiver) {
|
|
631
|
+
for (var i = 0, len = array.length; i < len; i++) {
|
|
632
|
+
if (hasOwnProperty.call(array, i)) {
|
|
633
|
+
if (receiver == null) {
|
|
634
|
+
iterator(array[i], i, array)
|
|
635
|
+
} else {
|
|
636
|
+
iterator.call(receiver, array[i], i, array)
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
var forEachString = function forEachString (string, iterator, receiver) {
|
|
643
|
+
for (var i = 0, len = string.length; i < len; i++) {
|
|
644
|
+
// no such thing as a sparse string.
|
|
645
|
+
if (receiver == null) {
|
|
646
|
+
iterator(string.charAt(i), i, string)
|
|
647
|
+
} else {
|
|
648
|
+
iterator.call(receiver, string.charAt(i), i, string)
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
var forEachObject = function forEachObject (object, iterator, receiver) {
|
|
654
|
+
for (var k in object) {
|
|
655
|
+
if (hasOwnProperty.call(object, k)) {
|
|
656
|
+
if (receiver == null) {
|
|
657
|
+
iterator(object[k], k, object)
|
|
658
|
+
} else {
|
|
659
|
+
iterator.call(receiver, object[k], k, object)
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
var forEach = function forEach (list, iterator, thisArg) {
|
|
666
|
+
if (!isCallable(iterator)) {
|
|
667
|
+
throw new TypeError('iterator must be a function')
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
var receiver
|
|
671
|
+
if (arguments.length >= 3) {
|
|
672
|
+
receiver = thisArg
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (toStr.call(list) === '[object Array]') {
|
|
676
|
+
forEachArray(list, iterator, receiver)
|
|
677
|
+
} else if (typeof list === 'string') {
|
|
678
|
+
forEachString(list, iterator, receiver)
|
|
679
|
+
} else {
|
|
680
|
+
forEachObject(list, iterator, receiver)
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
module.exports = forEach
|
|
685
|
+
}, { 'is-callable': 31 }],
|
|
686
|
+
19: [function (require, module, exports) {
|
|
687
|
+
'use strict'
|
|
688
|
+
|
|
689
|
+
/* eslint no-invalid-this: 1 */
|
|
690
|
+
|
|
691
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '
|
|
692
|
+
var toStr = Object.prototype.toString
|
|
693
|
+
var max = Math.max
|
|
694
|
+
var funcType = '[object Function]'
|
|
695
|
+
|
|
696
|
+
var concatty = function concatty (a, b) {
|
|
697
|
+
var arr = []
|
|
698
|
+
|
|
699
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
700
|
+
arr[i] = a[i]
|
|
701
|
+
}
|
|
702
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
703
|
+
arr[j + a.length] = b[j]
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
return arr
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
var slicy = function slicy (arrLike, offset) {
|
|
710
|
+
var arr = []
|
|
711
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
712
|
+
arr[j] = arrLike[i]
|
|
713
|
+
}
|
|
714
|
+
return arr
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
var joiny = function (arr, joiner) {
|
|
718
|
+
var str = ''
|
|
719
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
720
|
+
str += arr[i]
|
|
721
|
+
if (i + 1 < arr.length) {
|
|
722
|
+
str += joiner
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return str
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
module.exports = function bind (that) {
|
|
729
|
+
var target = this
|
|
730
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
731
|
+
throw new TypeError(ERROR_MESSAGE + target)
|
|
732
|
+
}
|
|
733
|
+
var args = slicy(arguments, 1)
|
|
734
|
+
|
|
735
|
+
var bound
|
|
736
|
+
var binder = function () {
|
|
737
|
+
if (this instanceof bound) {
|
|
738
|
+
var result = target.apply(
|
|
739
|
+
this,
|
|
740
|
+
concatty(args, arguments)
|
|
741
|
+
)
|
|
742
|
+
if (Object(result) === result) {
|
|
743
|
+
return result
|
|
744
|
+
}
|
|
745
|
+
return this
|
|
746
|
+
}
|
|
747
|
+
return target.apply(
|
|
748
|
+
that,
|
|
749
|
+
concatty(args, arguments)
|
|
750
|
+
)
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
var boundLength = max(0, target.length - args.length)
|
|
754
|
+
var boundArgs = []
|
|
755
|
+
for (var i = 0; i < boundLength; i++) {
|
|
756
|
+
boundArgs[i] = '$' + i
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder)
|
|
760
|
+
|
|
761
|
+
if (target.prototype) {
|
|
762
|
+
var Empty = function Empty () {}
|
|
763
|
+
Empty.prototype = target.prototype
|
|
764
|
+
bound.prototype = new Empty()
|
|
765
|
+
Empty.prototype = null
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return bound
|
|
769
|
+
}
|
|
770
|
+
}, {}],
|
|
771
|
+
20: [function (require, module, exports) {
|
|
772
|
+
'use strict'
|
|
773
|
+
|
|
774
|
+
var implementation = require('./implementation')
|
|
775
|
+
|
|
776
|
+
module.exports = Function.prototype.bind || implementation
|
|
777
|
+
}, { './implementation': 19 }],
|
|
778
|
+
21: [function (require, module, exports) {
|
|
779
|
+
'use strict'
|
|
780
|
+
|
|
781
|
+
var undefined
|
|
782
|
+
|
|
783
|
+
var $SyntaxError = SyntaxError
|
|
784
|
+
var $Function = Function
|
|
785
|
+
var $TypeError = TypeError
|
|
786
|
+
|
|
787
|
+
// eslint-disable-next-line consistent-return
|
|
788
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
789
|
+
try {
|
|
790
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')()
|
|
791
|
+
} catch (e) {}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
var $gOPD = Object.getOwnPropertyDescriptor
|
|
795
|
+
if ($gOPD) {
|
|
796
|
+
try {
|
|
797
|
+
$gOPD({}, '')
|
|
798
|
+
} catch (e) {
|
|
799
|
+
$gOPD = null // this is IE 8, which has a broken gOPD
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
var throwTypeError = function () {
|
|
804
|
+
throw new $TypeError()
|
|
805
|
+
}
|
|
806
|
+
var ThrowTypeError = $gOPD
|
|
807
|
+
? (function () {
|
|
808
|
+
try {
|
|
809
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
810
|
+
arguments.callee // IE 8 does not throw here
|
|
811
|
+
return throwTypeError
|
|
812
|
+
} catch (calleeThrows) {
|
|
813
|
+
try {
|
|
814
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
815
|
+
return $gOPD(arguments, 'callee').get
|
|
816
|
+
} catch (gOPDthrows) {
|
|
817
|
+
return throwTypeError
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}())
|
|
821
|
+
: throwTypeError
|
|
822
|
+
|
|
823
|
+
var hasSymbols = require('has-symbols')()
|
|
824
|
+
var hasProto = require('has-proto')()
|
|
825
|
+
|
|
826
|
+
var getProto = Object.getPrototypeOf || (
|
|
827
|
+
hasProto
|
|
828
|
+
? function (x) { return x.__proto__ } // eslint-disable-line no-proto
|
|
829
|
+
: null
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
var needsEval = {}
|
|
833
|
+
|
|
834
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array)
|
|
835
|
+
|
|
836
|
+
var INTRINSICS = {
|
|
837
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
|
838
|
+
'%Array%': Array,
|
|
839
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
|
840
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
|
841
|
+
'%AsyncFromSyncIteratorPrototype%': undefined,
|
|
842
|
+
'%AsyncFunction%': needsEval,
|
|
843
|
+
'%AsyncGenerator%': needsEval,
|
|
844
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
845
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
846
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
|
847
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
|
848
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
|
849
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
|
850
|
+
'%Boolean%': Boolean,
|
|
851
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
|
852
|
+
'%Date%': Date,
|
|
853
|
+
'%decodeURI%': decodeURI,
|
|
854
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
855
|
+
'%encodeURI%': encodeURI,
|
|
856
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
857
|
+
'%Error%': Error,
|
|
858
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
859
|
+
'%EvalError%': EvalError,
|
|
860
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
|
861
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
|
862
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
|
863
|
+
'%Function%': $Function,
|
|
864
|
+
'%GeneratorFunction%': needsEval,
|
|
865
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
|
866
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
|
867
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
|
868
|
+
'%isFinite%': isFinite,
|
|
869
|
+
'%isNaN%': isNaN,
|
|
870
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
871
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
|
872
|
+
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
|
873
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
874
|
+
'%Math%': Math,
|
|
875
|
+
'%Number%': Number,
|
|
876
|
+
'%Object%': Object,
|
|
877
|
+
'%parseFloat%': parseFloat,
|
|
878
|
+
'%parseInt%': parseInt,
|
|
879
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
|
880
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
|
881
|
+
'%RangeError%': RangeError,
|
|
882
|
+
'%ReferenceError%': ReferenceError,
|
|
883
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
|
884
|
+
'%RegExp%': RegExp,
|
|
885
|
+
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
|
886
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
887
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
|
888
|
+
'%String%': String,
|
|
889
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
|
|
890
|
+
'%Symbol%': hasSymbols ? Symbol : undefined,
|
|
891
|
+
'%SyntaxError%': $SyntaxError,
|
|
892
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
893
|
+
'%TypedArray%': TypedArray,
|
|
894
|
+
'%TypeError%': $TypeError,
|
|
895
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
|
896
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
|
897
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
|
898
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
|
899
|
+
'%URIError%': URIError,
|
|
900
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
|
901
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
902
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if (getProto) {
|
|
906
|
+
try {
|
|
907
|
+
null.error // eslint-disable-line no-unused-expressions
|
|
908
|
+
} catch (e) {
|
|
909
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
910
|
+
var errorProto = getProto(getProto(e))
|
|
911
|
+
INTRINSICS['%Error.prototype%'] = errorProto
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
var doEval = function doEval (name) {
|
|
916
|
+
var value
|
|
917
|
+
if (name === '%AsyncFunction%') {
|
|
918
|
+
value = getEvalledConstructor('async function () {}')
|
|
919
|
+
} else if (name === '%GeneratorFunction%') {
|
|
920
|
+
value = getEvalledConstructor('function* () {}')
|
|
921
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
922
|
+
value = getEvalledConstructor('async function* () {}')
|
|
923
|
+
} else if (name === '%AsyncGenerator%') {
|
|
924
|
+
var fn = doEval('%AsyncGeneratorFunction%')
|
|
925
|
+
if (fn) {
|
|
926
|
+
value = fn.prototype
|
|
927
|
+
}
|
|
928
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
929
|
+
var gen = doEval('%AsyncGenerator%')
|
|
930
|
+
if (gen && getProto) {
|
|
931
|
+
value = getProto(gen.prototype)
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
INTRINSICS[name] = value
|
|
936
|
+
|
|
937
|
+
return value
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
var LEGACY_ALIASES = {
|
|
941
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
942
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
943
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
944
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
945
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
946
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
947
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
948
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
949
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
950
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
951
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
952
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
953
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
954
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
955
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
956
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
957
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
958
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
959
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
960
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
961
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
962
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
963
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
964
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
965
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
966
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
967
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
968
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
969
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
970
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
971
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
972
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
973
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
974
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
975
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
976
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
977
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
978
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
979
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
980
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
981
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
982
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
983
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
984
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
985
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
986
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
987
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
988
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
989
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
990
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
991
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
var bind = require('function-bind')
|
|
995
|
+
var hasOwn = require('hasown')
|
|
996
|
+
var $concat = bind.call(Function.call, Array.prototype.concat)
|
|
997
|
+
var $spliceApply = bind.call(Function.apply, Array.prototype.splice)
|
|
998
|
+
var $replace = bind.call(Function.call, String.prototype.replace)
|
|
999
|
+
var $strSlice = bind.call(Function.call, String.prototype.slice)
|
|
1000
|
+
var $exec = bind.call(Function.call, RegExp.prototype.exec)
|
|
1001
|
+
|
|
1002
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1003
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g
|
|
1004
|
+
var reEscapeChar = /\\(\\)?/g /** Used to match backslashes in property paths. */
|
|
1005
|
+
var stringToPath = function stringToPath (string) {
|
|
1006
|
+
var first = $strSlice(string, 0, 1)
|
|
1007
|
+
var last = $strSlice(string, -1)
|
|
1008
|
+
if (first === '%' && last !== '%') {
|
|
1009
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`')
|
|
1010
|
+
} else if (last === '%' && first !== '%') {
|
|
1011
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`')
|
|
1012
|
+
}
|
|
1013
|
+
var result = []
|
|
1014
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
1015
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match
|
|
1016
|
+
})
|
|
1017
|
+
return result
|
|
1018
|
+
}
|
|
1019
|
+
/* end adaptation */
|
|
1020
|
+
|
|
1021
|
+
var getBaseIntrinsic = function getBaseIntrinsic (name, allowMissing) {
|
|
1022
|
+
var intrinsicName = name
|
|
1023
|
+
var alias
|
|
1024
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
1025
|
+
alias = LEGACY_ALIASES[intrinsicName]
|
|
1026
|
+
intrinsicName = '%' + alias[0] + '%'
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
1030
|
+
var value = INTRINSICS[intrinsicName]
|
|
1031
|
+
if (value === needsEval) {
|
|
1032
|
+
value = doEval(intrinsicName)
|
|
1033
|
+
}
|
|
1034
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
1035
|
+
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!')
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
return {
|
|
1039
|
+
alias: alias,
|
|
1040
|
+
name: intrinsicName,
|
|
1041
|
+
value: value
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
throw new $SyntaxError('intrinsic ' + name + ' does not exist!')
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
module.exports = function GetIntrinsic (name, allowMissing) {
|
|
1049
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
1050
|
+
throw new $TypeError('intrinsic name must be a non-empty string')
|
|
1051
|
+
}
|
|
1052
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1053
|
+
throw new $TypeError('"allowMissing" argument must be a boolean')
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
1057
|
+
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name')
|
|
1058
|
+
}
|
|
1059
|
+
var parts = stringToPath(name)
|
|
1060
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : ''
|
|
1061
|
+
|
|
1062
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing)
|
|
1063
|
+
var intrinsicRealName = intrinsic.name
|
|
1064
|
+
var value = intrinsic.value
|
|
1065
|
+
var skipFurtherCaching = false
|
|
1066
|
+
|
|
1067
|
+
var alias = intrinsic.alias
|
|
1068
|
+
if (alias) {
|
|
1069
|
+
intrinsicBaseName = alias[0]
|
|
1070
|
+
$spliceApply(parts, $concat([0, 1], alias))
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1074
|
+
var part = parts[i]
|
|
1075
|
+
var first = $strSlice(part, 0, 1)
|
|
1076
|
+
var last = $strSlice(part, -1)
|
|
1077
|
+
if (
|
|
1078
|
+
(
|
|
1079
|
+
(first === '"' || first === "'" || first === '`') ||
|
|
1080
|
+
(last === '"' || last === "'" || last === '`')
|
|
1081
|
+
) &&
|
|
1082
|
+
first !== last
|
|
1083
|
+
) {
|
|
1084
|
+
throw new $SyntaxError('property names with quotes must have matching quotes')
|
|
1085
|
+
}
|
|
1086
|
+
if (part === 'constructor' || !isOwn) {
|
|
1087
|
+
skipFurtherCaching = true
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
intrinsicBaseName += '.' + part
|
|
1091
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%'
|
|
1092
|
+
|
|
1093
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
|
1094
|
+
value = INTRINSICS[intrinsicRealName]
|
|
1095
|
+
} else if (value != null) {
|
|
1096
|
+
if (!(part in value)) {
|
|
1097
|
+
if (!allowMissing) {
|
|
1098
|
+
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.')
|
|
1099
|
+
}
|
|
1100
|
+
return void undefined
|
|
1101
|
+
}
|
|
1102
|
+
if ($gOPD && (i + 1) >= parts.length) {
|
|
1103
|
+
var desc = $gOPD(value, part)
|
|
1104
|
+
isOwn = !!desc
|
|
1105
|
+
|
|
1106
|
+
// By convention, when a data property is converted to an accessor
|
|
1107
|
+
// property to emulate a data property that does not suffer from
|
|
1108
|
+
// the override mistake, that accessor's getter is marked with
|
|
1109
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
1110
|
+
// uphold the illusion by pretending to see that original data
|
|
1111
|
+
// property, i.e., returning the value rather than the getter
|
|
1112
|
+
// itself.
|
|
1113
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1114
|
+
value = desc.get
|
|
1115
|
+
} else {
|
|
1116
|
+
value = value[part]
|
|
1117
|
+
}
|
|
1118
|
+
} else {
|
|
1119
|
+
isOwn = hasOwn(value, part)
|
|
1120
|
+
value = value[part]
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
if (isOwn && !skipFurtherCaching) {
|
|
1124
|
+
INTRINSICS[intrinsicRealName] = value
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return value
|
|
1129
|
+
}
|
|
1130
|
+
}, { 'function-bind': 20, 'has-proto': 24, 'has-symbols': 25, hasown: 28 }],
|
|
1131
|
+
22: [function (require, module, exports) {
|
|
1132
|
+
'use strict'
|
|
1133
|
+
|
|
1134
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
1135
|
+
|
|
1136
|
+
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true)
|
|
1137
|
+
|
|
1138
|
+
if ($gOPD) {
|
|
1139
|
+
try {
|
|
1140
|
+
$gOPD([], 'length')
|
|
1141
|
+
} catch (e) {
|
|
1142
|
+
// IE 8 has a broken gOPD
|
|
1143
|
+
$gOPD = null
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
module.exports = $gOPD
|
|
1148
|
+
}, { 'get-intrinsic': 21 }],
|
|
1149
|
+
23: [function (require, module, exports) {
|
|
1150
|
+
'use strict'
|
|
1151
|
+
|
|
1152
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
1153
|
+
|
|
1154
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true)
|
|
1155
|
+
|
|
1156
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors () {
|
|
1157
|
+
if ($defineProperty) {
|
|
1158
|
+
try {
|
|
1159
|
+
$defineProperty({}, 'a', { value: 1 })
|
|
1160
|
+
return true
|
|
1161
|
+
} catch (e) {
|
|
1162
|
+
// IE 8 has a broken defineProperty
|
|
1163
|
+
return false
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return false
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug () {
|
|
1170
|
+
// node v0.6 has a bug where array lengths can be Set but not Defined
|
|
1171
|
+
if (!hasPropertyDescriptors()) {
|
|
1172
|
+
return null
|
|
1173
|
+
}
|
|
1174
|
+
try {
|
|
1175
|
+
return $defineProperty([], 'length', { value: 1 }).length !== 1
|
|
1176
|
+
} catch (e) {
|
|
1177
|
+
// In Firefox 4-22, defining length on an array throws an exception.
|
|
1178
|
+
return true
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
module.exports = hasPropertyDescriptors
|
|
1183
|
+
}, { 'get-intrinsic': 21 }],
|
|
1184
|
+
24: [function (require, module, exports) {
|
|
1185
|
+
'use strict'
|
|
1186
|
+
|
|
1187
|
+
var test = {
|
|
1188
|
+
foo: {}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
var $Object = Object
|
|
1192
|
+
|
|
1193
|
+
module.exports = function hasProto () {
|
|
1194
|
+
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object)
|
|
1195
|
+
}
|
|
1196
|
+
}, {}],
|
|
1197
|
+
25: [function (require, module, exports) {
|
|
1198
|
+
'use strict'
|
|
1199
|
+
|
|
1200
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol
|
|
1201
|
+
var hasSymbolSham = require('./shams')
|
|
1202
|
+
|
|
1203
|
+
module.exports = function hasNativeSymbols () {
|
|
1204
|
+
if (typeof origSymbol !== 'function') { return false }
|
|
1205
|
+
if (typeof Symbol !== 'function') { return false }
|
|
1206
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false }
|
|
1207
|
+
if (typeof Symbol('bar') !== 'symbol') { return false }
|
|
1208
|
+
|
|
1209
|
+
return hasSymbolSham()
|
|
1210
|
+
}
|
|
1211
|
+
}, { './shams': 26 }],
|
|
1212
|
+
26: [function (require, module, exports) {
|
|
1213
|
+
'use strict'
|
|
1214
|
+
|
|
1215
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
1216
|
+
module.exports = function hasSymbols () {
|
|
1217
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false }
|
|
1218
|
+
if (typeof Symbol.iterator === 'symbol') { return true }
|
|
1219
|
+
|
|
1220
|
+
var obj = {}
|
|
1221
|
+
var sym = Symbol('test')
|
|
1222
|
+
var symObj = Object(sym)
|
|
1223
|
+
if (typeof sym === 'string') { return false }
|
|
1224
|
+
|
|
1225
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false }
|
|
1226
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false }
|
|
1227
|
+
|
|
1228
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
1229
|
+
// if (sym instanceof Symbol) { return false; }
|
|
1230
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
1231
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
1232
|
+
|
|
1233
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
1234
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
1235
|
+
|
|
1236
|
+
var symVal = 42
|
|
1237
|
+
obj[sym] = symVal
|
|
1238
|
+
for (sym in obj) { return false } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
1239
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false }
|
|
1240
|
+
|
|
1241
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false }
|
|
1242
|
+
|
|
1243
|
+
var syms = Object.getOwnPropertySymbols(obj)
|
|
1244
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false }
|
|
1245
|
+
|
|
1246
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false }
|
|
1247
|
+
|
|
1248
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
1249
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym)
|
|
1250
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false }
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
return true
|
|
1254
|
+
}
|
|
1255
|
+
}, {}],
|
|
1256
|
+
27: [function (require, module, exports) {
|
|
1257
|
+
'use strict'
|
|
1258
|
+
|
|
1259
|
+
var hasSymbols = require('has-symbols/shams')
|
|
1260
|
+
|
|
1261
|
+
module.exports = function hasToStringTagShams () {
|
|
1262
|
+
return hasSymbols() && !!Symbol.toStringTag
|
|
1263
|
+
}
|
|
1264
|
+
}, { 'has-symbols/shams': 26 }],
|
|
1265
|
+
28: [function (require, module, exports) {
|
|
1266
|
+
'use strict'
|
|
1267
|
+
|
|
1268
|
+
var call = Function.prototype.call
|
|
1269
|
+
var $hasOwn = Object.prototype.hasOwnProperty
|
|
1270
|
+
var bind = require('function-bind')
|
|
1271
|
+
|
|
1272
|
+
/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
|
|
1273
|
+
module.exports = bind.call(call, $hasOwn)
|
|
1274
|
+
}, { 'function-bind': 20 }],
|
|
1275
|
+
29: [function (require, module, exports) {
|
|
1276
|
+
if (typeof Object.create === 'function') {
|
|
1277
|
+
// implementation from standard node.js 'util' module
|
|
1278
|
+
module.exports = function inherits (ctor, superCtor) {
|
|
1279
|
+
if (superCtor) {
|
|
1280
|
+
ctor.super_ = superCtor
|
|
1281
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
1282
|
+
constructor: {
|
|
1283
|
+
value: ctor,
|
|
1284
|
+
enumerable: false,
|
|
1285
|
+
writable: true,
|
|
1286
|
+
configurable: true
|
|
1287
|
+
}
|
|
1288
|
+
})
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
} else {
|
|
1292
|
+
// old school shim for old browsers
|
|
1293
|
+
module.exports = function inherits (ctor, superCtor) {
|
|
1294
|
+
if (superCtor) {
|
|
1295
|
+
ctor.super_ = superCtor
|
|
1296
|
+
var TempCtor = function () {}
|
|
1297
|
+
TempCtor.prototype = superCtor.prototype
|
|
1298
|
+
ctor.prototype = new TempCtor()
|
|
1299
|
+
ctor.prototype.constructor = ctor
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, {}],
|
|
1304
|
+
30: [function (require, module, exports) {
|
|
1305
|
+
'use strict'
|
|
1306
|
+
|
|
1307
|
+
var hasToStringTag = require('has-tostringtag/shams')()
|
|
1308
|
+
var callBound = require('call-bind/callBound')
|
|
1309
|
+
|
|
1310
|
+
var $toString = callBound('Object.prototype.toString')
|
|
1311
|
+
|
|
1312
|
+
var isStandardArguments = function isArguments (value) {
|
|
1313
|
+
if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
|
|
1314
|
+
return false
|
|
1315
|
+
}
|
|
1316
|
+
return $toString(value) === '[object Arguments]'
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
var isLegacyArguments = function isArguments (value) {
|
|
1320
|
+
if (isStandardArguments(value)) {
|
|
1321
|
+
return true
|
|
1322
|
+
}
|
|
1323
|
+
return value !== null &&
|
|
1324
|
+
typeof value === 'object' &&
|
|
1325
|
+
typeof value.length === 'number' &&
|
|
1326
|
+
value.length >= 0 &&
|
|
1327
|
+
$toString(value) !== '[object Array]' &&
|
|
1328
|
+
$toString(value.callee) === '[object Function]'
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
var supportsStandardArguments = (function () {
|
|
1332
|
+
return isStandardArguments(arguments)
|
|
1333
|
+
}())
|
|
1334
|
+
|
|
1335
|
+
isStandardArguments.isLegacyArguments = isLegacyArguments // for tests
|
|
1336
|
+
|
|
1337
|
+
module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments
|
|
1338
|
+
}, { 'call-bind/callBound': 15, 'has-tostringtag/shams': 27 }],
|
|
1339
|
+
31: [function (require, module, exports) {
|
|
1340
|
+
'use strict'
|
|
1341
|
+
|
|
1342
|
+
var fnToStr = Function.prototype.toString
|
|
1343
|
+
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply
|
|
1344
|
+
var badArrayLike
|
|
1345
|
+
var isCallableMarker
|
|
1346
|
+
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
|
1347
|
+
try {
|
|
1348
|
+
badArrayLike = Object.defineProperty({}, 'length', {
|
|
1349
|
+
get: function () {
|
|
1350
|
+
throw isCallableMarker
|
|
1351
|
+
}
|
|
1352
|
+
})
|
|
1353
|
+
isCallableMarker = {}
|
|
1354
|
+
// eslint-disable-next-line no-throw-literal
|
|
1355
|
+
reflectApply(function () { throw 42 }, null, badArrayLike)
|
|
1356
|
+
} catch (_) {
|
|
1357
|
+
if (_ !== isCallableMarker) {
|
|
1358
|
+
reflectApply = null
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
} else {
|
|
1362
|
+
reflectApply = null
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
var constructorRegex = /^\s*class\b/
|
|
1366
|
+
var isES6ClassFn = function isES6ClassFunction (value) {
|
|
1367
|
+
try {
|
|
1368
|
+
var fnStr = fnToStr.call(value)
|
|
1369
|
+
return constructorRegex.test(fnStr)
|
|
1370
|
+
} catch (e) {
|
|
1371
|
+
return false // not a function
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
var tryFunctionObject = function tryFunctionToStr (value) {
|
|
1376
|
+
try {
|
|
1377
|
+
if (isES6ClassFn(value)) { return false }
|
|
1378
|
+
fnToStr.call(value)
|
|
1379
|
+
return true
|
|
1380
|
+
} catch (e) {
|
|
1381
|
+
return false
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
var toStr = Object.prototype.toString
|
|
1385
|
+
var objectClass = '[object Object]'
|
|
1386
|
+
var fnClass = '[object Function]'
|
|
1387
|
+
var genClass = '[object GeneratorFunction]'
|
|
1388
|
+
var ddaClass = '[object HTMLAllCollection]' // IE 11
|
|
1389
|
+
var ddaClass2 = '[object HTML document.all class]'
|
|
1390
|
+
var ddaClass3 = '[object HTMLCollection]' // IE 9-10
|
|
1391
|
+
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag // better: use `has-tostringtag`
|
|
1392
|
+
|
|
1393
|
+
var isIE68 = !(0 in [,]) // eslint-disable-line no-sparse-arrays, comma-spacing
|
|
1394
|
+
|
|
1395
|
+
var isDDA = function isDocumentDotAll () { return false }
|
|
1396
|
+
if (typeof document === 'object') {
|
|
1397
|
+
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
|
|
1398
|
+
var all = document.all
|
|
1399
|
+
if (toStr.call(all) === toStr.call(document.all)) {
|
|
1400
|
+
isDDA = function isDocumentDotAll (value) {
|
|
1401
|
+
/* globals document: false */
|
|
1402
|
+
// in IE 6-8, typeof document.all is "object" and it's truthy
|
|
1403
|
+
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
|
|
1404
|
+
try {
|
|
1405
|
+
var str = toStr.call(value)
|
|
1406
|
+
return (
|
|
1407
|
+
str === ddaClass ||
|
|
1408
|
+
str === ddaClass2 ||
|
|
1409
|
+
str === ddaClass3 || // opera 12.16
|
|
1410
|
+
str === objectClass // IE 6-8
|
|
1411
|
+
) && value('') == null // eslint-disable-line eqeqeq
|
|
1412
|
+
} catch (e) { /**/ }
|
|
1413
|
+
}
|
|
1414
|
+
return false
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
module.exports = reflectApply
|
|
1420
|
+
? function isCallable (value) {
|
|
1421
|
+
if (isDDA(value)) { return true }
|
|
1422
|
+
if (!value) { return false }
|
|
1423
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false }
|
|
1424
|
+
try {
|
|
1425
|
+
reflectApply(value, null, badArrayLike)
|
|
1426
|
+
} catch (e) {
|
|
1427
|
+
if (e !== isCallableMarker) { return false }
|
|
1428
|
+
}
|
|
1429
|
+
return !isES6ClassFn(value) && tryFunctionObject(value)
|
|
1430
|
+
}
|
|
1431
|
+
: function isCallable (value) {
|
|
1432
|
+
if (isDDA(value)) { return true }
|
|
1433
|
+
if (!value) { return false }
|
|
1434
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false }
|
|
1435
|
+
if (hasToStringTag) { return tryFunctionObject(value) }
|
|
1436
|
+
if (isES6ClassFn(value)) { return false }
|
|
1437
|
+
var strClass = toStr.call(value)
|
|
1438
|
+
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false }
|
|
1439
|
+
return tryFunctionObject(value)
|
|
1440
|
+
}
|
|
1441
|
+
}, {}],
|
|
1442
|
+
32: [function (require, module, exports) {
|
|
1443
|
+
'use strict'
|
|
1444
|
+
|
|
1445
|
+
var toStr = Object.prototype.toString
|
|
1446
|
+
var fnToStr = Function.prototype.toString
|
|
1447
|
+
var isFnRegex = /^\s*(?:function)?\*/
|
|
1448
|
+
var hasToStringTag = require('has-tostringtag/shams')()
|
|
1449
|
+
var getProto = Object.getPrototypeOf
|
|
1450
|
+
var getGeneratorFunc = function () { // eslint-disable-line consistent-return
|
|
1451
|
+
if (!hasToStringTag) {
|
|
1452
|
+
return false
|
|
1453
|
+
}
|
|
1454
|
+
try {
|
|
1455
|
+
return Function('return function*() {}')()
|
|
1456
|
+
} catch (e) {
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
var GeneratorFunction
|
|
1460
|
+
|
|
1461
|
+
module.exports = function isGeneratorFunction (fn) {
|
|
1462
|
+
if (typeof fn !== 'function') {
|
|
1463
|
+
return false
|
|
1464
|
+
}
|
|
1465
|
+
if (isFnRegex.test(fnToStr.call(fn))) {
|
|
1466
|
+
return true
|
|
1467
|
+
}
|
|
1468
|
+
if (!hasToStringTag) {
|
|
1469
|
+
var str = toStr.call(fn)
|
|
1470
|
+
return str === '[object GeneratorFunction]'
|
|
1471
|
+
}
|
|
1472
|
+
if (!getProto) {
|
|
1473
|
+
return false
|
|
1474
|
+
}
|
|
1475
|
+
if (typeof GeneratorFunction === 'undefined') {
|
|
1476
|
+
var generatorFunc = getGeneratorFunc()
|
|
1477
|
+
GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false
|
|
1478
|
+
}
|
|
1479
|
+
return getProto(fn) === GeneratorFunction
|
|
1480
|
+
}
|
|
1481
|
+
}, { 'has-tostringtag/shams': 27 }],
|
|
1482
|
+
33: [function (require, module, exports) {
|
|
1483
|
+
'use strict'
|
|
1484
|
+
|
|
1485
|
+
var whichTypedArray = require('which-typed-array')
|
|
1486
|
+
|
|
1487
|
+
module.exports = function isTypedArray (value) {
|
|
1488
|
+
return !!whichTypedArray(value)
|
|
1489
|
+
}
|
|
1490
|
+
}, { 'which-typed-array': 39 }],
|
|
1491
|
+
34: [function (require, module, exports) {
|
|
1492
|
+
// shim for using process in browser
|
|
1493
|
+
var process = module.exports = {}
|
|
1494
|
+
|
|
1495
|
+
// cached from whatever global is present so that test runners that stub it
|
|
1496
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
|
1497
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
1498
|
+
// function because try/catches deoptimize in certain engines.
|
|
1499
|
+
|
|
1500
|
+
var cachedSetTimeout
|
|
1501
|
+
var cachedClearTimeout
|
|
1502
|
+
|
|
1503
|
+
function defaultSetTimout () {
|
|
1504
|
+
throw new Error('setTimeout has not been defined')
|
|
1505
|
+
}
|
|
1506
|
+
function defaultClearTimeout () {
|
|
1507
|
+
throw new Error('clearTimeout has not been defined')
|
|
1508
|
+
}
|
|
1509
|
+
(function () {
|
|
1510
|
+
try {
|
|
1511
|
+
if (typeof setTimeout === 'function') {
|
|
1512
|
+
cachedSetTimeout = setTimeout
|
|
1513
|
+
} else {
|
|
1514
|
+
cachedSetTimeout = defaultSetTimout
|
|
1515
|
+
}
|
|
1516
|
+
} catch (e) {
|
|
1517
|
+
cachedSetTimeout = defaultSetTimout
|
|
1518
|
+
}
|
|
1519
|
+
try {
|
|
1520
|
+
if (typeof clearTimeout === 'function') {
|
|
1521
|
+
cachedClearTimeout = clearTimeout
|
|
1522
|
+
} else {
|
|
1523
|
+
cachedClearTimeout = defaultClearTimeout
|
|
1524
|
+
}
|
|
1525
|
+
} catch (e) {
|
|
1526
|
+
cachedClearTimeout = defaultClearTimeout
|
|
1527
|
+
}
|
|
1528
|
+
}())
|
|
1529
|
+
function runTimeout (fun) {
|
|
1530
|
+
if (cachedSetTimeout === setTimeout) {
|
|
1531
|
+
// normal enviroments in sane situations
|
|
1532
|
+
return setTimeout(fun, 0)
|
|
1533
|
+
}
|
|
1534
|
+
// if setTimeout wasn't available but was latter defined
|
|
1535
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
1536
|
+
cachedSetTimeout = setTimeout
|
|
1537
|
+
return setTimeout(fun, 0)
|
|
1538
|
+
}
|
|
1539
|
+
try {
|
|
1540
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1541
|
+
return cachedSetTimeout(fun, 0)
|
|
1542
|
+
} catch (e) {
|
|
1543
|
+
try {
|
|
1544
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1545
|
+
return cachedSetTimeout.call(null, fun, 0)
|
|
1546
|
+
} catch (e) {
|
|
1547
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
1548
|
+
return cachedSetTimeout.call(this, fun, 0)
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
function runClearTimeout (marker) {
|
|
1553
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
1554
|
+
// normal enviroments in sane situations
|
|
1555
|
+
return clearTimeout(marker)
|
|
1556
|
+
}
|
|
1557
|
+
// if clearTimeout wasn't available but was latter defined
|
|
1558
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
1559
|
+
cachedClearTimeout = clearTimeout
|
|
1560
|
+
return clearTimeout(marker)
|
|
1561
|
+
}
|
|
1562
|
+
try {
|
|
1563
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1564
|
+
return cachedClearTimeout(marker)
|
|
1565
|
+
} catch (e) {
|
|
1566
|
+
try {
|
|
1567
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1568
|
+
return cachedClearTimeout.call(null, marker)
|
|
1569
|
+
} catch (e) {
|
|
1570
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
1571
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1572
|
+
return cachedClearTimeout.call(this, marker)
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
var queue = []
|
|
1577
|
+
var draining = false
|
|
1578
|
+
var currentQueue
|
|
1579
|
+
var queueIndex = -1
|
|
1580
|
+
|
|
1581
|
+
function cleanUpNextTick () {
|
|
1582
|
+
if (!draining || !currentQueue) {
|
|
1583
|
+
return
|
|
1584
|
+
}
|
|
1585
|
+
draining = false
|
|
1586
|
+
if (currentQueue.length) {
|
|
1587
|
+
queue = currentQueue.concat(queue)
|
|
1588
|
+
} else {
|
|
1589
|
+
queueIndex = -1
|
|
1590
|
+
}
|
|
1591
|
+
if (queue.length) {
|
|
1592
|
+
drainQueue()
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
function drainQueue () {
|
|
1597
|
+
if (draining) {
|
|
1598
|
+
return
|
|
1599
|
+
}
|
|
1600
|
+
var timeout = runTimeout(cleanUpNextTick)
|
|
1601
|
+
draining = true
|
|
1602
|
+
|
|
1603
|
+
var len = queue.length
|
|
1604
|
+
while (len) {
|
|
1605
|
+
currentQueue = queue
|
|
1606
|
+
queue = []
|
|
1607
|
+
while (++queueIndex < len) {
|
|
1608
|
+
if (currentQueue) {
|
|
1609
|
+
currentQueue[queueIndex].run()
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
queueIndex = -1
|
|
1613
|
+
len = queue.length
|
|
1614
|
+
}
|
|
1615
|
+
currentQueue = null
|
|
1616
|
+
draining = false
|
|
1617
|
+
runClearTimeout(timeout)
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
process.nextTick = function (fun) {
|
|
1621
|
+
var args = new Array(arguments.length - 1)
|
|
1622
|
+
if (arguments.length > 1) {
|
|
1623
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1624
|
+
args[i - 1] = arguments[i]
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
queue.push(new Item(fun, args))
|
|
1628
|
+
if (queue.length === 1 && !draining) {
|
|
1629
|
+
runTimeout(drainQueue)
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
// v8 likes predictible objects
|
|
1634
|
+
function Item (fun, array) {
|
|
1635
|
+
this.fun = fun
|
|
1636
|
+
this.array = array
|
|
1637
|
+
}
|
|
1638
|
+
Item.prototype.run = function () {
|
|
1639
|
+
this.fun.apply(null, this.array)
|
|
1640
|
+
}
|
|
1641
|
+
process.title = 'browser'
|
|
1642
|
+
process.browser = true
|
|
1643
|
+
process.env = {}
|
|
1644
|
+
process.argv = []
|
|
1645
|
+
process.version = '' // empty string to avoid regexp issues
|
|
1646
|
+
process.versions = {}
|
|
1647
|
+
|
|
1648
|
+
function noop () {}
|
|
1649
|
+
|
|
1650
|
+
process.on = noop
|
|
1651
|
+
process.addListener = noop
|
|
1652
|
+
process.once = noop
|
|
1653
|
+
process.off = noop
|
|
1654
|
+
process.removeListener = noop
|
|
1655
|
+
process.removeAllListeners = noop
|
|
1656
|
+
process.emit = noop
|
|
1657
|
+
process.prependListener = noop
|
|
1658
|
+
process.prependOnceListener = noop
|
|
1659
|
+
|
|
1660
|
+
process.listeners = function (name) { return [] }
|
|
1661
|
+
|
|
1662
|
+
process.binding = function (name) {
|
|
1663
|
+
throw new Error('process.binding is not supported')
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
process.cwd = function () { return '/' }
|
|
1667
|
+
process.chdir = function (dir) {
|
|
1668
|
+
throw new Error('process.chdir is not supported')
|
|
1669
|
+
}
|
|
1670
|
+
process.umask = function () { return 0 }
|
|
1671
|
+
}, {}],
|
|
1672
|
+
35: [function (require, module, exports) {
|
|
1673
|
+
'use strict'
|
|
1674
|
+
|
|
1675
|
+
var GetIntrinsic = require('get-intrinsic')
|
|
1676
|
+
var define = require('define-data-property')
|
|
1677
|
+
var hasDescriptors = require('has-property-descriptors')()
|
|
1678
|
+
var gOPD = require('gopd')
|
|
1679
|
+
|
|
1680
|
+
var $TypeError = GetIntrinsic('%TypeError%')
|
|
1681
|
+
var $floor = GetIntrinsic('%Math.floor%')
|
|
1682
|
+
|
|
1683
|
+
module.exports = function setFunctionLength (fn, length) {
|
|
1684
|
+
if (typeof fn !== 'function') {
|
|
1685
|
+
throw new $TypeError('`fn` is not a function')
|
|
1686
|
+
}
|
|
1687
|
+
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
|
|
1688
|
+
throw new $TypeError('`length` must be a positive 32-bit integer')
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
var loose = arguments.length > 2 && !!arguments[2]
|
|
1692
|
+
|
|
1693
|
+
var functionLengthIsConfigurable = true
|
|
1694
|
+
var functionLengthIsWritable = true
|
|
1695
|
+
if ('length' in fn && gOPD) {
|
|
1696
|
+
var desc = gOPD(fn, 'length')
|
|
1697
|
+
if (desc && !desc.configurable) {
|
|
1698
|
+
functionLengthIsConfigurable = false
|
|
1699
|
+
}
|
|
1700
|
+
if (desc && !desc.writable) {
|
|
1701
|
+
functionLengthIsWritable = false
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
|
1706
|
+
if (hasDescriptors) {
|
|
1707
|
+
define(fn, 'length', length, true, true)
|
|
1708
|
+
} else {
|
|
1709
|
+
define(fn, 'length', length)
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
return fn
|
|
1713
|
+
}
|
|
1714
|
+
}, { 'define-data-property': 17, 'get-intrinsic': 21, gopd: 22, 'has-property-descriptors': 23 }],
|
|
1715
|
+
36: [function (require, module, exports) {
|
|
1716
|
+
module.exports = function isBuffer (arg) {
|
|
1717
|
+
return arg && typeof arg === 'object' &&
|
|
1718
|
+
typeof arg.copy === 'function' &&
|
|
1719
|
+
typeof arg.fill === 'function' &&
|
|
1720
|
+
typeof arg.readUInt8 === 'function'
|
|
1721
|
+
}
|
|
1722
|
+
}, {}],
|
|
1723
|
+
37: [function (require, module, exports) {
|
|
1724
|
+
// Currently in sync with Node.js lib/internal/util/types.js
|
|
1725
|
+
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
|
|
1726
|
+
|
|
1727
|
+
'use strict'
|
|
1728
|
+
|
|
1729
|
+
var isArgumentsObject = require('is-arguments')
|
|
1730
|
+
var isGeneratorFunction = require('is-generator-function')
|
|
1731
|
+
var whichTypedArray = require('which-typed-array')
|
|
1732
|
+
var isTypedArray = require('is-typed-array')
|
|
1733
|
+
|
|
1734
|
+
function uncurryThis (f) {
|
|
1735
|
+
return f.call.bind(f)
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
var BigIntSupported = typeof BigInt !== 'undefined'
|
|
1739
|
+
var SymbolSupported = typeof Symbol !== 'undefined'
|
|
1740
|
+
|
|
1741
|
+
var ObjectToString = uncurryThis(Object.prototype.toString)
|
|
1742
|
+
|
|
1743
|
+
var numberValue = uncurryThis(Number.prototype.valueOf)
|
|
1744
|
+
var stringValue = uncurryThis(String.prototype.valueOf)
|
|
1745
|
+
var booleanValue = uncurryThis(Boolean.prototype.valueOf)
|
|
1746
|
+
|
|
1747
|
+
if (BigIntSupported) {
|
|
1748
|
+
var bigIntValue = uncurryThis(BigInt.prototype.valueOf)
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
if (SymbolSupported) {
|
|
1752
|
+
var symbolValue = uncurryThis(Symbol.prototype.valueOf)
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
function checkBoxedPrimitive (value, prototypeValueOf) {
|
|
1756
|
+
if (typeof value !== 'object') {
|
|
1757
|
+
return false
|
|
1758
|
+
}
|
|
1759
|
+
try {
|
|
1760
|
+
prototypeValueOf(value)
|
|
1761
|
+
return true
|
|
1762
|
+
} catch (e) {
|
|
1763
|
+
return false
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
exports.isArgumentsObject = isArgumentsObject
|
|
1768
|
+
exports.isGeneratorFunction = isGeneratorFunction
|
|
1769
|
+
exports.isTypedArray = isTypedArray
|
|
1770
|
+
|
|
1771
|
+
// Taken from here and modified for better browser support
|
|
1772
|
+
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
|
|
1773
|
+
function isPromise (input) {
|
|
1774
|
+
return (
|
|
1775
|
+
(
|
|
1776
|
+
typeof Promise !== 'undefined' &&
|
|
1777
|
+
input instanceof Promise
|
|
1778
|
+
) ||
|
|
1779
|
+
(
|
|
1780
|
+
input !== null &&
|
|
1781
|
+
typeof input === 'object' &&
|
|
1782
|
+
typeof input.then === 'function' &&
|
|
1783
|
+
typeof input.catch === 'function'
|
|
1784
|
+
)
|
|
1785
|
+
)
|
|
1786
|
+
}
|
|
1787
|
+
exports.isPromise = isPromise
|
|
1788
|
+
|
|
1789
|
+
function isArrayBufferView (value) {
|
|
1790
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
1791
|
+
return ArrayBuffer.isView(value)
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
return (
|
|
1795
|
+
isTypedArray(value) ||
|
|
1796
|
+
isDataView(value)
|
|
1797
|
+
)
|
|
1798
|
+
}
|
|
1799
|
+
exports.isArrayBufferView = isArrayBufferView
|
|
1800
|
+
|
|
1801
|
+
function isUint8Array (value) {
|
|
1802
|
+
return whichTypedArray(value) === 'Uint8Array'
|
|
1803
|
+
}
|
|
1804
|
+
exports.isUint8Array = isUint8Array
|
|
1805
|
+
|
|
1806
|
+
function isUint8ClampedArray (value) {
|
|
1807
|
+
return whichTypedArray(value) === 'Uint8ClampedArray'
|
|
1808
|
+
}
|
|
1809
|
+
exports.isUint8ClampedArray = isUint8ClampedArray
|
|
1810
|
+
|
|
1811
|
+
function isUint16Array (value) {
|
|
1812
|
+
return whichTypedArray(value) === 'Uint16Array'
|
|
1813
|
+
}
|
|
1814
|
+
exports.isUint16Array = isUint16Array
|
|
1815
|
+
|
|
1816
|
+
function isUint32Array (value) {
|
|
1817
|
+
return whichTypedArray(value) === 'Uint32Array'
|
|
1818
|
+
}
|
|
1819
|
+
exports.isUint32Array = isUint32Array
|
|
1820
|
+
|
|
1821
|
+
function isInt8Array (value) {
|
|
1822
|
+
return whichTypedArray(value) === 'Int8Array'
|
|
1823
|
+
}
|
|
1824
|
+
exports.isInt8Array = isInt8Array
|
|
1825
|
+
|
|
1826
|
+
function isInt16Array (value) {
|
|
1827
|
+
return whichTypedArray(value) === 'Int16Array'
|
|
1828
|
+
}
|
|
1829
|
+
exports.isInt16Array = isInt16Array
|
|
1830
|
+
|
|
1831
|
+
function isInt32Array (value) {
|
|
1832
|
+
return whichTypedArray(value) === 'Int32Array'
|
|
1833
|
+
}
|
|
1834
|
+
exports.isInt32Array = isInt32Array
|
|
1835
|
+
|
|
1836
|
+
function isFloat32Array (value) {
|
|
1837
|
+
return whichTypedArray(value) === 'Float32Array'
|
|
1838
|
+
}
|
|
1839
|
+
exports.isFloat32Array = isFloat32Array
|
|
1840
|
+
|
|
1841
|
+
function isFloat64Array (value) {
|
|
1842
|
+
return whichTypedArray(value) === 'Float64Array'
|
|
1843
|
+
}
|
|
1844
|
+
exports.isFloat64Array = isFloat64Array
|
|
1845
|
+
|
|
1846
|
+
function isBigInt64Array (value) {
|
|
1847
|
+
return whichTypedArray(value) === 'BigInt64Array'
|
|
1848
|
+
}
|
|
1849
|
+
exports.isBigInt64Array = isBigInt64Array
|
|
1850
|
+
|
|
1851
|
+
function isBigUint64Array (value) {
|
|
1852
|
+
return whichTypedArray(value) === 'BigUint64Array'
|
|
1853
|
+
}
|
|
1854
|
+
exports.isBigUint64Array = isBigUint64Array
|
|
1855
|
+
|
|
1856
|
+
function isMapToString (value) {
|
|
1857
|
+
return ObjectToString(value) === '[object Map]'
|
|
1858
|
+
}
|
|
1859
|
+
isMapToString.working = (
|
|
1860
|
+
typeof Map !== 'undefined' &&
|
|
1861
|
+
isMapToString(new Map())
|
|
1862
|
+
)
|
|
1863
|
+
|
|
1864
|
+
function isMap (value) {
|
|
1865
|
+
if (typeof Map === 'undefined') {
|
|
1866
|
+
return false
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
return isMapToString.working
|
|
1870
|
+
? isMapToString(value)
|
|
1871
|
+
: value instanceof Map
|
|
1872
|
+
}
|
|
1873
|
+
exports.isMap = isMap
|
|
1874
|
+
|
|
1875
|
+
function isSetToString (value) {
|
|
1876
|
+
return ObjectToString(value) === '[object Set]'
|
|
1877
|
+
}
|
|
1878
|
+
isSetToString.working = (
|
|
1879
|
+
typeof Set !== 'undefined' &&
|
|
1880
|
+
isSetToString(new Set())
|
|
1881
|
+
)
|
|
1882
|
+
function isSet (value) {
|
|
1883
|
+
if (typeof Set === 'undefined') {
|
|
1884
|
+
return false
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
return isSetToString.working
|
|
1888
|
+
? isSetToString(value)
|
|
1889
|
+
: value instanceof Set
|
|
1890
|
+
}
|
|
1891
|
+
exports.isSet = isSet
|
|
1892
|
+
|
|
1893
|
+
function isWeakMapToString (value) {
|
|
1894
|
+
return ObjectToString(value) === '[object WeakMap]'
|
|
1895
|
+
}
|
|
1896
|
+
isWeakMapToString.working = (
|
|
1897
|
+
typeof WeakMap !== 'undefined' &&
|
|
1898
|
+
isWeakMapToString(new WeakMap())
|
|
1899
|
+
)
|
|
1900
|
+
function isWeakMap (value) {
|
|
1901
|
+
if (typeof WeakMap === 'undefined') {
|
|
1902
|
+
return false
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
return isWeakMapToString.working
|
|
1906
|
+
? isWeakMapToString(value)
|
|
1907
|
+
: value instanceof WeakMap
|
|
1908
|
+
}
|
|
1909
|
+
exports.isWeakMap = isWeakMap
|
|
1910
|
+
|
|
1911
|
+
function isWeakSetToString (value) {
|
|
1912
|
+
return ObjectToString(value) === '[object WeakSet]'
|
|
1913
|
+
}
|
|
1914
|
+
isWeakSetToString.working = (
|
|
1915
|
+
typeof WeakSet !== 'undefined' &&
|
|
1916
|
+
isWeakSetToString(new WeakSet())
|
|
1917
|
+
)
|
|
1918
|
+
function isWeakSet (value) {
|
|
1919
|
+
return isWeakSetToString(value)
|
|
1920
|
+
}
|
|
1921
|
+
exports.isWeakSet = isWeakSet
|
|
1922
|
+
|
|
1923
|
+
function isArrayBufferToString (value) {
|
|
1924
|
+
return ObjectToString(value) === '[object ArrayBuffer]'
|
|
1925
|
+
}
|
|
1926
|
+
isArrayBufferToString.working = (
|
|
1927
|
+
typeof ArrayBuffer !== 'undefined' &&
|
|
1928
|
+
isArrayBufferToString(new ArrayBuffer())
|
|
1929
|
+
)
|
|
1930
|
+
function isArrayBuffer (value) {
|
|
1931
|
+
if (typeof ArrayBuffer === 'undefined') {
|
|
1932
|
+
return false
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
return isArrayBufferToString.working
|
|
1936
|
+
? isArrayBufferToString(value)
|
|
1937
|
+
: value instanceof ArrayBuffer
|
|
1938
|
+
}
|
|
1939
|
+
exports.isArrayBuffer = isArrayBuffer
|
|
1940
|
+
|
|
1941
|
+
function isDataViewToString (value) {
|
|
1942
|
+
return ObjectToString(value) === '[object DataView]'
|
|
1943
|
+
}
|
|
1944
|
+
isDataViewToString.working = (
|
|
1945
|
+
typeof ArrayBuffer !== 'undefined' &&
|
|
1946
|
+
typeof DataView !== 'undefined' &&
|
|
1947
|
+
isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
|
|
1948
|
+
)
|
|
1949
|
+
function isDataView (value) {
|
|
1950
|
+
if (typeof DataView === 'undefined') {
|
|
1951
|
+
return false
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
return isDataViewToString.working
|
|
1955
|
+
? isDataViewToString(value)
|
|
1956
|
+
: value instanceof DataView
|
|
1957
|
+
}
|
|
1958
|
+
exports.isDataView = isDataView
|
|
1959
|
+
|
|
1960
|
+
// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
|
|
1961
|
+
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined
|
|
1962
|
+
function isSharedArrayBufferToString (value) {
|
|
1963
|
+
return ObjectToString(value) === '[object SharedArrayBuffer]'
|
|
1964
|
+
}
|
|
1965
|
+
function isSharedArrayBuffer (value) {
|
|
1966
|
+
if (typeof SharedArrayBufferCopy === 'undefined') {
|
|
1967
|
+
return false
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
if (typeof isSharedArrayBufferToString.working === 'undefined') {
|
|
1971
|
+
isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy())
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
return isSharedArrayBufferToString.working
|
|
1975
|
+
? isSharedArrayBufferToString(value)
|
|
1976
|
+
: value instanceof SharedArrayBufferCopy
|
|
1977
|
+
}
|
|
1978
|
+
exports.isSharedArrayBuffer = isSharedArrayBuffer
|
|
1979
|
+
|
|
1980
|
+
function isAsyncFunction (value) {
|
|
1981
|
+
return ObjectToString(value) === '[object AsyncFunction]'
|
|
1982
|
+
}
|
|
1983
|
+
exports.isAsyncFunction = isAsyncFunction
|
|
1984
|
+
|
|
1985
|
+
function isMapIterator (value) {
|
|
1986
|
+
return ObjectToString(value) === '[object Map Iterator]'
|
|
1987
|
+
}
|
|
1988
|
+
exports.isMapIterator = isMapIterator
|
|
1989
|
+
|
|
1990
|
+
function isSetIterator (value) {
|
|
1991
|
+
return ObjectToString(value) === '[object Set Iterator]'
|
|
1992
|
+
}
|
|
1993
|
+
exports.isSetIterator = isSetIterator
|
|
1994
|
+
|
|
1995
|
+
function isGeneratorObject (value) {
|
|
1996
|
+
return ObjectToString(value) === '[object Generator]'
|
|
1997
|
+
}
|
|
1998
|
+
exports.isGeneratorObject = isGeneratorObject
|
|
1999
|
+
|
|
2000
|
+
function isWebAssemblyCompiledModule (value) {
|
|
2001
|
+
return ObjectToString(value) === '[object WebAssembly.Module]'
|
|
2002
|
+
}
|
|
2003
|
+
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule
|
|
2004
|
+
|
|
2005
|
+
function isNumberObject (value) {
|
|
2006
|
+
return checkBoxedPrimitive(value, numberValue)
|
|
2007
|
+
}
|
|
2008
|
+
exports.isNumberObject = isNumberObject
|
|
2009
|
+
|
|
2010
|
+
function isStringObject (value) {
|
|
2011
|
+
return checkBoxedPrimitive(value, stringValue)
|
|
2012
|
+
}
|
|
2013
|
+
exports.isStringObject = isStringObject
|
|
2014
|
+
|
|
2015
|
+
function isBooleanObject (value) {
|
|
2016
|
+
return checkBoxedPrimitive(value, booleanValue)
|
|
2017
|
+
}
|
|
2018
|
+
exports.isBooleanObject = isBooleanObject
|
|
2019
|
+
|
|
2020
|
+
function isBigIntObject (value) {
|
|
2021
|
+
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue)
|
|
2022
|
+
}
|
|
2023
|
+
exports.isBigIntObject = isBigIntObject
|
|
2024
|
+
|
|
2025
|
+
function isSymbolObject (value) {
|
|
2026
|
+
return SymbolSupported && checkBoxedPrimitive(value, symbolValue)
|
|
2027
|
+
}
|
|
2028
|
+
exports.isSymbolObject = isSymbolObject
|
|
2029
|
+
|
|
2030
|
+
function isBoxedPrimitive (value) {
|
|
2031
|
+
return (
|
|
2032
|
+
isNumberObject(value) ||
|
|
2033
|
+
isStringObject(value) ||
|
|
2034
|
+
isBooleanObject(value) ||
|
|
2035
|
+
isBigIntObject(value) ||
|
|
2036
|
+
isSymbolObject(value)
|
|
2037
|
+
)
|
|
2038
|
+
}
|
|
2039
|
+
exports.isBoxedPrimitive = isBoxedPrimitive
|
|
2040
|
+
|
|
2041
|
+
function isAnyArrayBuffer (value) {
|
|
2042
|
+
return typeof Uint8Array !== 'undefined' && (
|
|
2043
|
+
isArrayBuffer(value) ||
|
|
2044
|
+
isSharedArrayBuffer(value)
|
|
2045
|
+
)
|
|
2046
|
+
}
|
|
2047
|
+
exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
2048
|
+
|
|
2049
|
+
['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function (method) {
|
|
2050
|
+
Object.defineProperty(exports, method, {
|
|
2051
|
+
enumerable: false,
|
|
2052
|
+
value: function () {
|
|
2053
|
+
throw new Error(method + ' is not supported in userland')
|
|
2054
|
+
}
|
|
2055
|
+
})
|
|
2056
|
+
})
|
|
2057
|
+
}, { 'is-arguments': 30, 'is-generator-function': 32, 'is-typed-array': 33, 'which-typed-array': 39 }],
|
|
2058
|
+
38: [function (require, module, exports) {
|
|
2059
|
+
(function (process) {
|
|
2060
|
+
(function () {
|
|
2061
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2062
|
+
//
|
|
2063
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2064
|
+
// copy of this software and associated documentation files (the
|
|
2065
|
+
// "Software"), to deal in the Software without restriction, including
|
|
2066
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
2067
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
2068
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
2069
|
+
// following conditions:
|
|
2070
|
+
//
|
|
2071
|
+
// The above copyright notice and this permission notice shall be included
|
|
2072
|
+
// in all copies or substantial portions of the Software.
|
|
2073
|
+
//
|
|
2074
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
2075
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
2076
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
2077
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
2078
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2079
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2080
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2081
|
+
|
|
2082
|
+
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
|
2083
|
+
function getOwnPropertyDescriptors (obj) {
|
|
2084
|
+
var keys = Object.keys(obj)
|
|
2085
|
+
var descriptors = {}
|
|
2086
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2087
|
+
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i])
|
|
2088
|
+
}
|
|
2089
|
+
return descriptors
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
var formatRegExp = /%[sdj%]/g
|
|
2093
|
+
exports.format = function (f) {
|
|
2094
|
+
if (!isString(f)) {
|
|
2095
|
+
var objects = []
|
|
2096
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2097
|
+
objects.push(inspect(arguments[i]))
|
|
2098
|
+
}
|
|
2099
|
+
return objects.join(' ')
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
var i = 1
|
|
2103
|
+
var args = arguments
|
|
2104
|
+
var len = args.length
|
|
2105
|
+
var str = String(f).replace(formatRegExp, function (x) {
|
|
2106
|
+
if (x === '%%') return '%'
|
|
2107
|
+
if (i >= len) return x
|
|
2108
|
+
switch (x) {
|
|
2109
|
+
case '%s': return String(args[i++])
|
|
2110
|
+
case '%d': return Number(args[i++])
|
|
2111
|
+
case '%j':
|
|
2112
|
+
try {
|
|
2113
|
+
return JSON.stringify(args[i++])
|
|
2114
|
+
} catch (_) {
|
|
2115
|
+
return '[Circular]'
|
|
2116
|
+
}
|
|
2117
|
+
default:
|
|
2118
|
+
return x
|
|
2119
|
+
}
|
|
2120
|
+
})
|
|
2121
|
+
for (var x = args[i]; i < len; x = args[++i]) {
|
|
2122
|
+
if (isNull(x) || !isObject(x)) {
|
|
2123
|
+
str += ' ' + x
|
|
2124
|
+
} else {
|
|
2125
|
+
str += ' ' + inspect(x)
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
return str
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
// Mark that a method should not be used.
|
|
2132
|
+
// Returns a modified function which warns once by default.
|
|
2133
|
+
// If --no-deprecation is set, then it is a no-op.
|
|
2134
|
+
exports.deprecate = function (fn, msg) {
|
|
2135
|
+
if (typeof process !== 'undefined' && process.noDeprecation === true) {
|
|
2136
|
+
return fn
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
// Allow for deprecating things in the process of starting up.
|
|
2140
|
+
if (typeof process === 'undefined') {
|
|
2141
|
+
return function () {
|
|
2142
|
+
return exports.deprecate(fn, msg).apply(this, arguments)
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
var warned = false
|
|
2147
|
+
function deprecated () {
|
|
2148
|
+
if (!warned) {
|
|
2149
|
+
if (process.throwDeprecation) {
|
|
2150
|
+
throw new Error(msg)
|
|
2151
|
+
} else if (process.traceDeprecation) {
|
|
2152
|
+
console.trace(msg)
|
|
2153
|
+
} else {
|
|
2154
|
+
console.error(msg)
|
|
2155
|
+
}
|
|
2156
|
+
warned = true
|
|
2157
|
+
}
|
|
2158
|
+
return fn.apply(this, arguments)
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
return deprecated
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
var debugs = {}
|
|
2165
|
+
var debugEnvRegex = /^$/
|
|
2166
|
+
|
|
2167
|
+
if (process.env.NODE_DEBUG) {
|
|
2168
|
+
var debugEnv = process.env.NODE_DEBUG
|
|
2169
|
+
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
|
|
2170
|
+
.replace(/\*/g, '.*')
|
|
2171
|
+
.replace(/,/g, '$|^')
|
|
2172
|
+
.toUpperCase()
|
|
2173
|
+
debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i')
|
|
2174
|
+
}
|
|
2175
|
+
exports.debuglog = function (set) {
|
|
2176
|
+
set = set.toUpperCase()
|
|
2177
|
+
if (!debugs[set]) {
|
|
2178
|
+
if (debugEnvRegex.test(set)) {
|
|
2179
|
+
var pid = process.pid
|
|
2180
|
+
debugs[set] = function () {
|
|
2181
|
+
var msg = exports.format.apply(exports, arguments)
|
|
2182
|
+
console.error('%s %d: %s', set, pid, msg)
|
|
2183
|
+
}
|
|
2184
|
+
} else {
|
|
2185
|
+
debugs[set] = function () {}
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
return debugs[set]
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* Echos the value of a value. Trys to print the value out
|
|
2193
|
+
* in the best way possible given the different types.
|
|
2194
|
+
*
|
|
2195
|
+
* @param {Object} obj The object to print out.
|
|
2196
|
+
* @param {Object} opts Optional options object that alters the output.
|
|
2197
|
+
*/
|
|
2198
|
+
/* legacy: obj, showHidden, depth, colors */
|
|
2199
|
+
function inspect (obj, opts) {
|
|
2200
|
+
// default options
|
|
2201
|
+
var ctx = {
|
|
2202
|
+
seen: [],
|
|
2203
|
+
stylize: stylizeNoColor
|
|
2204
|
+
}
|
|
2205
|
+
// legacy...
|
|
2206
|
+
if (arguments.length >= 3) ctx.depth = arguments[2]
|
|
2207
|
+
if (arguments.length >= 4) ctx.colors = arguments[3]
|
|
2208
|
+
if (isBoolean(opts)) {
|
|
2209
|
+
// legacy...
|
|
2210
|
+
ctx.showHidden = opts
|
|
2211
|
+
} else if (opts) {
|
|
2212
|
+
// got an "options" object
|
|
2213
|
+
exports._extend(ctx, opts)
|
|
2214
|
+
}
|
|
2215
|
+
// set default options
|
|
2216
|
+
if (isUndefined(ctx.showHidden)) ctx.showHidden = false
|
|
2217
|
+
if (isUndefined(ctx.depth)) ctx.depth = 2
|
|
2218
|
+
if (isUndefined(ctx.colors)) ctx.colors = false
|
|
2219
|
+
if (isUndefined(ctx.customInspect)) ctx.customInspect = true
|
|
2220
|
+
if (ctx.colors) ctx.stylize = stylizeWithColor
|
|
2221
|
+
return formatValue(ctx, obj, ctx.depth)
|
|
2222
|
+
}
|
|
2223
|
+
exports.inspect = inspect
|
|
2224
|
+
|
|
2225
|
+
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
|
2226
|
+
inspect.colors = {
|
|
2227
|
+
bold: [1, 22],
|
|
2228
|
+
italic: [3, 23],
|
|
2229
|
+
underline: [4, 24],
|
|
2230
|
+
inverse: [7, 27],
|
|
2231
|
+
white: [37, 39],
|
|
2232
|
+
grey: [90, 39],
|
|
2233
|
+
black: [30, 39],
|
|
2234
|
+
blue: [34, 39],
|
|
2235
|
+
cyan: [36, 39],
|
|
2236
|
+
green: [32, 39],
|
|
2237
|
+
magenta: [35, 39],
|
|
2238
|
+
red: [31, 39],
|
|
2239
|
+
yellow: [33, 39]
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
// Don't use 'blue' not visible on cmd.exe
|
|
2243
|
+
inspect.styles = {
|
|
2244
|
+
special: 'cyan',
|
|
2245
|
+
number: 'yellow',
|
|
2246
|
+
boolean: 'yellow',
|
|
2247
|
+
undefined: 'grey',
|
|
2248
|
+
null: 'bold',
|
|
2249
|
+
string: 'green',
|
|
2250
|
+
date: 'magenta',
|
|
2251
|
+
// "name": intentionally not styling
|
|
2252
|
+
regexp: 'red'
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
function stylizeWithColor (str, styleType) {
|
|
2256
|
+
var style = inspect.styles[styleType]
|
|
2257
|
+
|
|
2258
|
+
if (style) {
|
|
2259
|
+
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
|
2260
|
+
'\u001b[' + inspect.colors[style][1] + 'm'
|
|
2261
|
+
} else {
|
|
2262
|
+
return str
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
function stylizeNoColor (str, styleType) {
|
|
2267
|
+
return str
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
function arrayToHash (array) {
|
|
2271
|
+
var hash = {}
|
|
2272
|
+
|
|
2273
|
+
array.forEach(function (val, idx) {
|
|
2274
|
+
hash[val] = true
|
|
2275
|
+
})
|
|
2276
|
+
|
|
2277
|
+
return hash
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
function formatValue (ctx, value, recurseTimes) {
|
|
2281
|
+
// Provide a hook for user-specified inspect functions.
|
|
2282
|
+
// Check that value is an object with an inspect function on it
|
|
2283
|
+
if (ctx.customInspect &&
|
|
2284
|
+
value &&
|
|
2285
|
+
isFunction(value.inspect) &&
|
|
2286
|
+
// Filter out the util module, it's inspect function is special
|
|
2287
|
+
value.inspect !== exports.inspect &&
|
|
2288
|
+
// Also filter out any prototype objects using the circular check.
|
|
2289
|
+
!(value.constructor && value.constructor.prototype === value)) {
|
|
2290
|
+
var ret = value.inspect(recurseTimes, ctx)
|
|
2291
|
+
if (!isString(ret)) {
|
|
2292
|
+
ret = formatValue(ctx, ret, recurseTimes)
|
|
2293
|
+
}
|
|
2294
|
+
return ret
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
// Primitive types cannot have properties
|
|
2298
|
+
var primitive = formatPrimitive(ctx, value)
|
|
2299
|
+
if (primitive) {
|
|
2300
|
+
return primitive
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
// Look up the keys of the object.
|
|
2304
|
+
var keys = Object.keys(value)
|
|
2305
|
+
var visibleKeys = arrayToHash(keys)
|
|
2306
|
+
|
|
2307
|
+
if (ctx.showHidden) {
|
|
2308
|
+
keys = Object.getOwnPropertyNames(value)
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// IE doesn't make error fields non-enumerable
|
|
2312
|
+
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
|
2313
|
+
if (isError(value) &&
|
|
2314
|
+
(keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
|
2315
|
+
return formatError(value)
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
// Some type of object without properties can be shortcutted.
|
|
2319
|
+
if (keys.length === 0) {
|
|
2320
|
+
if (isFunction(value)) {
|
|
2321
|
+
var name = value.name ? ': ' + value.name : ''
|
|
2322
|
+
return ctx.stylize('[Function' + name + ']', 'special')
|
|
2323
|
+
}
|
|
2324
|
+
if (isRegExp(value)) {
|
|
2325
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp')
|
|
2326
|
+
}
|
|
2327
|
+
if (isDate(value)) {
|
|
2328
|
+
return ctx.stylize(Date.prototype.toString.call(value), 'date')
|
|
2329
|
+
}
|
|
2330
|
+
if (isError(value)) {
|
|
2331
|
+
return formatError(value)
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
var base = ''; var array = false; var braces = ['{', '}']
|
|
2336
|
+
|
|
2337
|
+
// Make Array say that they are Array
|
|
2338
|
+
if (isArray(value)) {
|
|
2339
|
+
array = true
|
|
2340
|
+
braces = ['[', ']']
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// Make functions say that they are functions
|
|
2344
|
+
if (isFunction(value)) {
|
|
2345
|
+
var n = value.name ? ': ' + value.name : ''
|
|
2346
|
+
base = ' [Function' + n + ']'
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
// Make RegExps say that they are RegExps
|
|
2350
|
+
if (isRegExp(value)) {
|
|
2351
|
+
base = ' ' + RegExp.prototype.toString.call(value)
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
// Make dates with properties first say the date
|
|
2355
|
+
if (isDate(value)) {
|
|
2356
|
+
base = ' ' + Date.prototype.toUTCString.call(value)
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
// Make error with message first say the error
|
|
2360
|
+
if (isError(value)) {
|
|
2361
|
+
base = ' ' + formatError(value)
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
if (keys.length === 0 && (!array || value.length == 0)) {
|
|
2365
|
+
return braces[0] + base + braces[1]
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
if (recurseTimes < 0) {
|
|
2369
|
+
if (isRegExp(value)) {
|
|
2370
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp')
|
|
2371
|
+
} else {
|
|
2372
|
+
return ctx.stylize('[Object]', 'special')
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
ctx.seen.push(value)
|
|
2377
|
+
|
|
2378
|
+
var output
|
|
2379
|
+
if (array) {
|
|
2380
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys)
|
|
2381
|
+
} else {
|
|
2382
|
+
output = keys.map(function (key) {
|
|
2383
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array)
|
|
2384
|
+
})
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
ctx.seen.pop()
|
|
2388
|
+
|
|
2389
|
+
return reduceToSingleString(output, base, braces)
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
function formatPrimitive (ctx, value) {
|
|
2393
|
+
if (isUndefined(value)) { return ctx.stylize('undefined', 'undefined') }
|
|
2394
|
+
if (isString(value)) {
|
|
2395
|
+
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
|
2396
|
+
.replace(/'/g, "\\'")
|
|
2397
|
+
.replace(/\\"/g, '"') + '\''
|
|
2398
|
+
return ctx.stylize(simple, 'string')
|
|
2399
|
+
}
|
|
2400
|
+
if (isNumber(value)) { return ctx.stylize('' + value, 'number') }
|
|
2401
|
+
if (isBoolean(value)) { return ctx.stylize('' + value, 'boolean') }
|
|
2402
|
+
// For some reason typeof null is "object", so special case here.
|
|
2403
|
+
if (isNull(value)) { return ctx.stylize('null', 'null') }
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
function formatError (value) {
|
|
2407
|
+
return '[' + Error.prototype.toString.call(value) + ']'
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
function formatArray (ctx, value, recurseTimes, visibleKeys, keys) {
|
|
2411
|
+
var output = []
|
|
2412
|
+
for (var i = 0, l = value.length; i < l; ++i) {
|
|
2413
|
+
if (hasOwnProperty(value, String(i))) {
|
|
2414
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
2415
|
+
String(i), true))
|
|
2416
|
+
} else {
|
|
2417
|
+
output.push('')
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
keys.forEach(function (key) {
|
|
2421
|
+
if (!key.match(/^\d+$/)) {
|
|
2422
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
2423
|
+
key, true))
|
|
2424
|
+
}
|
|
2425
|
+
})
|
|
2426
|
+
return output
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
function formatProperty (ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
2430
|
+
var name, str, desc
|
|
2431
|
+
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }
|
|
2432
|
+
if (desc.get) {
|
|
2433
|
+
if (desc.set) {
|
|
2434
|
+
str = ctx.stylize('[Getter/Setter]', 'special')
|
|
2435
|
+
} else {
|
|
2436
|
+
str = ctx.stylize('[Getter]', 'special')
|
|
2437
|
+
}
|
|
2438
|
+
} else {
|
|
2439
|
+
if (desc.set) {
|
|
2440
|
+
str = ctx.stylize('[Setter]', 'special')
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
2444
|
+
name = '[' + key + ']'
|
|
2445
|
+
}
|
|
2446
|
+
if (!str) {
|
|
2447
|
+
if (ctx.seen.indexOf(desc.value) < 0) {
|
|
2448
|
+
if (isNull(recurseTimes)) {
|
|
2449
|
+
str = formatValue(ctx, desc.value, null)
|
|
2450
|
+
} else {
|
|
2451
|
+
str = formatValue(ctx, desc.value, recurseTimes - 1)
|
|
2452
|
+
}
|
|
2453
|
+
if (str.indexOf('\n') > -1) {
|
|
2454
|
+
if (array) {
|
|
2455
|
+
str = str.split('\n').map(function (line) {
|
|
2456
|
+
return ' ' + line
|
|
2457
|
+
}).join('\n').slice(2)
|
|
2458
|
+
} else {
|
|
2459
|
+
str = '\n' + str.split('\n').map(function (line) {
|
|
2460
|
+
return ' ' + line
|
|
2461
|
+
}).join('\n')
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
} else {
|
|
2465
|
+
str = ctx.stylize('[Circular]', 'special')
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
if (isUndefined(name)) {
|
|
2469
|
+
if (array && key.match(/^\d+$/)) {
|
|
2470
|
+
return str
|
|
2471
|
+
}
|
|
2472
|
+
name = JSON.stringify('' + key)
|
|
2473
|
+
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
|
2474
|
+
name = name.slice(1, -1)
|
|
2475
|
+
name = ctx.stylize(name, 'name')
|
|
2476
|
+
} else {
|
|
2477
|
+
name = name.replace(/'/g, "\\'")
|
|
2478
|
+
.replace(/\\"/g, '"')
|
|
2479
|
+
.replace(/(^"|"$)/g, "'")
|
|
2480
|
+
name = ctx.stylize(name, 'string')
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
return name + ': ' + str
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
function reduceToSingleString (output, base, braces) {
|
|
2488
|
+
var numLinesEst = 0
|
|
2489
|
+
var length = output.reduce(function (prev, cur) {
|
|
2490
|
+
numLinesEst++
|
|
2491
|
+
if (cur.indexOf('\n') >= 0) numLinesEst++
|
|
2492
|
+
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1
|
|
2493
|
+
}, 0)
|
|
2494
|
+
|
|
2495
|
+
if (length > 60) {
|
|
2496
|
+
return braces[0] +
|
|
2497
|
+
(base === '' ? '' : base + '\n ') +
|
|
2498
|
+
' ' +
|
|
2499
|
+
output.join(',\n ') +
|
|
2500
|
+
' ' +
|
|
2501
|
+
braces[1]
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
2508
|
+
// because it is fragile and can be easily faked with `Object.create()`.
|
|
2509
|
+
exports.types = require('./support/types')
|
|
2510
|
+
|
|
2511
|
+
function isArray (ar) {
|
|
2512
|
+
return Array.isArray(ar)
|
|
2513
|
+
}
|
|
2514
|
+
exports.isArray = isArray
|
|
2515
|
+
|
|
2516
|
+
function isBoolean (arg) {
|
|
2517
|
+
return typeof arg === 'boolean'
|
|
2518
|
+
}
|
|
2519
|
+
exports.isBoolean = isBoolean
|
|
2520
|
+
|
|
2521
|
+
function isNull (arg) {
|
|
2522
|
+
return arg === null
|
|
2523
|
+
}
|
|
2524
|
+
exports.isNull = isNull
|
|
2525
|
+
|
|
2526
|
+
function isNullOrUndefined (arg) {
|
|
2527
|
+
return arg == null
|
|
2528
|
+
}
|
|
2529
|
+
exports.isNullOrUndefined = isNullOrUndefined
|
|
2530
|
+
|
|
2531
|
+
function isNumber (arg) {
|
|
2532
|
+
return typeof arg === 'number'
|
|
2533
|
+
}
|
|
2534
|
+
exports.isNumber = isNumber
|
|
2535
|
+
|
|
2536
|
+
function isString (arg) {
|
|
2537
|
+
return typeof arg === 'string'
|
|
2538
|
+
}
|
|
2539
|
+
exports.isString = isString
|
|
2540
|
+
|
|
2541
|
+
function isSymbol (arg) {
|
|
2542
|
+
return typeof arg === 'symbol'
|
|
2543
|
+
}
|
|
2544
|
+
exports.isSymbol = isSymbol
|
|
2545
|
+
|
|
2546
|
+
function isUndefined (arg) {
|
|
2547
|
+
return arg === void 0
|
|
2548
|
+
}
|
|
2549
|
+
exports.isUndefined = isUndefined
|
|
2550
|
+
|
|
2551
|
+
function isRegExp (re) {
|
|
2552
|
+
return isObject(re) && objectToString(re) === '[object RegExp]'
|
|
2553
|
+
}
|
|
2554
|
+
exports.isRegExp = isRegExp
|
|
2555
|
+
exports.types.isRegExp = isRegExp
|
|
2556
|
+
|
|
2557
|
+
function isObject (arg) {
|
|
2558
|
+
return typeof arg === 'object' && arg !== null
|
|
2559
|
+
}
|
|
2560
|
+
exports.isObject = isObject
|
|
2561
|
+
|
|
2562
|
+
function isDate (d) {
|
|
2563
|
+
return isObject(d) && objectToString(d) === '[object Date]'
|
|
2564
|
+
}
|
|
2565
|
+
exports.isDate = isDate
|
|
2566
|
+
exports.types.isDate = isDate
|
|
2567
|
+
|
|
2568
|
+
function isError (e) {
|
|
2569
|
+
return isObject(e) &&
|
|
2570
|
+
(objectToString(e) === '[object Error]' || e instanceof Error)
|
|
2571
|
+
}
|
|
2572
|
+
exports.isError = isError
|
|
2573
|
+
exports.types.isNativeError = isError
|
|
2574
|
+
|
|
2575
|
+
function isFunction (arg) {
|
|
2576
|
+
return typeof arg === 'function'
|
|
2577
|
+
}
|
|
2578
|
+
exports.isFunction = isFunction
|
|
2579
|
+
|
|
2580
|
+
function isPrimitive (arg) {
|
|
2581
|
+
return arg === null ||
|
|
2582
|
+
typeof arg === 'boolean' ||
|
|
2583
|
+
typeof arg === 'number' ||
|
|
2584
|
+
typeof arg === 'string' ||
|
|
2585
|
+
typeof arg === 'symbol' || // ES6 symbol
|
|
2586
|
+
typeof arg === 'undefined'
|
|
2587
|
+
}
|
|
2588
|
+
exports.isPrimitive = isPrimitive
|
|
2589
|
+
|
|
2590
|
+
exports.isBuffer = require('./support/isBuffer')
|
|
2591
|
+
|
|
2592
|
+
function objectToString (o) {
|
|
2593
|
+
return Object.prototype.toString.call(o)
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
function pad (n) {
|
|
2597
|
+
return n < 10 ? '0' + n.toString(10) : n.toString(10)
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
|
2601
|
+
'Oct', 'Nov', 'Dec']
|
|
2602
|
+
|
|
2603
|
+
// 26 Feb 16:19:34
|
|
2604
|
+
function timestamp () {
|
|
2605
|
+
var d = new Date()
|
|
2606
|
+
var time = [pad(d.getHours()),
|
|
2607
|
+
pad(d.getMinutes()),
|
|
2608
|
+
pad(d.getSeconds())].join(':')
|
|
2609
|
+
return [d.getDate(), months[d.getMonth()], time].join(' ')
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
// log is just a thin wrapper to console.log that prepends a timestamp
|
|
2613
|
+
exports.log = function () {
|
|
2614
|
+
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments))
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* Inherit the prototype methods from one constructor into another.
|
|
2619
|
+
*
|
|
2620
|
+
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
|
2621
|
+
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
|
2622
|
+
* during bootstrapping this function needs to be rewritten using some native
|
|
2623
|
+
* functions as prototype setup using normal JavaScript does not work as
|
|
2624
|
+
* expected during bootstrapping (see mirror.js in r114903).
|
|
2625
|
+
*
|
|
2626
|
+
* @param {function} ctor Constructor function which needs to inherit the
|
|
2627
|
+
* prototype.
|
|
2628
|
+
* @param {function} superCtor Constructor function to inherit prototype from.
|
|
2629
|
+
*/
|
|
2630
|
+
exports.inherits = require('inherits')
|
|
2631
|
+
|
|
2632
|
+
exports._extend = function (origin, add) {
|
|
2633
|
+
// Don't do anything if add isn't an object
|
|
2634
|
+
if (!add || !isObject(add)) return origin
|
|
2635
|
+
|
|
2636
|
+
var keys = Object.keys(add)
|
|
2637
|
+
var i = keys.length
|
|
2638
|
+
while (i--) {
|
|
2639
|
+
origin[keys[i]] = add[keys[i]]
|
|
2640
|
+
}
|
|
2641
|
+
return origin
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
function hasOwnProperty (obj, prop) {
|
|
2645
|
+
return Object.prototype.hasOwnProperty.call(obj, prop)
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined
|
|
2649
|
+
|
|
2650
|
+
exports.promisify = function promisify (original) {
|
|
2651
|
+
if (typeof original !== 'function') { throw new TypeError('The "original" argument must be of type Function') }
|
|
2652
|
+
|
|
2653
|
+
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
|
2654
|
+
var fn = original[kCustomPromisifiedSymbol]
|
|
2655
|
+
if (typeof fn !== 'function') {
|
|
2656
|
+
throw new TypeError('The "util.promisify.custom" argument must be of type Function')
|
|
2657
|
+
}
|
|
2658
|
+
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
|
2659
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
|
2660
|
+
})
|
|
2661
|
+
return fn
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
function fn () {
|
|
2665
|
+
var promiseResolve, promiseReject
|
|
2666
|
+
var promise = new Promise(function (resolve, reject) {
|
|
2667
|
+
promiseResolve = resolve
|
|
2668
|
+
promiseReject = reject
|
|
2669
|
+
})
|
|
2670
|
+
|
|
2671
|
+
var args = []
|
|
2672
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2673
|
+
args.push(arguments[i])
|
|
2674
|
+
}
|
|
2675
|
+
args.push(function (err, value) {
|
|
2676
|
+
if (err) {
|
|
2677
|
+
promiseReject(err)
|
|
2678
|
+
} else {
|
|
2679
|
+
promiseResolve(value)
|
|
2680
|
+
}
|
|
2681
|
+
})
|
|
2682
|
+
|
|
2683
|
+
try {
|
|
2684
|
+
original.apply(this, args)
|
|
2685
|
+
} catch (err) {
|
|
2686
|
+
promiseReject(err)
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
return promise
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
Object.setPrototypeOf(fn, Object.getPrototypeOf(original))
|
|
2693
|
+
|
|
2694
|
+
if (kCustomPromisifiedSymbol) {
|
|
2695
|
+
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
|
2696
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
|
2697
|
+
})
|
|
2698
|
+
}
|
|
2699
|
+
return Object.defineProperties(
|
|
2700
|
+
fn,
|
|
2701
|
+
getOwnPropertyDescriptors(original)
|
|
2702
|
+
)
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
exports.promisify.custom = kCustomPromisifiedSymbol
|
|
2706
|
+
|
|
2707
|
+
function callbackifyOnRejected (reason, cb) {
|
|
2708
|
+
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
|
|
2709
|
+
// Because `null` is a special error value in callbacks which means "no error
|
|
2710
|
+
// occurred", we error-wrap so the callback consumer can distinguish between
|
|
2711
|
+
// "the promise rejected with null" or "the promise fulfilled with undefined".
|
|
2712
|
+
if (!reason) {
|
|
2713
|
+
var newReason = new Error('Promise was rejected with a falsy value')
|
|
2714
|
+
newReason.reason = reason
|
|
2715
|
+
reason = newReason
|
|
2716
|
+
}
|
|
2717
|
+
return cb(reason)
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
function callbackify (original) {
|
|
2721
|
+
if (typeof original !== 'function') {
|
|
2722
|
+
throw new TypeError('The "original" argument must be of type Function')
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
// We DO NOT return the promise as it gives the user a false sense that
|
|
2726
|
+
// the promise is actually somehow related to the callback's execution
|
|
2727
|
+
// and that the callback throwing will reject the promise.
|
|
2728
|
+
function callbackified () {
|
|
2729
|
+
var args = []
|
|
2730
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2731
|
+
args.push(arguments[i])
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
var maybeCb = args.pop()
|
|
2735
|
+
if (typeof maybeCb !== 'function') {
|
|
2736
|
+
throw new TypeError('The last argument must be of type Function')
|
|
2737
|
+
}
|
|
2738
|
+
var self = this
|
|
2739
|
+
var cb = function () {
|
|
2740
|
+
return maybeCb.apply(self, arguments)
|
|
2741
|
+
}
|
|
2742
|
+
// In true node style we process the callback on `nextTick` with all the
|
|
2743
|
+
// implications (stack, `uncaughtException`, `async_hooks`)
|
|
2744
|
+
original.apply(this, args)
|
|
2745
|
+
.then(function (ret) { process.nextTick(cb.bind(null, null, ret)) },
|
|
2746
|
+
function (rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) })
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original))
|
|
2750
|
+
Object.defineProperties(callbackified,
|
|
2751
|
+
getOwnPropertyDescriptors(original))
|
|
2752
|
+
return callbackified
|
|
2753
|
+
}
|
|
2754
|
+
exports.callbackify = callbackify
|
|
2755
|
+
}).call(this)
|
|
2756
|
+
}).call(this, require('_process'))
|
|
2757
|
+
}, { './support/isBuffer': 36, './support/types': 37, _process: 34, inherits: 29 }],
|
|
2758
|
+
39: [function (require, module, exports) {
|
|
2759
|
+
(function (global) {
|
|
2760
|
+
(function () {
|
|
2761
|
+
'use strict'
|
|
2762
|
+
|
|
2763
|
+
var forEach = require('for-each')
|
|
2764
|
+
var availableTypedArrays = require('available-typed-arrays')
|
|
2765
|
+
var callBind = require('call-bind')
|
|
2766
|
+
var callBound = require('call-bind/callBound')
|
|
2767
|
+
var gOPD = require('gopd')
|
|
2768
|
+
|
|
2769
|
+
var $toString = callBound('Object.prototype.toString')
|
|
2770
|
+
var hasToStringTag = require('has-tostringtag/shams')()
|
|
2771
|
+
|
|
2772
|
+
var g = typeof globalThis === 'undefined' ? global : globalThis
|
|
2773
|
+
var typedArrays = availableTypedArrays()
|
|
2774
|
+
|
|
2775
|
+
var $slice = callBound('String.prototype.slice')
|
|
2776
|
+
var getPrototypeOf = Object.getPrototypeOf // require('getprototypeof');
|
|
2777
|
+
|
|
2778
|
+
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf (array, value) {
|
|
2779
|
+
for (var i = 0; i < array.length; i += 1) {
|
|
2780
|
+
if (array[i] === value) {
|
|
2781
|
+
return i
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
return -1
|
|
2785
|
+
}
|
|
2786
|
+
var cache = { __proto__: null }
|
|
2787
|
+
if (hasToStringTag && gOPD && getPrototypeOf) {
|
|
2788
|
+
forEach(typedArrays, function (typedArray) {
|
|
2789
|
+
var arr = new g[typedArray]()
|
|
2790
|
+
if (Symbol.toStringTag in arr) {
|
|
2791
|
+
var proto = getPrototypeOf(arr)
|
|
2792
|
+
var descriptor = gOPD(proto, Symbol.toStringTag)
|
|
2793
|
+
if (!descriptor) {
|
|
2794
|
+
var superProto = getPrototypeOf(proto)
|
|
2795
|
+
descriptor = gOPD(superProto, Symbol.toStringTag)
|
|
2796
|
+
}
|
|
2797
|
+
cache['$' + typedArray] = callBind(descriptor.get)
|
|
2798
|
+
}
|
|
2799
|
+
})
|
|
2800
|
+
} else {
|
|
2801
|
+
forEach(typedArrays, function (typedArray) {
|
|
2802
|
+
var arr = new g[typedArray]()
|
|
2803
|
+
var fn = arr.slice || arr.set
|
|
2804
|
+
if (fn) {
|
|
2805
|
+
cache['$' + typedArray] = callBind(fn)
|
|
2806
|
+
}
|
|
2807
|
+
})
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
var tryTypedArrays = function tryAllTypedArrays (value) {
|
|
2811
|
+
var found = false
|
|
2812
|
+
forEach(cache, function (getter, typedArray) {
|
|
2813
|
+
if (!found) {
|
|
2814
|
+
try {
|
|
2815
|
+
if ('$' + getter(value) === typedArray) {
|
|
2816
|
+
found = $slice(typedArray, 1)
|
|
2817
|
+
}
|
|
2818
|
+
} catch (e) { /**/ }
|
|
2819
|
+
}
|
|
2820
|
+
})
|
|
2821
|
+
return found
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
var trySlices = function tryAllSlices (value) {
|
|
2825
|
+
var found = false
|
|
2826
|
+
forEach(cache, function (getter, name) {
|
|
2827
|
+
if (!found) {
|
|
2828
|
+
try {
|
|
2829
|
+
getter(value)
|
|
2830
|
+
found = $slice(name, 1)
|
|
2831
|
+
} catch (e) { /**/ }
|
|
2832
|
+
}
|
|
2833
|
+
})
|
|
2834
|
+
return found
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
module.exports = function whichTypedArray (value) {
|
|
2838
|
+
if (!value || typeof value !== 'object') { return false }
|
|
2839
|
+
if (!hasToStringTag) {
|
|
2840
|
+
var tag = $slice($toString(value), 8, -1)
|
|
2841
|
+
if ($indexOf(typedArrays, tag) > -1) {
|
|
2842
|
+
return tag
|
|
2843
|
+
}
|
|
2844
|
+
if (tag !== 'Object') {
|
|
2845
|
+
return false
|
|
2846
|
+
}
|
|
2847
|
+
// node < 0.6 hits here on real Typed Arrays
|
|
2848
|
+
return trySlices(value)
|
|
2849
|
+
}
|
|
2850
|
+
if (!gOPD) { return null } // unknown engine
|
|
2851
|
+
return tryTypedArrays(value)
|
|
2852
|
+
}
|
|
2853
|
+
}).call(this)
|
|
2854
|
+
}).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {})
|
|
2855
|
+
}, { 'available-typed-arrays': 13, 'call-bind': 16, 'call-bind/callBound': 15, 'for-each': 18, gopd: 22, 'has-tostringtag/shams': 27 }]
|
|
2856
|
+
}, {}, [12])
|