🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

arguments-verify

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arguments-verify

arguments verifier

0.4.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

arguments-verify

function to check if arguments of function are valid

Version

0.3.0

Install

npm install --save arguments-verify

Usage

var argumentsVerify = require('arguments-verify')

function func (arr, num) {
    argumentsVerify([['Array'], ['Number', 'Undefined']], function (err) {
        if (err) {
            throw Error('in ' + fnName + ': ' + err.value + ' is not correct')
        }
    }, 'func')
    num = num || 1
    return arr.map(function (e) {
        return e * num
    })
}

// or

var func_validator = {
    fnName: 'func',
    validate: argumentsVerify
}

function func (arr, num) {
    func_validator.validate([['Array'], ['Number', 'Undefined']], function (err) {
        if (err) {
            throw Error('in ' + fnName + ': ' + err.value + ' is not correct')
        }
    })
    num = num || 1
    return arr.map(function (e) {
        return e * num
    })
}

Documentation:

See tests

LICENSE

MIT

Keywords

verify

FAQs

Package last updated on 05 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts