How to use the optionalArrayOfObject function from assert-plus

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

514
515
516
517
518
519
520
521
522
523
function createRoles(ctx, next) {
    vasync.forEachPipeline({
        inputs: ctx.rolesToCreate,
        func: function createOne(role, nextRole) {
            assert.string(role.name, 'role.name');
            assert.optionalArrayOfObject(role.members, 'role.members');
            assert.optionalArrayOfString(role.default_members,
                'role.default_members');
            assert.optionalArray(role.policies,
                'role.policies');
fork icon16
star icon13
watch icon34

505
506
507
508
509
510
511
512
513
514
        done(getVolResErr);
    });
},
function createVolumeModel(ctx, done) {
    assert.object(ctx.ticket, 'ctx.ticket');
    assert.optionalArrayOfObject(ctx.volReservations,
        'ctx.volReservations');

    /*
     * If there are reservations for this volume, it means they were
fork icon6
star icon8
watch icon0

457
458
459
460
461
462
463
464
465
466
mod_vasync.pipeline({funcs: [
    function getVolumeForVm(ctx, next) {
        volumeModels.listVolumes({
            vm_uuid: vmUuid
        }, function onListVolumes(err, volumes) {
            mod_assert.optionalArrayOfObject(volumes, 'volumes');

            if (volumes && volumes.length > 0) {
                log.debug({volumes: volumes},
                    'VM is used as volume storage');
fork icon6
star icon8
watch icon0

+ 11 other calls in file

1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
IMGADM.prototype.sourcesGetImportInfo =
        function sourcesGetImportInfo(opts, cb) {
    var self = this;
    assert.object(opts, 'opts');
    assert.string(opts.arg, 'opts.arg');
    assert.optionalArrayOfObject(opts.sources, 'opts.sources');
    assert.optionalBool(opts.ensureActive, 'opts.ensureActive');
    assert.optionalString(opts.channel, 'opts.channel');
    var ensureActive = (opts.ensureActive === undefined
            ? true : opts.ensureActive);
fork icon248
star icon0
watch icon0

327
328
329
330
331
332
333
334
335
336
337
    assert.object(t, 't');
    assert.object(opts, 'opts');
    assert.optionalObject(opts.params, 'opts.params');
    assert.optionalObject(opts.expErr, 'opts.expErr');
    assert.optionalBool(opts.deepEqual, 'opts.deepEqual');
    assert.optionalArrayOfObject(opts.present, 'opts.present');
    assert.optionalFunc(callback, 'callback');
}


/**
fork icon6
star icon0
watch icon0