Comparing version 0.7.5-rc1 to 0.7.5-rc2
@@ -10,2 +10,3 @@ 'use strict'; | ||
var lhas = _interopDefault(require('lodash.has')); | ||
var uuid = _interopDefault(require('uuid')); | ||
var events = require('events'); | ||
@@ -27,2 +28,17 @@ | ||
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) { | ||
@@ -66,45 +82,42 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
var handleHooks = function handleHooks(_ref) { | ||
var key = _ref.key, | ||
_key = _ref._key, | ||
_ = _ref._, | ||
_val = _ref._val, | ||
_object = _ref._object; | ||
var hooks = get(_[HOOKS], key); | ||
hooks && $(hooks, function (uuid$$1, h) { | ||
h({ | ||
_: _, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
}); | ||
}; | ||
var handleEachHooks = function handleEachHooks(_ref2) { | ||
var _ = _ref2._, | ||
key = _ref2.key, | ||
_key = _ref2._key, | ||
_val = _ref2._val, | ||
_object = _ref2._object; | ||
var hooks = get(_[HOOKS], key); | ||
hooks && $(_val, function (key, val) { | ||
$(hooks, function (uuid$$1, h) { | ||
return h({ | ||
_: _, | ||
_key: key, | ||
_val: val, | ||
cp: _object | ||
}); | ||
}); | ||
}); | ||
}; | ||
var useHooks = function useHooks(_2) { | ||
return { | ||
onAny: { | ||
any: function any(_ref) { | ||
var object = _ref.object, | ||
parentDepth = _ref.parentDepth, | ||
depth = _ref.depth, | ||
_key = _ref._key, | ||
_val = _ref._val, | ||
_object = _ref._object; | ||
var key = "".concat(depth); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
}); | ||
}, | ||
_: function _(_ref2) { | ||
var object = _ref2.object, | ||
depth = _ref2.depth, | ||
_key = _ref2._key, | ||
_val = _ref2._val, | ||
_object = _ref2._object; | ||
var __ = "".concat(depth, "._"); | ||
var hooks = get(_2[HOOKS], __, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
}); | ||
} | ||
}, | ||
onObject: { | ||
O: function O(_ref3) { | ||
any: function any(_ref3) { | ||
var object = _ref3.object, | ||
@@ -116,14 +129,13 @@ parentDepth = _ref3.parentDepth, | ||
_object = _ref3._object; | ||
var key = "".concat(depth, ".O"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
if (_typeof(_val) === "object") return; | ||
var key = "".concat(depth); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$: function $$$1(_ref4) { | ||
_: function _(_ref4) { | ||
var object = _ref4.object, | ||
@@ -134,17 +146,16 @@ depth = _ref4.depth, | ||
_object = _ref4._object; | ||
var key = "".concat(depth, ".$"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && $(_val, function (key, val) { | ||
hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: key, | ||
_val: val, | ||
cp: _object | ||
}); | ||
}); | ||
var key = "".concat(depth, "._"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
O$: function O$(_ref5) { | ||
} | ||
}, | ||
onObject: { | ||
O: function O(_ref5) { | ||
var object = _ref5.object, | ||
parentDepth = _ref5.parentDepth, | ||
depth = _ref5.depth, | ||
@@ -154,18 +165,13 @@ _key = _ref5._key, | ||
_object = _ref5._object; | ||
var key = "".concat(depth, ".O$"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && $(_val, function (key, val) { | ||
hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: key, | ||
_val: val, | ||
cp: _object | ||
}); | ||
}); | ||
var key = "".concat(depth, ".O"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$O: function $O(_ref6) { | ||
$: function $$$1(_ref6) { | ||
var object = _ref6.object, | ||
parentDepth = _ref6.parentDepth, | ||
depth = _ref6.depth, | ||
@@ -175,18 +181,12 @@ _key = _ref6._key, | ||
_object = _ref6._object; | ||
var key = "".concat(parentDepth, ".$O"); | ||
var $hooks = get(_2[HOOKS], key, []); | ||
$hooks.length > 0 && $hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(depth, ".$"); | ||
handleEachHooks({ | ||
key: key, | ||
_: _2, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onArray: { | ||
A: function A(_ref7) { | ||
}, | ||
O$: function O$(_ref7) { | ||
var object = _ref7.object, | ||
parentDepth = _ref7.parentDepth, | ||
depth = _ref7.depth, | ||
@@ -196,14 +196,11 @@ _key = _ref7._key, | ||
_object = _ref7._object; | ||
var key = "".concat(depth, ".A"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(depth, ".O$"); | ||
handleEachHooks({ | ||
key: key, | ||
_: _2, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
A$: function A$(_ref8) { | ||
$O: function $O(_ref8) { | ||
var object = _ref8.object, | ||
@@ -215,16 +212,14 @@ parentDepth = _ref8.parentDepth, | ||
_object = _ref8._object; | ||
var key = "".concat(depth, ".A$"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && $(_val, function (key, val) { | ||
hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: key, | ||
_val: val, | ||
cp: _object | ||
}); | ||
}); | ||
var key = "".concat(parentDepth, ".$O"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$A: function $A(_ref9) { | ||
} | ||
}, | ||
onArray: { | ||
A: function A(_ref9) { | ||
var object = _ref9.object, | ||
@@ -236,16 +231,12 @@ parentDepth = _ref9.parentDepth, | ||
_object = _ref9._object; | ||
var key = "".concat(parentDepth, ".$A"); | ||
var $hooks = get(_2[HOOKS], key, []); | ||
$hooks.length > 0 && $hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(depth, ".A"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onFunction: { | ||
F: function F(_ref10) { | ||
}, | ||
A$: function A$(_ref10) { | ||
var object = _ref10.object, | ||
@@ -257,14 +248,11 @@ parentDepth = _ref10.parentDepth, | ||
_object = _ref10._object; | ||
var key = "".concat(depth, ".F"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(depth, ".A$"); | ||
handleEachHooks({ | ||
key: key, | ||
_: _2, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$F: function $F(_ref11) { | ||
$A: function $A(_ref11) { | ||
var object = _ref11.object, | ||
@@ -276,16 +264,14 @@ parentDepth = _ref11.parentDepth, | ||
_object = _ref11._object; | ||
var key = "".concat(parentDepth, ".$F"); | ||
var $hooks = get(_2[HOOKS], key, []); | ||
$hooks.length > 0 && $hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(parentDepth, ".$A"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onVariable: { | ||
V: function V(_ref12) { | ||
onFunction: { | ||
F: function F(_ref12) { | ||
var object = _ref12.object, | ||
@@ -297,14 +283,12 @@ parentDepth = _ref12.parentDepth, | ||
_object = _ref12._object; | ||
var key = "".concat(depth, ".V"); | ||
var hooks = get(_2[HOOKS], key, []); | ||
hooks.length > 0 && hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
var key = "".concat(depth, ".F"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$V: function $V(_ref13) { | ||
$F: function $F(_ref13) { | ||
var object = _ref13.object, | ||
@@ -316,11 +300,43 @@ parentDepth = _ref13.parentDepth, | ||
_object = _ref13._object; | ||
var key = "".concat(parentDepth, ".$F"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onVariable: { | ||
V: function V(_ref14) { | ||
var object = _ref14.object, | ||
parentDepth = _ref14.parentDepth, | ||
depth = _ref14.depth, | ||
_key = _ref14._key, | ||
_val = _ref14._val, | ||
_object = _ref14._object; | ||
var key = "".concat(depth, ".V"); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$V: function $V(_ref15) { | ||
var object = _ref15.object, | ||
parentDepth = _ref15.parentDepth, | ||
depth = _ref15.depth, | ||
_key = _ref15._key, | ||
_val = _ref15._val, | ||
_object = _ref15._object; | ||
var key = "".concat(parentDepth, ".$V"); | ||
var $hooks = get(_2[HOOKS], key, []); | ||
$hooks.length > 0 && $hooks.forEach(function (h) { | ||
return h({ | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
cp: _object | ||
}); | ||
handleHooks({ | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
@@ -335,2 +351,3 @@ } | ||
var hooks = useHooks(_); | ||
_object.uuid = uuid.v1(); | ||
@@ -347,4 +364,4 @@ var BindHook = function BindHook(_ref) { | ||
var _hooks$$1 = hooks[hook]; | ||
_hooks$$1 && $(_hooks$$1, function (key, hook) { | ||
hook({ | ||
_hooks$$1 && $(_hooks$$1, function (key, shook) { | ||
shook({ | ||
hook: hook, | ||
@@ -864,6 +881,6 @@ object: object, | ||
cache._hooks = { | ||
_: [_hooks$$1._] | ||
_: _defineProperty({}, uuid.v1(), _hooks$$1._) | ||
}; | ||
cache._mount = { | ||
$: [_mount$$1.$] | ||
$: _defineProperty({}, uuid.v1(), _mount$$1.$) | ||
}; | ||
@@ -873,31 +890,15 @@ return cache; | ||
var _hooks$$1 = { | ||
_: function _(_ref) { | ||
var _2 = _ref._, | ||
_val = _ref._val, | ||
cp = _ref.cp; | ||
_: function _(_ref2) { | ||
var _2 = _ref2._, | ||
_val = _ref2._val, | ||
cp = _ref2.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.includes(_val.bind(cp))) { | ||
target.push(_val.bind(cp)); | ||
set$1(_2[HOOKS], depth, target); // } | ||
}; | ||
var onVariable = function onVariable(_ref3) { | ||
var onFunction = function onFunction(_ref3) { | ||
var depth = _ref3.depth, | ||
_val = _ref3._val; | ||
if (Array.isArray(_val)) { | ||
$(_val, function (key, val) { | ||
if (typeof val === "function") { | ||
onFunction({ | ||
depth: depth, | ||
_val: val | ||
}); | ||
} | ||
}); | ||
} | ||
var target = get(_2[HOOKS], depth, {}); | ||
target[uuid$$1] = _val.bind(cp); | ||
set$1(_2[HOOKS], depth, target); | ||
}; | ||
@@ -914,4 +915,3 @@ | ||
onObject: onObject, | ||
onFunction: onFunction, | ||
onVariable: onVariable | ||
onFunction: onFunction | ||
}); | ||
@@ -1094,2 +1094,3 @@ }; | ||
exports.uuid = uuid; | ||
exports.$core = $core; | ||
@@ -1096,0 +1097,0 @@ exports.default = index; |
{ | ||
"name": "menhera", | ||
"version": "0.7.5-rc1", | ||
"version": "0.7.5-rc2", | ||
"main": "dist/index.js", | ||
@@ -14,2 +14,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/uuid": "^3.4.3", | ||
"bili": "^3.1.0", | ||
@@ -22,4 +23,5 @@ "menhera": "^0.7.4-rc1", | ||
"lodash.has": "^4.5.2", | ||
"lodash.set": "^4.3.2" | ||
"lodash.set": "^4.3.2", | ||
"uuid": "^3.2.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1012
27533
4
4
+ Addeduuid@^3.2.1
+ Addeduuid@3.4.0(transitive)