How to use the optionalArrayOfString function from assert-plus

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

541
542
543
544
545
546
547
548
549
550
assert.object(options.log, 'options.log');
assert.optionalString(options.url, 'options.url');
assert.optionalString(options.socketPath, 'options.socketPath');
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,
fork icon41
star icon75
watch icon0

98
99
100
101
102
103
104
105
106
107
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');

var idField = opts.idField;

var differ = function (a, b) {
fork icon38
star icon55
watch icon0

109
110
111
112
113
114
115
116
117
118
119
120
function CloudApi(options) {
    assert.object(options, 'options');
    assert.string(options.url, 'options.url');
    assert.string(options.account, 'options.account');


    assert.optionalArrayOfString(options.roles, 'options.roles');
    assert.optionalString(options.version, 'options.version');
    assert.optionalObject(options.log, 'options.log');


    assert.optionalObject(options.principal, 'options.principal');
fork icon38
star icon55
watch icon0

+ 20 other calls in file

1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
if (obj.ipv4_ips) {
    obj.ipv4_ips = obj.ipv4_ips.split('|');
}

assert.uuid(obj.ipv4_uuid, 'obj.ipv4_uuid');
assert.optionalArrayOfString(obj.ipv4_ips, 'obj.ipv4_ips');

/*
 * Only 1 IP address may be specified at this time.  In the future, this
 * limitation should be removed.
fork icon38
star icon55
watch icon41

261
262
263
264
265
266
267
268
269
270
 */
function _getToken(opts, cb) {
    assert.string(opts.indexName, 'opts.indexName'); // used for error messages
    assert.string(opts.realm, 'opts.realm');
    assert.optionalString(opts.service, 'opts.service');
    assert.optionalArrayOfString(opts.scopes, 'opts.scopes');
    assert.optionalString(opts.username, 'opts.username');
    assert.optionalString(opts.password, 'opts.password');
    // HTTP client opts:
    assert.object(opts.log, 'opts.log');
fork icon35
star icon59
watch icon0

515
516
517
518
519
520
521
522
523
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

1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
var nnoprobegroup = 0;
var nbadprobegroup = 0;

assertplus.object(args, 'args');
assertplus.object(args.stream, 'args.stream');
assertplus.optionalArrayOfString(args.columns, 'args.columns');
assertplus.bool(args.omitHeader, 'args.omitHeader');

assertplus.notStrictEqual(
    this.ma_amon_deployed,
fork icon13
star icon7
watch icon42

+ 7 other calls in file

2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
 *        without making them.
 * @param cb {Function} `function (err)`
 */
IMGADM.prototype.updateImages = function updateImages(opts, cb) {
    assert.object(opts, 'opts');
    assert.optionalArrayOfString(opts.uuids, 'opts.uuids');
    assert.optionalBool(opts.dryRun, 'opts.dryRun');
    assert.func(cb, 'cb');
    var self = this;
    var updateErrs = [];
fork icon248
star icon0
watch icon0

1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
assert.object(opts.imgJson, 'opts.imgJson');
assert.object(opts.repo, 'opts.repo');
assert.string(opts.repo.localName, 'opts.repo.localName');
assert.optionalString(opts.uuid, 'opts.uuid');
assert.optionalString(opts.owner, 'opts.owner');
assert.optionalArrayOfString(opts.tags, 'opts.tags'); // docker repo tags
assert.optionalBool(opts.public, 'opts.public');
assert.optionalString(opts.origin, 'opts.origin');

var digest = opts.layerDigests[opts.layerDigests.length - 1];
fork icon5
star icon2
watch icon0

285
286
287
288
289
290
291
292
293
294
signRequest: function signRequest(request, options) {
  assert.object(request, 'request');
  assert.object(options, 'options');
  assert.optionalString(options.algorithm, 'options.algorithm');
  assert.string(options.keyId, 'options.keyId');
  assert.optionalArrayOfString(options.headers, 'options.headers');
  assert.optionalString(options.httpVersion, 'options.httpVersion');

  if (!request.getHeader('Date'))
    request.setHeader('Date', jsprim.rfc1123(new Date()));
fork icon1
star icon0
watch icon0

289
290
291
292
293
294
295
296
297
298
}
assert.ok(optionTypes[o.type],
    format('invalid config.options.%d.type: "%s" in %j',
           i, o.type, o));
assert.optionalString(o.name, format('config.options.%d.name', i));
assert.optionalArrayOfString(o.names,
    format('config.options.%d.names', i));
assert.ok((o.name || o.names) && !(o.name && o.names),
    format('exactly one of "name" or "names" required: %j', o));
assert.optionalString(o.help, format('config.options.%d.help', i));
fork icon0
star icon0
watch icon1

+ 69 other calls in file