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

node-red-viseo-helper

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-viseo-helper - npm Package Compare versions

Comparing version 0.0.16 to 0.1.16

0

CODE_OF_CONDUCT.md

@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct

@@ -0,0 +0,0 @@ # Contributing to the Project

90

index.js
'use strict';
const fs = require('fs');
const path = require('path');
const vm = require('vm');
const fs = require('fs');
const path = require('path');
const vm = require('vm');
const extend = require('extend');
const EventEmitter = require('events');
// ------------------------------------------
// CONFIG
// ------------------------------------------
require('./lib/config.js').init();
exports.CONFIG = CONFIG;
const mkpathsync = exports.mkpathsync = (dirpath, mode) => {
dirpath = path.resolve(dirpath);
if (typeof mode === 'undefined') {
mode = parseInt('0777', 8) & (~process.umask());
}
try {
if (!fs.statSync(dirpath).isDirectory()) {
throw new Error(dirpath + ' exists and is not a directory');
}
} catch (err) {
if (err.code === 'ENOENT') {
mkpathsync(path.dirname(dirpath), mode);
fs.mkdirSync(dirpath, mode);
} else { throw err; }
}
};
// ------------------------------------------
// STRING
// ------------------------------------------
const getByString = exports.getByString = (obj, str, def) => {

@@ -35,3 +64,2 @@ if (!str) return def;

const resolve = exports.resolve = (str, obj, def) => {

@@ -77,20 +105,42 @@ if (str === undefined) return str;

// ------------------------------------------
// EVENT
// ------------------------------------------
const mkpathsync = exports.mkpathsync = (dirpath, mode) => {
dirpath = path.resolve(dirpath);
class NodeEmitter extends EventEmitter {}
const emitter = new NodeEmitter();
if (typeof mode === 'undefined') {
mode = parseInt('0777', 8) & (~process.umask());
const emitEvent = exports.emitEvent = (type, node, data, config) => {
emitter.emit(type, node, config, data);
}
const listenEvent = exports.listenEvent = (type, callback) => {
emitter.addListener(type, callback);
}
const removeListener = exports.removeListener = (type, callback) => {
emitter.removeListener(type, callback);
}
const emitAsyncEvent = exports.emitAsyncEvent = (type, node, data, config, callback) => {
let listeners = emitter.listeners(type)
if (!listeners || listeners.length == 0){
return callback(data);
}
try {
if (!fs.statSync(dirpath).isDirectory()) {
throw new Error(dirpath + ' exists and is not a directory');
}
} catch (err) {
if (err.code === 'ENOENT') {
mkpathsync(path.dirname(dirpath), mode);
fs.mkdirSync(dirpath, mode);
} else { throw err; }
}
};
data._tmp = data._tmp || {}
data._tmp['event_emitter'] = { callback: callback, config: config }; // Only one in a flow otherwise might loose it
emitter.emit(type, node, data, config);
}
const fireAsyncCallback = exports.fireAsyncCallback = (data) => {
if (!data._tmp) return;
if (!data._tmp.event_emitter) return;
let callback = data._tmp.event_emitter.callback;
if (!callback) return;
delete data._tmp.event_emitter;
callback(data);
}

@@ -0,0 +0,0 @@ const extend = require('extend');

{
"name" : "node-red-viseo-helper",
"version" : "0.0.16",
"version" : "0.1.16",
"description" : "Utility libarary for Node-RED",

@@ -5,0 +5,0 @@ "dependencies" : { },

# Node-RED
Utility library to work with Node-RED and a set of Node-RED nodes OpenSourced by [VISEO](http://www.viseo.com/) Technologies.
Utility library to work with Node-RED and a set of Node-RED nodes OpenSourced by [VISEO](http://www.viseo.com/).

@@ -5,0 +5,0 @@ ## Getting Help

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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