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.7.5-rc2 to 0.7.5-rc3

268

dist/index.js

@@ -27,17 +27,2 @@ 'use strict';

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _slicedToArray(arr, i) {

@@ -81,2 +66,110 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();

var _hooks = {
_: function _(_ref) {
var _2 = _ref._,
_val = _ref._val,
cp = _ref.cp;
var uuid$$1 = cp.uuid;
if (_typeof(_val) === "object") {
var onFunction = function onFunction(_ref2) {
var depth = _ref2.depth,
_val = _ref2._val;
var target = get(_2[HOOKS], depth);
if (!target) {
target = new Map([[uuid$$1, _val.bind(cp)]]);
set$1(_2[HOOKS], depth, target);
} else {
target.set(uuid$$1, _val.bind(cp));
}
};
var onObject = function onObject(_ref3) {
var object = _ref3.object,
depth = _ref3.depth,
_key = _ref3._key,
_val = _ref3._val;
scanObject({
object: object,
depth: depth,
onObject: onObject,
onFunction: onFunction
});
};
onObject({
object: _val,
depth: ""
});
}
}
};
var _unhooks = {
_: function _(_ref4) {
var _3 = _ref4._,
_val = _ref4._val,
cp = _ref4.cp;
var uuid$$1 = cp.uuid;
if (_typeof(_val) === "object") {
var onFunction = function onFunction(_ref5) {
var depth = _ref5.depth,
_val = _ref5._val;
var target = get(_3[HOOKS], depth);
if (!target) return;
target.delete(uuid$$1);
};
var onObject = function onObject(_ref6) {
var object = _ref6.object,
depth = _ref6.depth,
_key = _ref6._key,
_val = _ref6._val;
scanObject({
object: object,
depth: depth,
onObject: onObject,
onFunction: onFunction
});
};
onObject({
object: _val,
depth: ""
});
}
}
};
var _mount = {
$: function $$$1(_ref7) {
var _ = _ref7._,
_val = _ref7._val,
cp = _ref7.cp;
var cps = Array.isArray(_val) ? _val : [_val];
$(cps, function (key, component) {
var cp = typeof component === "function" ? component({
_: _
}) : component;
var name = cp.name;
if (_[name]) {
console.log("_mount: name \"".concat(name, "\" exists"));
return;
}
_.$use(cp);
_[name] = cp;
});
}
};
var hooks = /*#__PURE__*/Object.freeze({
_hooks: _hooks,
_unhooks: _unhooks,
_mount: _mount
});
var handleHooks = function handleHooks(_ref) {

@@ -89,3 +182,3 @@ var key = _ref.key,

var hooks = get(_[HOOKS], key);
hooks && $(hooks, function (uuid$$1, h) {
hooks && $M(hooks, function (uuid$$1, h) {
h({

@@ -108,3 +201,3 @@ _: _,

hooks && $(_val, function (key, val) {
$(hooks, function (uuid$$1, h) {
$M(hooks, function (uuid$$1, h) {
return h({

@@ -340,4 +433,4 @@ _: _,

var $use$$1 = function $use$$1(_, _object) {
!_object.uuid && (_object.uuid = uuid.v1());
var hooks = useHooks(_);
_object.uuid = uuid.v1();

@@ -353,4 +446,4 @@ var BindHook = function BindHook(_ref) {

if (depth != "" && !validHook) return;
var _hooks$$1 = hooks[hook];
_hooks$$1 && $(_hooks$$1, function (key, shook) {
var _hooks = hooks[hook];
_hooks && $(_hooks, function (key, shook) {
shook({

@@ -402,2 +495,11 @@ hook: hook,

};
var $unuse$$1 = function $unuse$$1(_, _object) {
var uuid$$1 = _object.uuid,
_hooks = _object._hooks;
$use$$1(_, {
uuid: uuid$$1,
_unhooks: _hooks
});
return _;
};
var $run$$1 = function $run$$1(_method, _, _object) {

@@ -707,3 +809,4 @@ if (!_method) {

return cache;
};
}; //
var _matchSimple$$1 = function _matchSimple$$1(_, _array) {

@@ -870,75 +973,18 @@ console.log(JSON.stringify(_array));

var initHooks$$1 = function initHooks$$1() {
var matchSlashPath = /\//g;
var matchPath = /\/|\./;
var initHooks = function initHooks() {
var cache = {};
cache._hooks = {
_: _defineProperty({}, uuid.v1(), _hooks$$1._)
};
cache._mount = {
$: _defineProperty({}, uuid.v1(), _mount$$1.$)
};
return cache;
};
var _hooks$$1 = {
_: function _(_ref2) {
var _2 = _ref2._,
_val = _ref2._val,
cp = _ref2.cp;
var uuid$$1 = cp.uuid;
if (_typeof(_val) === "object") {
var onFunction = function onFunction(_ref3) {
var depth = _ref3.depth,
_val = _ref3._val;
var target = get(_2[HOOKS], depth, {});
target[uuid$$1] = _val.bind(cp);
set$1(_2[HOOKS], depth, target);
};
var _uuid = uuid.v1();
var onObject = function onObject(_ref4) {
var object = _ref4.object,
depth = _ref4.depth,
_key = _ref4._key,
_val = _ref4._val;
scanObject({
object: object,
depth: depth,
onObject: onObject,
onFunction: onFunction
});
};
$(hooks, function (key, val) {
$(val, function (hookKey, hookVal) {
var _val = new Map().set(_uuid, hookVal);
onObject({
object: _val,
depth: ""
});
}
}
};
var _mount$$1 = {
$: function $$$1(_ref5) {
var _ = _ref5._,
_val = _ref5._val,
cp = _ref5.cp;
var cps = Array.isArray(_val) ? _val : [_val];
$(cps, function (key, component) {
var cp = typeof component === "function" ? component({
_: _
}) : component;
var name = cp.name;
if (_[name]) {
console.log("_mount: name \"".concat(name, "\" exists"));
return;
}
_.$use(cp);
_[name] = cp;
set$1(cache, "".concat(key, ".").concat(hookKey), _val);
});
}
});
return cache;
};
var matchSlashPath = /\//g;
var matchPath = /\/|\./;
var get = function get(obj, path, def) {

@@ -983,2 +1029,30 @@ if (matchSlashPath.test(path)) {

};
var $M = function $M(map, cb) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = map[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = _slicedToArray(_step.value, 2),
key = _step$value[0],
val = _step$value[1];
cb(key, val);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
};
var scanObject = function scanObject(_ref) {

@@ -1064,3 +1138,3 @@ var object = _ref.object,

var $core = function $core(_, _object) {
_[HOOKS] = initHooks$$1(_);
_[HOOKS] = initHooks(_);
_._events = new events.EventEmitter();

@@ -1078,2 +1152,12 @@

_._events.on("$unuse", function (_object) {
return $unuse$$1(_, _object);
});
_.$unuse = function (_object) {
_._events.emit("$unuse", _object);
return _;
};
_.$use(_object);

@@ -1092,2 +1176,3 @@

exports.matchPath = matchPath;
exports.initHooks = initHooks;
exports.get = get;

@@ -1098,5 +1183,7 @@ exports.set = set$1;

exports.$ = $;
exports.$M = $M;
exports.scanObject = scanObject;
exports.$str = $str$$1;
exports.$use = $use$$1;
exports.$unuse = $unuse$$1;
exports.$run = $run$$1;

@@ -1126,4 +1213,1 @@ exports._setSimple = _setSimple$$1;

exports._scanSimple = _scanSimple$$1;
exports.initHooks = initHooks$$1;
exports._hooks = _hooks$$1;
exports._mount = _mount$$1;
{
"name": "menhera",
"version": "0.7.5-rc2",
"version": "0.7.5-rc3",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -20,12 +20,8 @@ # Menhera

bar: {
foo1: {
bar1: {
test: ({ _val }) => console.log(_val),
testFn: ({ _val }) => console.log(_val())
}
}
test: ({ _val }) => console.log(_val),
testFn: ({ _val }) => console.log(_val())
}
}
},
"foo.bar.foo1.bar1": {
"foo.bar": {
test: "foo bar",

@@ -32,0 +28,0 @@ testFn: () => "foo bar"

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