Skip to content

Commit b2bf6c8

Browse files
TrottMylesBorins
authored andcommitted
test,lib,doc: use function declarations
Replace function expressions with function declarations in preparation for a lint rule requiring function declarations. Backport-PR-URL: #19447 PR-URL: #12711 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 5d2afb2 commit b2bf6c8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

test/addons-napi/test_async/test.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const test_async = require(`./build/${common.buildType}/test_async`);
66
test_async.Test(5, common.mustCall(function(err, val) {
77
assert.strictEqual(err, null);
88
assert.strictEqual(val, 10);
9-
process.nextTick(common.mustCall(function() {}));
9+
process.nextTick(common.mustCall());
1010
}));
1111

12-
const cancelSuceeded = function() {};
13-
test_async.TestCancel(common.mustCall(cancelSuceeded));
12+
test_async.TestCancel(common.mustCall());

test/addons-napi/test_exception/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ const common = require('../../common');
44
const test_exception = require(`./build/${common.buildType}/test_exception`);
55
const assert = require('assert');
66
const theError = new Error('Some error');
7-
const throwTheError = function() {
7+
function throwTheError() {
88
throw theError;
9-
};
9+
}
1010
let caughtError;
1111

12-
const throwNoError = function() {};
12+
const throwNoError = common.noop;
1313

1414
// Test that the native side successfully captures the exception
1515
let returnedError = test_exception.returnException(throwTheError);

test/addons-napi/test_instanceof/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ if (typeof Symbol !== 'undefined' && 'hasInstance' in Symbol &&
5757
(theObject instanceof theConstructor));
5858
}
5959

60-
const MyClass = function MyClass() {};
60+
function MyClass() {}
6161
Object.defineProperty(MyClass, Symbol.hasInstance, {
6262
value: function(candidate) {
6363
return 'mark' in candidate;
6464
}
6565
});
6666

67-
const MySubClass = function MySubClass() {};
67+
function MySubClass() {}
6868
MySubClass.prototype = new MyClass();
6969

7070
let x = new MySubClass();

0 commit comments

Comments
 (0)