Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 20, 2024 via pnpm

aproba 1.2.0

A ridiculously light-weight argument validator (now browser friendly)
Package summary
Share
0
issues
1
license
1
ISC
Package created
27 Feb 2015
Version published
19 Sep 2017
Maintainers
1
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
aproba@1.2.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of aproba 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does aproba do?

Aproba is an incredibly lightweight function argument validator built for JavaScript. It is designed to help developers maintain strict type control over function arguments in their JavaScript code, which can significantly improve code quality and reduce runtime errors. Additionally, aproba is suitable for use in the browser due to having no dependencies, allowing for improved stack trace visibility.

How do you use aproba?

Using aproba in your JavaScript project is relatively easy. First, you would need to install the npm package using the command npm install aproba. Then, you can simply require aproba in your JavaScript file and begin using the validate function to enforce strict type control over the arguments passed to your functions.

Here's an example of how you can use aproba:

var validate = require("aproba")

function myfunc(a, b, c) {
  // `a` must be a string, `b` a number, `c` a function
  validate('SNF', arguments) // [a,b,c] is also valid
}

myfunc('test', 23, function () {}) // ok
myfunc(123, 23, function () {}) // type error
myfunc('test', 23) // missing arg error
myfunc('test', 23, function () {}, true) // too many args error

In the above example, validate('SNF', arguments) will ensure that the first argument is a string (S), the second one is a number (N), and the third one is a function (F).

Where are the aproba docs?

For the complete details and documentation on the various type checks and usage examples, visit the aproba project on GitHub at https://github.com/iarna/aproba. The README of the GitHub project page acts as the package's documentation, and it contains an extensive array of information regarding the use of Aproba. It covers topic areas such as error identification, handling optional arguments, and more. However, it's important to note that aproba is not designed to validate user data, but rather to assert the interface of your functions. For greater validation, you may need to consider other packages or custom validation functions.