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.5.9-rc1 to 0.5.9-rc2

50

dist/plugins.js

@@ -165,27 +165,35 @@ "use strict";

val.forEach(function () {
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(component) {
var cp, name;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
cp = typeof component === "function" ? component({ _: _ }) : component;
name = cp.name;
if (Array.isArray(val)) {
val.forEach(function () {
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(component) {
var cp, name;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
cp = typeof component === "function" ? component({ _: _ }) : component;
name = cp.name;
_[name] = cp;
_.$use(_[name]);
_[name] = cp;
_.$use(_[name]);
case 4:
case "end":
return _context.stop();
case 4:
case "end":
return _context.stop();
}
}
}
}, _callee, undefined);
}));
}, _callee, undefined);
}));
return function (_x) {
return _ref13.apply(this, arguments);
};
}());
return function (_x) {
return _ref13.apply(this, arguments);
};
}());
} else {
var _cp = typeof val === "function" ? val({ _: _ }) : val;
var name = _cp.name;
_[name] = _cp;
_.$use(_[name]);
}
}

@@ -192,0 +200,0 @@ } catch (err) {

{
"name": "menhera",
"version": "0.5.9-rc1",
"version": "0.5.9-rc2",
"main": "dist",

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

@@ -66,77 +66,1 @@ # Menhera

```
```js
import koa from "koa";
import Router from "koa-router";
import Menhera from "menhera";
const app = {
name: "app",
app: new koa(),
router: new Router(),
_hooks: {
koa: {
data: {
$({ _key, _val }) {
if (!this[_key]) {
this[_key] = _val;
}
}
},
controller({ _, _key, _val, cp }) {
this.controllers = _val(this);
},
router({ _, _key, _val, cp }) {
const { router } = this;
const routers = _val(this);
for (let [key, val] of Object.entries(routers)) {
const [method, path] = key.split(" ");
router[method](path, ctx => val(ctx));
}
},
listen({ _, _key, _val, cp }) {
const { app } = this;
app.use(this.router.routes());
app.listen(_val, e => {
console.log(`app running on port: ${_val}`);
});
}
}
}
};
const _ = new Menhera({
_mount: {
foo: [app]
},
koa: {
data: {
test: { index: 0, user: "" }
},
controller: ({ test }) => ({
index: {
getIndex(ctx) {
ctx.body = test.index++;
}
},
user: {
getUser(ctx) {
test.user = Math.random()
.toString(36)
.replace(/[^a-z]+/g, "")
.substr(0, 5);
ctx.body = test.user;
}
}
}),
router: ({ controllers: { index, user } }) => ({
"get /": index.getIndex,
"get /user": user.getUser
})
}
}).$use({
koa: {
listen: 3000
}
});
```
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