Socket
Socket
Sign inDemoInstall

util-io

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-io - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

83

lib/util.js

@@ -62,42 +62,55 @@ (function(scope) {

this.checkArgs = function(args, names) {
var msg = '',
template = '',
name = '',
lenNames = names.length,
lenArgs = args.length,
lessArgs = lenArgs < lenNames;
this.check = new checkProto();
function checkProto() {
/**
* Check is all arguments with names present
*
* @param name
* @param arg
* @param type
*/
var check = function check(args, names) {
var msg = '',
template = '',
name = '',
lenNames = names.length,
lenArgs = args.length,
lessArgs = lenArgs < lenNames;
if (lessArgs) {
template = '{{ name }} coud not be empty!';
name = names[lenNames - 1];
msg = Util.render(template, {
name: name
});
throw(Error(msg));
}
return check;
};
if (lessArgs) {
template = '{{ name }} coud not be empty!';
name = names[lenNames - 1];
/**
* Check is type of arg with name is equal to type
*
* @param name
* @param arg
* @param type
*/
check.type = function(name, arg, type) {
var is = Util.type(arg) === type;
msg = Util.render(template, {
name: name
});
if (!is)
throw(Error(name + ' should be ' + type));
throw(Error(msg));
}
return check;
};
return this;
};
return check;
}
/**
* Check is type of arg with name is equal to type
*
* @param name
* @param arg
* @param type
*/
this.checkType = function(name, arg, type) {
var is = Util.type(arg) === type;
if (!is)
throw(Error(name + ' should be ' + type));
return this;
};
/**
* Copy properties from from to to

@@ -557,3 +570,3 @@ *

Util.checkArgs(arguments, ['funcs', 'callback']);
Util.check(arguments, ['funcs', 'callback']);

@@ -560,0 +573,0 @@ switch(type) {

{
"name": "util-io",
"version": "1.5.1",
"version": "1.6.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -5,0 +5,0 @@ "description": "Util-io - utilites for vanila js",

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