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.1.7 to 0.1.8

20

dist/index.js

@@ -7,2 +7,4 @@ "use strict";

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -18,6 +20,7 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var initConfig = {
components: [],
lifeCycle: ["awake", "start"]

@@ -27,7 +30,14 @@ };

var Menhera = function () {
function Menhera(config) {
function Menhera(_ref) {
var components = _ref.components,
lifeCycle = _ref.lifeCycle,
other = _objectWithoutProperties(_ref, ["components", "lifeCycle"]);
_classCallCheck(this, Menhera);
this.components = {};
this.config = (0, _utils.ConfigMerger)(initConfig, config);
this.config = _extends({
components: components,
lifeCycle: lifeCycle ? lifeCycle : initConfig.lifeCycle
}, other);
}

@@ -52,3 +62,3 @@

components.forEach(function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(component) {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(component) {
var cp, name;

@@ -102,3 +112,3 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

return function (_x) {
return _ref.apply(this, arguments);
return _ref2.apply(this, arguments);
};

@@ -105,0 +115,0 @@ }());

@@ -11,21 +11,2 @@ "use strict";

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var ConfigMerger = exports.ConfigMerger = function ConfigMerger() {
var Obj1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var Obj2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var cache = Obj1;
Object.keys(Obj2).forEach(function (key) {
if (Array.isArray(Obj2[key])) {
cache[key] = Array.from(new Set([].concat(_toConsumableArray(Obj1[key] || []), _toConsumableArray(Obj2[key]))));
} else if (_typeof(Obj2[key]) === "object") {
cache[key] = ConfigMerger(Obj1[key], Obj2[key]);
} else {
cache[key] = Obj2[key];
}
});
return cache;
};
var bindHook = exports.bindHook = function bindHook(_ref) {

@@ -32,0 +13,0 @@ var hook = _ref.hook,

{
"name": "menhera",
"version": "0.1.7",
"version": "0.1.8",
"main": "dist",

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

@@ -10,3 +10,55 @@ # Menhera

```js
import Menhera, { Observer, Event } from "menhera";
import { EventEmitter } from "events";
import Menhera from "menhera";
export const Observer = _ => ({
name: "menhera-observer",
awake() {
const { config: { observable = {} } } = _;
_.Observer = { Event: new EventEmitter() };
_.config.observable = new Proxy(observable, {
get(target, key) {
if (key in target) {
return target[key];
} else {
target[key] = null;
return null;
}
},
set(target, key, val) {
target[key] = val;
_.Observer.Event.emit(key, { val });
return true;
}
});
_.onObserver = ({ name, event }) => {
_.Observer.Event.on(name, event);
};
},
onObserver: {
foo() {
console.log("bar");
}
}
});
export const Event = _ => ({
name: "menhera-event",
awake() {
_.Event = new EventEmitter();
_.onEvent = ({ name, event }) => {
_.Event.on(name, event);
};
_.emit = (name, ...val) => {
_.Event.emit(name, { val });
};
},
onEvent: {
foo() {
console.log("bar");
}
}
});
let Test = _ => ({

@@ -13,0 +65,0 @@ name: "test",

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