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

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.2.0 to 1.2.1

69

lib/util.js

@@ -30,2 +30,69 @@ (function(scope) {

/**
* add listener to observer
*
* @param name - event name
* @param func - function
* @param allListeners - listeners array
* @param observer - observer object
*/
this.addListener = function(name, func, allListeners, observer) {
var listeners, obj,
type = Util.getType(name);
switch(type) {
case 'string':
listeners = allListeners[name];
if (!listeners)
listeners = allListeners[name] = [];
listeners.push(func);
if (func && observer)
observer.on(name, func);
break;
case 'object':
obj = name;
Object.keys(obj).forEach(function(name) {
func = obj[name];
Util.addListener(name, func, allListeners, observer);
});
break;
}
return this;
};
/**
* remove listener from observer
*
* @param name - event name
* @param func - function
* @param allListeners - listeners array
* @param observer - observer object
*/
this.removeListener = function(name, func, allListeners, observer) {
var listeners;
if (observer)
observer.removeListener(name, func);
listeners = allListeners[name];
if (listeners)
listeners = listeners.map(function(listener) {
if (listener === func)
listener = null;
return listener;
});
return this;
};
/**
* Функция ищет в имени файла расширение

@@ -48,3 +115,3 @@ * и если находит возвращает true

regExp = new RegExp(regStr);
regExp = new RegExp(regStr, 'i');
isMatch = name.match(regExp);

@@ -51,0 +118,0 @@

2

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

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

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