Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aproba

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aproba

A ridiculously light-weight argument validator (now browser friendly)

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21M
increased by3.4%
Maintainers
1
Weekly downloads
 
Created

What is aproba?

The aproba package is a lightweight argument validation library for Node.js. It allows developers to assert types and values of arguments in functions, ensuring that the functions are called with the expected arguments. This can help catch bugs early in the development process by providing a simple and concise way to validate function inputs.

What are aproba's main functionalities?

Type validation

This feature allows you to validate the types of arguments passed to a function. In the code sample, 'N' stands for number and 'S' for string, ensuring the first argument is a string and the second is a number.

"use strict";
const A = require('aproba');

function exampleFunction(a, b) {
  A('NS', arguments);
  // Function logic here
}

exampleFunction('hello', 123);

Optional arguments

aproba supports optional arguments in its type validation. In the example, the '?' after 'S' indicates that the second argument is optional. This means the function can be called with just the first argument.

"use strict";
const A = require('aproba');

function exampleFunction(a, b) {
  A('NS?', arguments);
  // Function logic here
}

exampleFunction('hello');

Other packages similar to aproba

Keywords

FAQs

Package last updated on 22 May 2018

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