How to use the assert-plus.array function in assert-plus

To help you get started, we’ve selected a few assert-plus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix / nerror / lib / verror.js View on Github external
function parseConstructorArguments(args) {
    let options, sprintf_args, shortmessage, k;

    assert.object(args, 'args');
    assert.bool(args.strict, 'args.strict');
    assert.array(args.argv, 'args.argv');
    assert.optionalBool(args.skipPrintf, 'args.skipPrintf');
    const argv = args.argv;

    /*
     * First, figure out which form of invocation we've been given.
     */
    if (argv.length === 0) {
        options = {};
        sprintf_args = [];
    } else if (_.isError(argv[0])) {
        options = { cause: argv[0] };
        sprintf_args = argv.slice(1);
    } else if (typeof argv[0] === 'object') {
        options = {};
        // eslint-disable-next-line guard-for-in
        for (k in argv[0]) {
github DefinitelyTyped / DefinitelyTyped / assert-plus / assert-plus-tests.ts View on Github external
import * as assert from 'assert-plus';

const arr = ['one', 'two'];

assert.array(arr, '');
github joyent / moray / lib / objects / common.js View on Github external
function compileQuery(b, f, args) {
    assert.object(b, 'bucket');
    assert.string(b.name, 'bucket.name');
    assert.object(b.index, 'bucket.index');
    assert.bool(b.hasExtendedId, 'b.hasExtendedId');
    assert.object(f, 'query');
    assert.array(args, 'args');

    var clause = '';
    var i;
    var v;

    function _mapOp(direction) {
        var ltype, rtype, op;

        if (!jsprim.hasKey(b.index, f.attribute)) {
            throw new NotIndexedError(b.name, f.toString());
        }

        ltype = b.index[f.attribute].type;
        if (!jsprim.hasKey(TYPES, ltype)) {
            throw new InvalidQueryError(f.toString());
        }
github etiennepinchon / magixjs / compiler / node_modules / verror / lib / verror.js View on Github external
function MultiError(errors)
{
	mod_assertplus.array(errors, 'list of errors');
	mod_assertplus.ok(errors.length > 0, 'must be at least one error');
	this.ase_errors = errors;

	VError.call(this, {
	    'cause': errors[0]
	}, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's');
}
github altanai / Ramudroid / webrobocontrol / node_modules / restify-errors / node_modules / verror / lib / verror.js View on Github external
function MultiError(errors)
{
	mod_assertplus.array(errors, 'list of errors');
	mod_assertplus.ok(errors.length > 0, 'must be at least one error');
	this.ase_errors = errors;

	VError.call(this, {
	    'cause': errors[0]
	}, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's');
}
github joyent / sdc-docker / lib / plugin-manager.js View on Github external
function filterGetNetworksOrPools(opts, networks) {
    assert.object(opts, 'opts');
    assert.object(opts.account, 'opts.account');
    assert.array(networks, 'networks');

    this.hooks.filterGetNetworksOrPools.forEach(function runPlugin(plugin) {
        networks = plugin(opts, networks);
    });

    return networks;
};
github joyent / node-verror / lib / verror.js View on Github external
function parseConstructorArguments(args)
{
	var argv, options, sprintf_args, shortmessage, k;

	mod_assertplus.object(args, 'args');
	mod_assertplus.bool(args.strict, 'args.strict');
	mod_assertplus.array(args.argv, 'args.argv');
	argv = args.argv;

	/*
	 * First, figure out which form of invocation we've been given.
	 */
	if (argv.length === 0) {
		options = {};
		sprintf_args = [];
	} else if (mod_isError(argv[0])) {
		options = { 'cause': argv[0] };
		sprintf_args = argv.slice(1);
	} else if (typeof (argv[0]) === 'object') {
		options = {};
		for (k in argv[0]) {
			options[k] = argv[0][k];
		}
github bfrgoncalves / Online-PhyloViZ / node_modules / restify / node_modules / verror / lib / verror.js View on Github external
function MultiError(errors)
{
	mod_assertplus.array(errors, 'list of errors');
	mod_assertplus.ok(errors.length > 0, 'must be at least one error');
	this.ase_errors = errors;

	VError.call(this, {
	    'cause': errors[0]
	}, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's');
}
github Netflix / nerror / lib / verror.js View on Github external
function MultiError(errors) {
    assert.array(errors, 'list of errors');
    assert.ok(errors.length > 0, 'must be at least one error');
    this.ase_errors = errors;

    VError.call(
        this,
        {
            cause: errors[0]
        },
        'first of %d error%s',
        errors.length,
        errors.length === 1 ? '' : 's'
    );
}
github charlielin99 / Jobalytics / node_modules / verror / lib / verror.js View on Github external
function parseConstructorArguments(args)
{
	var argv, options, sprintf_args, shortmessage, k;

	mod_assertplus.object(args, 'args');
	mod_assertplus.bool(args.strict, 'args.strict');
	mod_assertplus.array(args.argv, 'args.argv');
	argv = args.argv;

	/*
	 * First, figure out which form of invocation we've been given.
	 */
	if (argv.length === 0) {
		options = {};
		sprintf_args = [];
	} else if (mod_isError(argv[0])) {
		options = { 'cause': argv[0] };
		sprintf_args = argv.slice(1);
	} else if (typeof (argv[0]) === 'object') {
		options = {};
		for (k in argv[0]) {
			options[k] = argv[0][k];
		}