Skip to content

Commit

Permalink
test,lib,doc: use function declarations
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and MylesBorins committed Apr 16, 2018
1 parent 5d2afb2 commit b2bf6c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions test/addons-napi/test_async/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const test_async = require(`./build/${common.buildType}/test_async`);
test_async.Test(5, common.mustCall(function(err, val) {
assert.strictEqual(err, null);
assert.strictEqual(val, 10);
process.nextTick(common.mustCall(function() {}));
process.nextTick(common.mustCall());
}));

const cancelSuceeded = function() {};
test_async.TestCancel(common.mustCall(cancelSuceeded));
test_async.TestCancel(common.mustCall());
6 changes: 3 additions & 3 deletions test/addons-napi/test_exception/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const common = require('../../common');
const test_exception = require(`./build/${common.buildType}/test_exception`);
const assert = require('assert');
const theError = new Error('Some error');
const throwTheError = function() {
function throwTheError() {
throw theError;
};
}
let caughtError;

const throwNoError = function() {};
const throwNoError = common.noop;

// Test that the native side successfully captures the exception
let returnedError = test_exception.returnException(throwTheError);
Expand Down
4 changes: 2 additions & 2 deletions test/addons-napi/test_instanceof/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ if (typeof Symbol !== 'undefined' && 'hasInstance' in Symbol &&
(theObject instanceof theConstructor));
}

const MyClass = function MyClass() {};
function MyClass() {}
Object.defineProperty(MyClass, Symbol.hasInstance, {
value: function(candidate) {
return 'mark' in candidate;
}
});

const MySubClass = function MySubClass() {};
function MySubClass() {}
MySubClass.prototype = new MyClass();

let x = new MySubClass();
Expand Down

0 comments on commit b2bf6c8

Please sign in to comment.