New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.8-rc1 to 0.8.0

348

dist/index.js

@@ -27,2 +27,17 @@ '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) {

@@ -220,3 +235,48 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();

};
var entity = {
$: function $$$1(_ref10) {
var _ = _ref10._,
_val = _ref10._val,
cp = _ref10.cp;
var _uuid = uuid.v1();
_val._uuid = _uuid;
var onAny = function onAny(_ref11) {
var object = _ref11.object,
depth = _ref11.depth,
_key = _ref11._key,
_val = _ref11._val;
var target = get(_[DATAS], depth);
if (!target) {
target = new Set([_uuid]);
set$1(_[DATAS], depth, target);
} else {
target.add(_uuid, _val);
}
};
var onObject = function onObject(_ref12) {
var object = _ref12.object,
depth = _ref12.depth,
_key = _ref12._key,
_val = _ref12._val;
scanObject({
object: object,
depth: depth,
onObject: onObject,
onAny: onAny
});
};
_[ENTITIES][_uuid] = _val;
onObject({
object: _val,
depth: ''
});
}
};
var hooks = /*#__PURE__*/Object.freeze({

@@ -226,3 +286,4 @@ _hooks: _hooks,

_mount: _mount,
_run: _run
_run: _run,
entity: entity
});

@@ -265,3 +326,2 @@

var fns = compose(_toConsumableArray(h));
console.log(fns);
fns({

@@ -457,5 +517,4 @@ depth: depth,

},
$A: function $A(_ref11) {
$: function $$$1(_ref11) {
var object = _ref11.object,
parentDepth = _ref11.parentDepth,
depth = _ref11.depth,

@@ -465,4 +524,4 @@ _key = _ref11._key,

_object = _ref11._object;
var key = "".concat(parentDepth, ".$A");
handleHooks({
var key = "".concat(depth, ".$");
handleEachHooks({
object: object,

@@ -472,10 +531,7 @@ depth: depth,

_: _2,
_key: _key,
_val: _val,
_object: _object
});
}
},
onFunction: {
F: function F(_ref12) {
},
$A: function $A(_ref12) {
var object = _ref12.object,

@@ -487,3 +543,3 @@ parentDepth = _ref12.parentDepth,

_object = _ref12._object;
var key = "".concat(depth, ".F");
var key = "".concat(parentDepth, ".$A");
handleHooks({

@@ -498,4 +554,6 @@ object: object,

});
},
$F: function $F(_ref13) {
}
},
onFunction: {
F: function F(_ref13) {
var object = _ref13.object,

@@ -507,3 +565,3 @@ parentDepth = _ref13.parentDepth,

_object = _ref13._object;
var key = "".concat(parentDepth, ".$F");
var key = "".concat(depth, ".F");
handleHooks({

@@ -518,6 +576,4 @@ object: object,

});
}
},
onVariable: {
V: function V(_ref14) {
},
$F: function $F(_ref14) {
var object = _ref14.object,

@@ -529,3 +585,3 @@ parentDepth = _ref14.parentDepth,

_object = _ref14._object;
var key = "".concat(depth, ".V");
var key = "".concat(parentDepth, ".$F");
handleHooks({

@@ -540,4 +596,6 @@ object: object,

});
},
$V: function $V(_ref15) {
}
},
onVariable: {
V: function V(_ref15) {
var object = _ref15.object,

@@ -549,2 +607,20 @@ parentDepth = _ref15.parentDepth,

_object = _ref15._object;
var key = "".concat(depth, ".V");
handleHooks({
object: object,
depth: depth,
key: key,
_: _2,
_key: _key,
_val: _val,
_object: _object
});
},
$V: function $V(_ref16) {
var object = _ref16.object,
parentDepth = _ref16.parentDepth,
depth = _ref16.depth,
_key = _ref16._key,
_val = _ref16._val,
_object = _ref16._object;
var key = "".concat(parentDepth, ".$V");

@@ -566,3 +642,21 @@ handleHooks({

var $str$$1 = JSON.stringify;
var $exec$$1 = function $exec$$1(_method, _, _object) {
if (!_method) {
throw new Error('$exec: _method is invalid');
}
if (Array.isArray(_object)) {
var cache = [];
$(_object, function (key, val) {
cache[key] = _method(_, val);
});
return cache;
}
return _method(_, _object);
};
var $use$$1 = function $use$$1(_, _object) {
return $exec$$1(_use$$1, _, _object);
};
var _use$$1 = function _use$$1(_, _object) {
!_object.uuid && (_object.uuid = uuid.v1());

@@ -579,3 +673,3 @@ var hooks = useHooks(_);

var validHook = has(_[HOOKS], depth);
if (depth != "" && !validHook) return;
if (depth != '' && !validHook) return;
var _hooks = hooks[hook];

@@ -600,3 +694,3 @@ _hooks && $(_hooks, function (key, shook) {

var validHook = has(_[HOOKS], depth);
if (depth != "" && !validHook) return;
if (depth != '' && !validHook) return;
hook && BindHook(data);

@@ -614,15 +708,5 @@ scanObject({

if (Array.isArray(_object)) {
$(_object, function (key, object) {
onObject({
object: object,
depth: ""
});
});
return _;
}
_typeof(_object) === "object" && onObject({
onObject({
object: _object,
depth: ""
depth: ''
});

@@ -632,2 +716,5 @@ return _;

var $unuse$$1 = function $unuse$$1(_, _object) {
return $exec$$1(_unuse$$1, _, _object);
};
var _unuse$$1 = function _unuse$$1(_, _object) {
var uuid$$1 = _object.uuid,

@@ -641,17 +728,2 @@ _hooks = _object._hooks;

};
var $run$$1 = function $run$$1(_method, _, _object) {
if (!_method) {
throw new Error("$run: _method is invalid");
}
if (Array.isArray(_object)) {
var cache = [];
$(_object, function (key, val) {
cache[key] = _method(_, val);
});
return cache;
}
return _method(_, _object);
};
var _setSimple$$1 = function _setSimple$$1(_, _object) {

@@ -712,3 +784,3 @@ var cache = {};

object: _object,
depth: ""
depth: ''
});

@@ -778,3 +850,3 @@ return cache;

object: _object,
depth: ""
depth: ''
});

@@ -790,5 +862,5 @@ return cache;

_ref8$type = _ref8.type,
type = _ref8$type === void 0 ? "simple" : _ref8$type;
type = _ref8$type === void 0 ? 'simple' : _ref8$type;
return $run$$1(setMethods$$1[type], _, _object);
return $exec$$1(setMethods$$1[type], _, _object);
};

@@ -803,3 +875,3 @@ var $merge$$1 = function $merge$$1(_array, options) {

var $get$$1 = function $get$$1(_, _object) {
return $run$$1(_get$$1, _, _object);
return $exec$$1(_get$$1, _, _object);
};

@@ -867,7 +939,7 @@ var _get$$1 = function _get$$1(_, args) {

_typeof(args) === "object" && onObject({
_typeof(args) === 'object' && onObject({
object: args,
depth: ""
depth: ''
});
_typeof(args) !== "object" && onVariable({
_typeof(args) !== 'object' && onVariable({
depth: args

@@ -878,3 +950,3 @@ });

var $diff$$1 = function $diff$$1(_, _object) {
return $run$$1(_diff$$1, _, _object);
return $exec$$1(_diff$$1, _, _object);
};

@@ -891,3 +963,3 @@ var _diff$$1 = function _diff$$1(_, _object) {

$(object, function (key, val) {
if (_typeof(val) === "object") {
if (_typeof(val) === 'object') {
return;

@@ -914,3 +986,3 @@ }

object: _object,
depth: ""
depth: ''
});

@@ -920,3 +992,3 @@ return cache;

var $has$$1 = function $has$$1(_, _object) {
return $run$$1(_has$$1, _, _object);
return $exec$$1(_has$$1, _, _object);
};

@@ -933,3 +1005,3 @@ var _has$$1 = function _has$$1(_, _object) {

$(object, function (key, val) {
if (_typeof(val) === "object") {
if (_typeof(val) === 'object') {
return;

@@ -953,3 +1025,3 @@ }

object: _object,
depth: ""
depth: ''
});

@@ -961,3 +1033,3 @@ return cache;

console.log(JSON.stringify(_array));
throw new Error("not implemented");
throw new Error('not implemented');
};

@@ -996,8 +1068,8 @@ var _matchAdvanced$$1 = function _matchAdvanced$$1(_, _object) {

_ref14$type = _ref14.type,
type = _ref14$type === void 0 ? "simple" : _ref14$type;
type = _ref14$type === void 0 ? 'simple' : _ref14$type;
return $run$$1(matchMethods$$1[type], target, _object);
return $exec$$1(matchMethods$$1[type], target, _object);
};
var $invalid$$1 = function $invalid$$1(_, _object) {
return $run$$1(_invalid$$1, _, _object);
return $exec$$1(_invalid$$1, _, _object);
};

@@ -1013,3 +1085,3 @@ var _invalid$$1 = function _invalid$$1(_, _object) {

$(object, function (key, val) {
if (_typeof(val) === "object" || !isinValid) {
if (_typeof(val) === 'object' || !isinValid) {
return;

@@ -1035,3 +1107,3 @@ }

object: _object,
depth: ""
depth: ''
});

@@ -1041,3 +1113,3 @@ return isinValid;

var $valid$$1 = function $valid$$1(_, _object) {
return $run$$1(_valid$$1, _, _object);
return $exec$$1(_valid$$1, _, _object);
};

@@ -1053,3 +1125,3 @@ var _valid$$1 = function _valid$$1(_, _object) {

$(object, function (key, val) {
if (_typeof(val) === "object" || !isValid) {
if (_typeof(val) === 'object' || !isValid) {
return;

@@ -1075,3 +1147,3 @@ }

object: _object,
depth: ""
depth: ''
});

@@ -1081,3 +1153,3 @@ return isValid;

var $equal$$1 = function $equal$$1(_, _object) {
return $run$$1(_equal$$1, _, _object);
return $exec$$1(_equal$$1, _, _object);
};

@@ -1093,3 +1165,3 @@ var _equal$$1 = function _equal$$1(_, _object) {

$(object, function (key, val) {
if (_typeof(val) === "object" || isEqual) {
if (_typeof(val) === 'object' || isEqual) {
return;

@@ -1115,3 +1187,3 @@ }

object: _object,
depth: ""
depth: ''
});

@@ -1125,7 +1197,55 @@ return isEqual;

var _ref18$type = _ref18.type,
type = _ref18$type === void 0 ? "simple" : _ref18$type;
return $run$$1(scanMethod[type], _, _object);
type = _ref18$type === void 0 ? 'simple' : _ref18$type;
return $exec$$1(scanMethod[type], _, _object);
};
var _scanSimple$$1 = function _scanSimple$$1(target, _object) {};
var trigger$$1 = function trigger$$1(triggers, _, data) {
var type = _typeof(data);
if (type == 'object') {
if (Array.isArray(data)) {
type = 'array';
}
}
var trigger$$1 = triggers[type];
if (trigger$$1) {
return trigger$$1(_, data) || {};
}
return {};
};
var scan$$1 = function scan$$1(_, _object) {
return trigger$$1(uScan$$1, _, _object);
};
var uScan$$1 = {
string: function string(_, depth) {
var cache = new Set();
var uuids = get(_[DATAS], depth);
uuids.forEach(function (_uuid) {
cache.add(_[ENTITIES][_uuid]);
});
return cache;
},
array: function array(_, depths) {
var cache = {};
depths.forEach(function (depth) {
cache[depth] = uScan$$1.string(_, depth);
});
return cache;
},
object: function object(_, depths) {
var cache = {};
$(depths, function (k, depth) {
cache[k] = uScan$$1.string(_, depth);
});
return cache;
}
};
var HOOKS = Symbol('hooks');
var DATAS = Symbol('datas');
var ENTITIES = Symbol('entities');
var matchSlashPath = /\//g;

@@ -1147,5 +1267,8 @@ var matchPath = /\/|\./;

};
var initDatas = function initDatas() {
return {};
};
var get = function get(obj, path, def) {
if (matchSlashPath.test(path)) {
path = path.replace(matchSlashPath, ".");
path = path.replace(matchSlashPath, '.');
}

@@ -1155,3 +1278,3 @@

if (typeof result === "string" && matchPath.test(result)) {
if (typeof result === 'string' && matchPath.test(result)) {
return get(obj, result, def);

@@ -1164,3 +1287,3 @@ } else {

if (matchSlashPath.test(path)) {
path = path.replace(matchSlashPath, ".");
path = path.replace(matchSlashPath, '.');
}

@@ -1172,3 +1295,3 @@

if (matchSlashPath.test(path)) {
path = path.replace(matchSlashPath, ".");
path = path.replace(matchSlashPath, '.');
}

@@ -1178,3 +1301,2 @@

};
var HOOKS = Symbol("hooks");
var $ = function $(obj, cb) {

@@ -1234,3 +1356,3 @@ var _arr = Object.entries(obj);

onAny && onAny({
hook: "onAny",
hook: 'onAny',
object: object,

@@ -1244,5 +1366,5 @@ depth: newDepth,

if (_val) {
if (onFunction && typeof _val === "function") {
if (onFunction && typeof _val === 'function') {
onFunction({
hook: "onFunction",
hook: 'onFunction',
object: object,

@@ -1254,6 +1376,6 @@ depth: newDepth,

});
} else if ((onArray || onObject) && _typeof(_val) === "object") {
} else if ((onArray || onObject) && _typeof(_val) === 'object') {
if (Array.isArray(_val)) {
onArray({
hook: "onArray",
hook: 'onArray',
object: object,

@@ -1267,3 +1389,3 @@ depth: newDepth,

onObject({
hook: "onObject",
hook: 'onObject',
object: object[_key],

@@ -1278,3 +1400,3 @@ depth: newDepth,

onVariable && onVariable({
hook: "onVariable",
hook: 'onVariable',
object: object,

@@ -1289,3 +1411,3 @@ depth: newDepth,

onVariable && onVariable({
hook: "onVariable",
hook: 'onVariable',
object: object,

@@ -1304,26 +1426,26 @@ depth: newDepth,

var assign = Object.assign;
var $core = function $core(_, _object) {
_[HOOKS] = initHooks(_);
_._events = new events.EventEmitter();
var _assign;
_._events.on("$use", function (_object) {
return $use$$1(_, _object);
});
assign(_, (_assign = {}, _defineProperty(_assign, HOOKS, initHooks(_)), _defineProperty(_assign, DATAS, initDatas(_)), _defineProperty(_assign, ENTITIES, {}), _defineProperty(_assign, "_events", new events.EventEmitter()), _defineProperty(_assign, "$use", function $use(_object) {
_._events.emit('$use', _object);
_.$use = function (_object) {
_._events.emit("$use", _object);
return _;
}), _defineProperty(_assign, "$unuse", function $unuse(_object) {
_._events.emit('$unuse', _object);
return _;
};
}), _defineProperty(_assign, "scan", function scan$$2(_object) {
return scan$$1(_, _object);
}), _assign));
_._events.on("$unuse", function (_object) {
_._events.on('$use', function (_object) {
return $use$$1(_, _object);
});
_._events.on('$unuse', function (_object) {
return $unuse$$1(_, _object);
});
_.$unuse = function (_object) {
_._events.emit("$unuse", _object);
return _;
};
_.$use(_object);

@@ -1340,9 +1462,12 @@

exports.default = index;
exports.HOOKS = HOOKS;
exports.DATAS = DATAS;
exports.ENTITIES = ENTITIES;
exports.matchSlashPath = matchSlashPath;
exports.matchPath = matchPath;
exports.initHooks = initHooks;
exports.initDatas = initDatas;
exports.get = get;
exports.set = set$1;
exports.has = has;
exports.HOOKS = HOOKS;
exports.$ = $;

@@ -1352,5 +1477,7 @@ exports.$M = $M;

exports.$str = $str$$1;
exports.$exec = $exec$$1;
exports.$use = $use$$1;
exports._use = _use$$1;
exports.$unuse = $unuse$$1;
exports.$run = $run$$1;
exports._unuse = _unuse$$1;
exports._setSimple = _setSimple$$1;

@@ -1379,1 +1506,4 @@ exports._setAdvanced = _setAdvanced$$1;

exports._scanSimple = _scanSimple$$1;
exports.trigger = trigger$$1;
exports.scan = scan$$1;
exports.uScan = uScan$$1;
{
"name": "menhera",
"version": "0.7.8-rc1",
"version": "0.8.0",
"main": "dist/index.js",

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

@@ -0,0 +0,0 @@ # Menhera

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