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

idea-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-toolbox - npm Package Compare versions

Comparing version 0.9.3 to 0.10.0

29

index.js

@@ -36,3 +36,3 @@ 'use strict';

// OTHER
ISODateToItalianFormat, cleanStr, joinArraysOnKeys
ISODateToItalianFormat, cleanStr, joinArraysOnKeys, isEmpty
}

@@ -471,1 +471,28 @@

}
/**
* Check if a field (/variable) is empty, based on its type.
* If the type isn't passed as a parameter, it will be auto-detected.
* @param {*} field the field to check
* @param {*} type (optional, to set to force a type check); enum: string, number, date, boolean
*/
function isEmpty(field, type) {
if(!field) return true; // null, undefined
if(!type) type = typeof field; // try to auto-detect
if(!type) return true; // undefined
// check emptiness based on the type
switch(type) {
case 'string': return field.trim().length <= 0;
case 'number': return field <= 0;
case 'boolean': return !Boolean(field);
case 'date':
case 'object': {
if(field instanceof Date || type == 'date') {
let d = new Date(field);
return !(d instanceof Date) || isNaN(field);
} else if(field instanceof Array) return field.length <= 0;
else return true;
}
default: return true;
}
}

2

package.json
{
"name": "idea-toolbox",
"version": "0.9.3",
"version": "0.10.0",
"description": "IDEA's utility functions",

@@ -5,0 +5,0 @@ "engines": {

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