How to use the func function from assert-plus

Find comprehensive JavaScript assert-plus.func code examples handpicked from public code repositorys.

94
95
96
97
98
99
100
101
102
103
104
 * account, and has an 'external' nic tag.
 */
function findOwnerExternalNetwork(api, cfg) {
    assert.object(api, 'api');
    assert.object(api.log, 'api.log');
    assert.func(api.getNapiNetworksForAccount, 'api.getNapiNetworksForAccount');
    assert.object(cfg, 'cfg');
    assert.arrayOfUuid(cfg.accounts, 'cfg.accounts');


    var log = api.log;
fork icon49
star icon183
watch icon0

424
425
426
427
428
429
430
431
432
433
434
435
436




function readError(err, res, cb) {
    assert.object(err);
    assert.optionalObject(res);
    assert.func(cb);


    if (res === null)
        return (cb(null, err, res));

fork icon41
star icon75
watch icon0

+ 61 other calls in file

890
891
892
893
894
895
896
897
898
899
900
901
902
    self.emit('close');
};




PGPool.prototype.pg = function checkout(callback) {
    assert.func(callback, 'callback');


    var log = this.log;
    var stats = this.pool.getStats();

fork icon21
star icon60
watch icon0

+ 9 other calls in file

31
32
33
34
35
36
37
38
39
40
41
42
43


// ---- internal support stuff


function _rbacStateBasics(ctx, cb) {
    assert.object(ctx.cloudapi, 'ctx.cloudapi');
    assert.func(cb, 'cb');


    vasync.parallel({funcs: [
        function listUsers(next) {
            ctx.cloudapi.listUsers(function (err, users) {
fork icon38
star icon55
watch icon0

173
174
175
176
177
178
179
180
181
182
183
 * testing.
 *
 */
function ntpqCli(args, callback) {
    mod_assert.array(args, 'args');
    mod_assert.func(callback, 'callback');


    forkExecWait({
        'argv': [NTPQ].concat(args)
    }, function _processNtpOutput(err, data) {
fork icon8
star icon3
watch icon0

+ 5 other calls in file

1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
function _dispatchEvent(evtName, zonename, vmobj, opts, handler) {
    assert.string(evtName, 'evtName');
    assert.uuid(zonename, 'vmobj.zonename');
    assert.object(vmobj, 'vmobj');
    assert.object(opts, 'opts');
    assert.func(handler, 'handler');


    if (evtName === 'modify') {
        assert.arrayOfObject(opts.changes, 'opts.changes');
    }
fork icon3
star icon3
watch icon0

+ 3 other calls in file

1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
assert.func(cb, 'cb');
assert.object(opts, 'opts');
assert.object(opts.source, 'opts.source');
assert.optionalObject(opts.bar, 'opts.bar');
assert.optionalBool(opts.zstream, 'opts.zstream');
assert.func(opts.logCb, 'opts.logCb');
// As from `source.getImportInfo`.
assert.object(opts.importInfo, 'opts.importInfo');
// As from `source.getImgMeta`.
assert.object(opts.imgMeta, 'opts.imgMeta');
fork icon248
star icon0
watch icon0

+ 49 other calls in file

122
123
124
125
126
127
128
129
130
131
    this.principal.account = options.account;
    assert.optionalString(options.user, 'options.user');
    if (options.user !== undefined) {
        this.principal.user = options.user;
    }
    assert.func(options.sign, 'options.sign');
    this.principal.sign = options.sign;
} else {
    assert.string(this.principal.account, 'principal.account');
    assert.object(this.principal.keyPair, 'principal.keyPair');
fork icon38
star icon55
watch icon0

+ 692 other calls in file

198
199
200
201
202
203
204
205
206
207
208
209


function _releaseTicketAndSendResponse(ticket, req, res, next, error) {
    assert.object(ticket, 'ticket');
    assert.object(req, 'req');
    assert.object(res, 'res');
    assert.func(next, 'next');
    assert.optionalObject(error, 'error');


    if (ticket !== undefined) {
        _releaseVolumeTicket(ticket, {
fork icon6
star icon8
watch icon0

+ 55 other calls in file

950
951
952
953
954
955
956
957
958
959

assertplus.object(args, 'args');
assertplus.object(args, 'args.sources');
assertplus.number(args.concurrency, 'args.concurrency');
assertplus.string(args.configFile, 'args.configFile');
assertplus.func(callback, 'callback');
assertplus.strictEqual(this.ma_alarms, null);
assertplus.strictEqual(this.ma_amon_deployed, null);
assertplus.strictEqual(this.ma_alarm_metadata, null);
assertplus.strictEqual(this.ma_maint_windows, null);
fork icon13
star icon7
watch icon42

+ 10 other calls in file

151
152
153
154
155
156
157
158
159
160
     */
    for (idx = 0; idx < migrationsForBucket.length; ++idx) {
        assert.equal(migrationsForBucket[idx].DATA_VERSION,
            expectedDataVersion, 'Data version of migration ' + (idx + 1) +
                ' should be ' + expectedDataVersion);
        assert.func(migrationsForBucket[idx].migrateRecord,
                'migrationsForBucket[' + idx + '].migrateRecord');
        ++expectedDataVersion;
    }
}
fork icon20
star icon11
watch icon0

+ 11 other calls in file

1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
    checkResJobsQueue.close();
}

function checkReservation(volReservationValue, done) {
    mod_assert.object(volReservationValue, 'volReservationValue');
    mod_assert.func(done, 'done');

    checkReservationJob(volReservationValue, {
        log: log,
        wfApiClient: wfApiClient,
fork icon6
star icon8
watch icon0

+ 21 other calls in file

163
164
165
166
167
168
169
170
171
172
173
174
        callback();
    });
};


MetricsManager.prototype.addPreCollectFunc = function addPreCollectFunc(func) {
    assert.func(func, 'func');


    this.preCollectFuncs.push(func);
};

fork icon3
star icon0
watch icon0

+ 3 other calls in file

131
132
133
134
135
136
137
138
139
140

var toValidate = [];

if (opts.required) {
    for (field in opts.required) {
        assert.func(opts.required[field],
            fmt('opts.required[%s]', field));

        if (params.hasOwnProperty(field)) {
            toValidate.push({
fork icon1
star icon0
watch icon0

+ 5 other calls in file

69
70
71
72
73
74
75
76
77
78
 * @instance
 * @param {Function} handler - handler
 * @returns {undefined} no return value
 */
Chain.prototype.add = function add(handler) {
    assert.func(handler);
    var handlerId = handler._identifier || handler._name || handler.name;
    if (handler.length <= 2) {
        // arity <= 2, must be AsyncFunction
        assert.equal(
fork icon0
star icon2
watch icon0

975
976
977
978
979
980
981
982
983
984
assert.string(optionType.name, 'optionType.name');
assert.bool(optionType.takesArg, 'optionType.takesArg');
if (optionType.takesArg) {
    assert.string(optionType.helpArg, 'optionType.helpArg');
}
assert.func(optionType.parseArg, 'optionType.parseArg');
assert.optionalBool(optionType.array, 'optionType.array');
assert.optionalBool(optionType.arrayFlatten, 'optionType.arrayFlatten');

optionTypes[optionType.name] = {
fork icon0
star icon0
watch icon1

+ 9 other calls in file