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

annotate

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

annotate - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

bower.json

44

lib/index.js

@@ -91,12 +91,4 @@ (function(root, factory) {

var args = Array.prototype.slice.call(arguments);
var firstPreconditions = preconditions[0];
var result;
var result = matchPreconditions(args, preconditions);
if(is.array(firstPreconditions[0])) {
result = matchArray(args, firstPreconditions[0][0]);
}
else {
result = matchRegular(args, preconditions);
}
if(result.fail) {

@@ -115,19 +107,3 @@ return warnPost('precondition', result.fail, name, args);

function matchArray(args, precondition) {
var fails = args.filter(function(arg) {
return !precondition(arg) && precondition;
});
if(fails.length) {
return {
fail: fails[0]
};
}
return {
i: 0
};
}
function matchRegular(args, preconditions) {
function matchPreconditions(args, preconditions) {
var i, j, len1, len2, precondition, pre, allMatched;

@@ -161,2 +137,18 @@

function matchArray(args, precondition) {
var fails = args.filter(function(arg) {
return !precondition(arg) && precondition;
});
if(fails.length) {
return {
fail: fails[0]
};
}
return {
i: 0
};
}
function arr(pre) {

@@ -163,0 +155,0 @@ return function(i) {

@@ -5,9 +5,10 @@ {

"author": "Juho Vepsalainen <bebraw@gmail.com>",
"version": "0.9.0",
"version": "0.9.1",
"dependencies": {
"annois": "~0.3.0"
"annois": "0.3.0"
},
"devDependencies": {
"suite.js": "== 0.6.0",
"funkit": "== 0.7.7"
"suite.js": "0.6.0",
"funkit": "0.7.8",
"annogenerate": "~0.6.2"
},

@@ -14,0 +15,0 @@ "scripts": {

@@ -73,2 +73,17 @@ var suite = require('suite.js');

var testObject = annotate('testObject', 'Tests object parameter after array')
.on([is.array], function(o) {
return o.reduce(function(a, b) {
return a + b;
});
})
.on(is.object, function(o) {
return 'object';
})
suite(testObject, [
[[1, 2, 3]], 6,
{a: 5}, 'object'
]);
var clamp = annotate('clamp', 'Clamps given number between given bounds')

@@ -75,0 +90,0 @@ .on(is.number, is.number, function(a, args) {

Sorry, the diff of this file is not supported yet

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