New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc