How to use the array function from assert-plus

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

75
76
77
78
79
80
81
82
83
84
/**
 * Validates that a value is one of the values present in an array that
 * enumerates all allowed values.
 */
function validateEnum(values) {
    assert.array(values, 'values');
    return function _validateEnum(_, name, value, callback) {
        if (values.indexOf(value) === -1) {
            callback(errors.invalidParam(name,
                'must be one of: ' + values.map(JSON.stringify).join(', ')));
fork icon14
star icon4
watch icon0

3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
 */
maAdm.prototype.layerServiceOnDeployedConfig = function(args) {
    var self, instances_per_cn;
    var selected_cns;


    assertplus.array(args.avoid_svcs, 'args.avoid_svcs');
    assertplus.string(args.image_uuid, 'args.image_uuid');
    assertplus.optionalNumber(args.max_cns, 'args.max_cns');
    assertplus.number(args.num_instances, 'args.num_instances');
    assertplus.object(args.outstream, 'args.outstream');
fork icon13
star icon7
watch icon42

172
173
174
175
176
177
178
179
180
181
182
 * function can be swapped out by a mock when creating a new NtpGetter for
 * testing.
 *
 */
function ntpqCli(args, callback) {
    mod_assert.array(args, 'args');
    mod_assert.func(callback, 'callback');


    forkExecWait({
        'argv': [NTPQ].concat(args)
fork icon8
star icon3
watch icon0