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

@toolz/allow

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toolz/allow - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "@toolz/allow",
"version": "1.0.1",
"version": "1.0.2",
"description": "Provides validation of data types",

@@ -5,0 +5,0 @@ "keywords": [

@@ -8,2 +8,4 @@ # allow

**NOTE:** This library is designed for "vanilla" JS. If you are working in a React project, it's recommended to consider using `@toolz/allow-react`, which offers special behavior for evaluating React elements.
## Usage

@@ -28,3 +30,3 @@

In the above example, the assumption is that `originalPrice`should _always_ be a number. If any other data type is provided for `originalPrice`, the `allow`check will fail. This means that a value of `'32.99'`will fail (because it's a string). `null`will fail. Boolean values will fail. Anything that is _not_ a number will fail. In this example, the second argument (which is optional), indicates the minimum acceptable value of the number. In this case, we don't want negative values for `originalPrice`, so nothing below `0`will pass the check.
In the above example, the assumption is that `originalPrice` should _always_ be a number. If any other data type is provided for `originalPrice`, the `allow`check will fail. This means that a value of `'32.99'`will fail (because it's a string). `null`will fail. Boolean values will fail. Anything that is _not_ a number will fail. In this example, the second argument (which is optional), indicates the minimum acceptable value of the number. In this case, we don't want negative values for `originalPrice`, so nothing below `0`will pass the check.

@@ -31,0 +33,0 @@ ## Methods

@@ -118,3 +118,3 @@ const Allow = () => {

anInteger(minNumberOfKeys, is.not.negative).anInteger(maxNumberOfKeys, is.not.negative);
if ((typeof value !== 'object' || Array.isArray(value) || value === null))
if (!isAnObject(value))
return fail(value, 'is not an object');

@@ -121,0 +121,0 @@ checkLength(Object.keys(value), minNumberOfKeys, maxNumberOfKeys);

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