-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmod.js
More file actions
30 lines (26 loc) · 1.04 KB
/
mod.js
File metadata and controls
30 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2025 Datadog, Inc.
**/
const assert = require('assert');
function fetch_simple (url, cb) {
assert.strictEqual(this.this, 'this');
assert.strictEqual(url, 'https://example.com');
assert.strictEqual(cb.length, 2);
const result = cb.apply(this, ['arg1', 'arg2']);
assert.strictEqual(result, 'result');
return 'return';
}
function fetch_complex ({ url, tuple: [a = 'a', b = 'b'] }, cb, optional = 'default', ...rest) {
assert.strictEqual(this.this, 'this');
assert.strictEqual(url, 'https://example.com');
assert.strictEqual(a, 'a');
assert.strictEqual(b, 'b');
assert.strictEqual(cb.length, 2);
assert.strictEqual(optional, 'default');
assert.deepStrictEqual(rest, []);
const result = cb.apply(this, ['arg1', 'arg2']);
assert.strictEqual(result, 'result');
return 'return';
}
module.exports = { fetch_simple, fetch_complex };