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

menhera

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

menhera - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

28

dist/index.js

@@ -55,3 +55,4 @@ "use strict";

components = _$config$components === undefined ? [] : _$config$components,
lifeCycle = _$config.lifeCycle;
_$config$lifeCycle = _$config.lifeCycle,
lifeCycle = _$config$lifeCycle === undefined ? [] : _$config$lifeCycle;

@@ -63,4 +64,4 @@ var _lifeCycle = _toArray(lifeCycle),

components.forEach(function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(comp) {
var name;
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(component) {
var comp, name;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -70,2 +71,3 @@ while (1) {

case 0:
comp = typeof component === "function" ? component(_) : component;
name = comp.name;

@@ -78,11 +80,11 @@

if (!_context.t0) {
_context.next = 6;
_context.next = 7;
break;
}
_context.next = 6;
return comp[awake]({ _: _ });
_context.next = 7;
return comp[awake]();
case 6:
_context.next = 8;
case 7:
_context.next = 9;
return Object.keys(comp).forEach(function (prop) {

@@ -104,5 +106,5 @@ if (typeof _[prop] === "function") {

if (typeof value === "function") {
_[prop]({ _: _, name: _name, event: value });
_[prop]({ name: _name, event: value });
} else {
_[prop]({ _: _, name: _name, props: value });
_[prop]({ name: _name, props: value });
}

@@ -127,9 +129,9 @@ }

case 8:
case 9:
lifeCycles.forEach(function (key) {
comp[key] && comp[key]({ _: _ });
comp[key] && comp[key]();
});
case 9:
case 10:
case "end":

@@ -136,0 +138,0 @@ return _context.stop();

@@ -12,108 +12,103 @@ "use strict";

var Observer = exports.Observer = {
name: "menhera-observer",
awake: function awake(_ref) {
var _ = _ref._;
_.Observer = { Event: new _events.EventEmitter() };
_.state = {};
_._state = {};
_.state = new Proxy(_._state, {
get: function get(target, key) {
if (key in target) {
return target[key];
} else {
target[key] = null;
return null;
var Observer = exports.Observer = function Observer(_) {
return {
name: "menhera-observer",
awake: function awake() {
_.Observer = { Event: new _events.EventEmitter() };
_.state = {};
_._state = {};
_.state = new Proxy(_._state, {
get: function get(target, key) {
if (key in target) {
return target[key];
} else {
target[key] = null;
return null;
}
},
set: function set(target, key, val) {
target[key] = val;
_.Observer.Event.emit(key, { val: val });
return true;
}
},
set: function set(target, key, val) {
target[key] = val;
_.Observer.Event.emit(key, { _: _, val: val });
return true;
}
});
_.observer = function (_ref2) {
var name = _ref2.name,
event = _ref2.event;
});
_.onObserver = function (_ref) {
var name = _ref.name,
event = _ref.event;
_.Observer.Event.on(name, event);
};
},
_.Observer.Event.on(name, event);
};
},
observer: {
foo: function foo() {
console.log("bar");
onObserver: {
foo: function foo() {
console.log("bar");
}
}
}
};
};
var Event = exports.Event = {
name: "menhera-event",
awake: function awake(_ref3) {
var _ = _ref3._;
var Event = exports.Event = function Event(_) {
return {
name: "menhera-event",
awake: function awake() {
_.Event = new _events.EventEmitter();
_.onEvent = function (_ref2) {
var name = _ref2.name,
event = _ref2.event;
_.Event = new _events.EventEmitter();
_.on = function (_ref4) {
var name = _ref4.name,
event = _ref4.event;
_.Event.on(name, event);
};
_.Event.on(name, event);
return _;
};
_.emit = function (name) {
for (var _len = arguments.length, val = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
val[_key - 1] = arguments[_key];
}
_.emit = function (name) {
for (var _len = arguments.length, val = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
val[_key - 1] = arguments[_key];
_.Event.emit(name, { val: val });
};
},
onEvent: {
foo: function foo() {
console.log("bar");
}
_.Event.emit(name, { _: _, val: val });
return _;
};
},
on: {
foo: function foo() {
console.log("bar");
}
}
};
};
var CLI = exports.CLI = {
name: "menhera-cli",
awake: function awake(_ref5) {
var _ = _ref5._;
var CLI = exports.CLI = function CLI(_) {
return {
name: "menhera-cli",
awake: function awake() {
_.CLI = { structs: {}, Event: new _events.EventEmitter() };
_.onCli = function (_ref3) {
var name = _ref3.name,
props = _ref3.props;
var desc = props.desc,
exec = props.exec;
_.CLI = { structs: {}, Event: new _events.EventEmitter() };
_.onCli = function (_ref6) {
var name = _ref6.name,
props = _ref6.props;
var desc = props.desc,
exec = props.exec;
_.CLI.structs[name] = props;
_.CLI.Event.on(name, exec);
};
},
start: function start() {
var _process$argv$slice = process.argv.slice(2),
_process$argv$slice2 = _toArray(_process$argv$slice),
command = _process$argv$slice2[0],
val = _process$argv$slice2.slice(1);
_.CLI.structs[name] = props;
_.CLI.Event.on(name, exec);
};
},
start: function start(_ref7) {
var _ = _ref7._;
_.CLI.Event.emit(command, { val: val });
},
var _process$argv$slice = process.argv.slice(2),
_process$argv$slice2 = _toArray(_process$argv$slice),
command = _process$argv$slice2[0],
val = _process$argv$slice2.slice(1);
onCli: {
foo: {
exec: function exec(_ref4) {
var val = _ref4.val;
_.CLI.Event.emit(command, { _: _, val: val });
},
onCli: {
foo: {
exec: function exec(_ref8) {
var _ = _ref8._,
val = _ref8.val;
console.log("bar");
console.log("bar");
}
}
}
}
};
};

@@ -56,5 +56,5 @@ "use strict";

Object.keys(Obj2).forEach(function (key) {
cache[key] = [].concat(_toConsumableArray(Obj1[key] || []), _toConsumableArray(Obj2[key]));
cache[key] = Array.from(new Set([].concat(_toConsumableArray(Obj1[key] || []), _toConsumableArray(Obj2[key]))));
});
return cache;
};
{
"name": "menhera",
"version": "0.0.9",
"version": "0.1.0",
"main": "dist",

@@ -5,0 +5,0 @@ "files": [

@@ -12,36 +12,34 @@ # Menhera

let Test = _ => ({
name: "test",
awake() {
console.log("test0");
},
start() {
_.state.test1 = "test1";
_.state.test2 = "test2";
_.emit("test4", "test", "4");
_.emit("test5", "test", "5");
},
onObserver: {
test1({ val }) {
console.log(val);
},
test2({ val }) {
console.log(val);
}
},
onEvent: {
test4({ val }) {
console.log(val.join(""));
},
test5({ val }) {
console.log(val.join(""));
}
}
});
const _ = new Menhera({
components: [
Observer,
Event,
{
name: "test",
awake() {
console.log("test0");
},
start({ _ }) {
_.state.test1 = "test1";
_.state.test2 = "test2";
_.emit("test4", "test", "4");
_.emit("test5", "test", "5");
},
observer: {
test1({ val }) {
console.log(val);
},
test2({ val }) {
console.log(val);
}
},
on: {
test4({ val }) {
console.log(val.join(""));
},
test5({ val }) {
console.log(val.join(""));
}
}
}
]
components: [Observer, Event, Test]
}).init();
```
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