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

functionality

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functionality - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

11

lib/Masquerade.js

@@ -60,2 +60,3 @@ var _ = require('lodash');

var mask = state.mask;
var value = state.value;
if(!mask.match(state))

@@ -85,9 +86,6 @@ return false;

for(var i = 0; i < Masquerade.types.length; i++)
if(mask === Masquerade.types[i][0]) return Masquerade.types[i][1];
if(Array.isArray(mask) && mask.length === 1) return new Masquerade("[" + mask[0].name + "]", function(value) {
if(!Array.isArray(value)) return false;
if(!(mask[0] instanceof Masquerade)) mask = Masquerade.type(mask[0]);
return Masquerade.match([mask], value, true);
var actualMask = Masquerade.type(mask[0]);
return Masquerade.match([actualMask], value, true);
});

@@ -100,2 +98,5 @@

for(var i = 0; i < Masquerade.types.length; i++)
if(mask === Masquerade.types[i][0]) return Masquerade.types[i][1];
return new Masquerade("InstanceOf", function(value) {

@@ -102,0 +103,0 @@ // Masquerade => new Masquerade()

{
"name": "functionality",
"version": "2.0.0",
"version": "2.0.1",
"description": "Simple function overloading for JavaScript",

@@ -5,0 +5,0 @@ "author": "Sierra Softworks",

@@ -20,2 +20,26 @@ var fn = require('../');

});
describe('Object masking Array', function() {
it('should not mask an [Object] (or similar) option if Object is also an option', function() {
var f = fn.on(Object, fn.gobble(), function(obj) {
return false;
}).on([Object], fn.opt(Function), function(objs, cb) {
return true;
}).compile();
f({ a: 1 }).should.be.false;
f([{ a: 1 }]).should.be.true;
});
it('should not mask an [Object] (or similar) option if Object is also an option and retry() is used', function() {
var f = fn.on(Object, fn.gobble(), function(obj) {
return this.retry([obj]);
}).on([Object], fn.opt(Function), function(objs, cb) {
return true;
}).compile();
f({ a: 1 }).should.be.true;
f([{ a: 1 }]).should.be.true;
});
});
});
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