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

lazy-assert

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazy-assert - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

2

package.json
{
"name": "lazy-assert",
"version": "0.1.6",
"version": "0.1.7",
"description": "An way of doing assertion for lazy people ...",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -42,3 +42,3 @@ var utils = require('./utils');

// 只能是 object 了
result.push(inner.patternObject(array[i], pattern));
result.push(inner.patternObject(array[i], pattern));
}

@@ -74,3 +74,3 @@ }

var lazyUtils = {
pick: function (value, configArray) {
pick: function (value, configArrayOrFunc) {
if (value instanceof Array) {

@@ -80,3 +80,3 @@ var result = [];

for (var i = 0; i < value.length; i++) {
result.push(lazyAssert.pick(value[i], configArray));
result.push(lazyAssert.pick(value[i], configArrayOrFunc));
}

@@ -87,7 +87,17 @@ return result;

var result = {};
configArray.forEach(function (key) {
if (key in value) {
result[key] = value[key];
if (typeof configArrayOrFunc === 'function') {
for (var key in value) {
if (configArrayOrFunc(key, value[key])) {
result[key] = value[key]
}
}
});
}
else {
configArrayOrFunc.forEach(function (key) {
if (key in value) {
result[key] = value[key];
}
});
}
return result;

@@ -100,3 +110,3 @@ }

unpick: function (value, configArray) {
unpick: function (value, configArrayOrFunc) {
if (value instanceof Array) {

@@ -106,3 +116,3 @@ var result = [];

for (var i = 0; i < value.length; i++) {
result.push(lazyAssert.unpick(value[i], configArray));
result.push(lazyAssert.unpick(value[i], configArrayOrFunc));
}

@@ -116,5 +126,14 @@ return result;

}
configArray.forEach(function (key) {
delete result[key];
});
if (typeof configArrayOrFunc === 'function') {
for (var key in value) {
if (configArrayOrFunc(key, value[key])) {
delete result[key];
}
}
}
else {
configArrayOrFunc.forEach(function (key) {
delete result[key];
});
}
return result;

@@ -121,0 +140,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