New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

schema-inspector

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-inspector - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

9

lib/schema-inspector.js

@@ -410,2 +410,11 @@ // Disable no-var because we need to support old IE for now.

},
multipleOf: function (schema, candidate) {
const divisor = Number(schema.multipleOf);
if (typeof candidate !== 'number' || isNaN(divisor)) {
return;
}
if (candidate % divisor !== 0) {
this.report(candidate + ' is not divisible by ' + divisor, null, 'multipleOf');
}
},
someKeys: function (schema, candidat) {

@@ -412,0 +421,0 @@ var _keys = schema.someKeys;

4

package.json
{
"name": "schema-inspector",
"description": "Schema-Inspector is a powerful tool to sanitize and validate JS objects.",
"version": "2.0.3",
"version": "2.1.0",
"main": "index.js",

@@ -35,3 +35,3 @@ "author": {

"mocha": "^10.0.0",
"semistandard": "^16.0.1",
"semistandard": "^17.0.0",
"should": "^13.2.3"

@@ -38,0 +38,0 @@ },

@@ -143,2 +143,3 @@ <!-- markdownlint-disable MD041 MD033 MD024 -->

* [lt, lte, gt, gte, eq, ne](#v_comparators)
* [multipleOf](#v_multipleOf)
* [someKeys](#v_someKeys)

@@ -433,2 +434,28 @@ * [strict](#v_strict)

<h3 id="v_multipleOf">multipleOf</h3>
* **type**: number
* **usable on**: number, array
Check whether the candidate is a multiple of the provided option. If the candidate is an array of numbers, it performs this validation on each number in the array.
#### Example
```javascript
var inspector = require('schema-inspector');
var schema = {
type: 'number',
multipleOf: 2 // Even
};
var c1 = 100;
var c2 = 73;
inspector.validate(schema, c1); // Valid
inspector.validate(schema, c2); // Invalid: 73 is not divisible by 2
```
---------------------------------------
<h3 id="v_someKeys">someKeys</h3>

@@ -435,0 +462,0 @@

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