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

blork

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blork - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

5

lib/classes/Blorker.js

@@ -424,5 +424,6 @@ // @flow

// Check that we actually need to do this loop by comparing the lengths.
if (valueKeys.length > typeKeys.length) {
// -1 subtracts the _any key itself.
if (valueKeys.length > typeKeys.length - 1) {
// Make a list of the excess keys (that are in valueKeys but not in typeKeys).
const excessKeys = valueKeys.filter(v => typeKeys.indexOf(v) === -1);
const excessKeys = valueKeys.filter(v => !~typeKeys.indexOf(v));

@@ -429,0 +430,0 @@ // Loop through all excess keys and check against the ANY key.

2

package.json
{
"name": "blork",
"description": "Blork! Mini runtime type checking in Javascript",
"version": "5.0.0",
"version": "5.0.1",
"license": "0BSD",

@@ -6,0 +6,0 @@ "author": "Dave Houlbrooke <dave@shax.com>",

@@ -38,2 +38,3 @@ const BlorkError = require("../lib/errors/BlorkError");

expect(check({ a: 1, b: 2, c: undefined }, { a: "num", _any: "num?" })).toBe(undefined);
expect(check({ a: new Map(), b: new Map(), c: new Map() }, { _any: Map })).toBe(undefined);
});

@@ -48,2 +49,5 @@ test("Object literal types with _any property pass correctly when _any isn't used", () => {

expect(() => check({ a: 1, b: 2, c: "c" }, { a: "num", _any: "num" })).toThrow(TypeError);
expect(() => check({ a: 1 }, { _any: "str" })).toThrow(TypeError);
expect(() => check({ a: new Map() }, { _any: Set })).toThrow(TypeError);
expect(() => check({ a: new Map(), b: new Set(), c: new Set() }, { _any: Set })).toThrow(TypeError);
});

@@ -50,0 +54,0 @@ test("Deep object literal types with _any property pass correctly", () => {

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