How to use the optionalFunc function from assert-plus

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

172
173
174
175
176
177
178
179
180
181
assert.string(opts.func, 'options.func');
assert.finite(opts.parallel, 'options.parallel');
assert.string(opts.type, 'options.type');
assert.string(opts.user, 'options.user');
assert.string(opts.watch, 'options.watch');
assert.optionalFunc(callback, 'callback');

var queue = new manta.Queue({
    limit: opts.parallel,
    worker: function getJobData(id, cb) {
fork icon41
star icon75
watch icon0

+ 5 other calls in file

544
545
546
547
548
549
550
551
552
553
assert.optionalString(options.user, 'options.user');
assert.optionalString(options.subuser, 'options.subuser');
assert.optionalArrayOfString(options.role, 'options.role');
if (options.sign === null)
    delete (options.sign);
assert.optionalFunc(options.sign, 'options.sign');
assert.ok(options.url || options.socketPath,
          'one of options.url or options.socketPath is required');

EventEmitter.call(this);
fork icon41
star icon75
watch icon0

94
95
96
97
98
99
100
101
102
103
assert.string(opts.type, 'opts.type');
assert.optionalString(opts.desc, 'opts.desc');
assert.string(opts.idField, 'opts.idField');
assert.arrayOfObject(opts.have, 'opts.have');
assert.arrayOfObject(opts.want, 'opts.want');
assert.optionalFunc(opts.crudChangesForCreate, 'opts.crudChangesForCreate');
assert.optionalFunc(opts.crudChangesForDelete, 'opts.crudChangesForDelete');
assert.optionalFunc(opts.normThing, 'opts.normThing');
assert.optionalFunc(opts.crudChangesForUpdate, 'opts.crudChangesForUpdate');
assert.optionalArrayOfString(opts.compareFields, 'opts.compareFields');
fork icon38
star icon55
watch icon0

+ 3 other calls in file

153
154
155
156
157
158
159
160
161
162
assert.optionalObject(opts.profile, 'opts.profile');
assert.optionalString(opts.profileName, 'opts.profileName');
assert.optionalObject(opts.config, 'opts.config');
assert.optionalString(opts.configDir, 'opts.configDir');
assert.optionalObject(opts.log, 'opts.log');
assert.optionalFunc(opts.unlockKeyFn, 'opts.unlockKeyFn');
assert.func(cb, 'cb');

assert.ok(!(opts.profile && opts.profileName),
    'cannot specify both opts.profile and opts.profileName');
fork icon38
star icon55
watch icon0

1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
assert.object(opts.importInfo, 'opts.importInfo');
assert.object(opts.importInfo.source, 'opts.importInfo.source');
assert.string(opts.zpool, 'opts.zpool');
assert.optionalBool(opts.zstream, 'opts.zstream');
assert.optionalBool(opts.quiet, 'opts.quiet');
assert.optionalFunc(opts.logCb, 'opts.logCb');

var manifest = opts.importInfo.manifest;
if (manifest) {
    // Ensure this image is active.
fork icon248
star icon0
watch icon0

+ 5 other calls in file

612
613
614
615
616
617
618
619
620
621
assert.object(options, 'options');
assert.optionalBool(options.appendPath, 'options.appendPath');
assert.optionalObject(options.headers, 'options.headers');
assert.object(options.log, 'options.log');
assert.optionalObject(options.query, 'options.query');
assert.optionalFunc(options.signRequest, 'options.signRequest');
assert.optionalString(options.socketPath, 'options.socketPath');
assert.optionalString(options.url, 'options.url');
assert.optionalBool(options.followRedirects, 'options.followRedirects');
assert.optionalString(options.noProxy, 'options.noProxy');
fork icon34
star icon55
watch icon0

194
195
196
197
198
199
200
201
202
203
204
205
 * dummy version of the ntpq cli to verify that we're processing things
 * correctly.
 */
function NtpGetter(opts) {
    mod_assert.object(opts, 'opts');
    mod_assert.optionalFunc(opts.ntpqCli, 'opts.ntpqCli');


    var self = this;


    if (opts.ntpqCli === undefined) {
fork icon8
star icon3
watch icon0

32
33
34
35
36
37
38
39
40
assert.optionalBool(opts.keepExtensions, 'opts.keepExtensions');
assert.optionalString(opts.uploadDir, 'opts.uploadDir');
assert.optionalNumber(opts.maxFieldsSize, 'opts.maxFieldsSize');
assert.optionalString(opts.hash, 'opts.hash');
assert.optionalFunc(opts.multipartFileHandler, 'opts.multipartFileHandler');
assert.optionalFunc(opts.multipartHandler, 'opts.multipartHandler');
assert.optionalBool(opts.mapParams, 'opts.mapParams');
assert.optionalBool(opts.mapFiles, 'opts.mapFiles');
assert.optionalNumber(opts.maxFileSize, 'opts.maxFileSize');
fork icon0
star icon2
watch icon0

171
172
173
174
175
176
177
178
179
180
 */
function auditLogger(opts) {
    assert.object(opts, 'opts');
    assert.object(opts.log, 'opts.log');
    assert.string(opts.event, 'opts.event');
    assert.optionalFunc(opts.context, 'opts.context');
    assert.optionalObject(opts.server, 'opts.server');
    assert.optionalBool(opts.printLog, 'opts.printLog');
    assert.optionalObject(opts.serializers, 'opts.serializers');

fork icon0
star icon2
watch icon0

3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
assert.optionalString(options.compression, 'options.compression');
assert.optionalBool(options.incremental, 'options.incremental');
assert.optionalString(options.prepareScript, 'options.prepareScript');
assert.optionalNumber(options.prepareTimeout, 'options.prepareTimeout');
assert.optionalNumber(options.maxOriginDepth, 'options.maxOriginDepth');
assert.optionalFunc(options.vmGet, 'options.vmGet');

var log = self.log;
var vmUuid = options.vmUuid;
var incremental = options.incremental || false;
fork icon0
star icon0
watch icon0

+ 7 other calls in file