Comparing version 0.6.3 to 0.6.4-rc1
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports._mount = exports._hooks = exports.$get = exports.$set = exports.$use = exports.$core = undefined; | ||
exports.$core = undefined; | ||
@@ -27,6 +27,2 @@ var _regenerator = require("babel-runtime/regenerator"); | ||
var _hooks2 = require("./utils/hooks"); | ||
var initHooks = _interopRequireWildcard(_hooks2); | ||
var _lodash = require("lodash.get"); | ||
@@ -45,11 +41,4 @@ | ||
var $core = exports.$core = function $core(_, _object) { | ||
_.hooks = {}; | ||
_.hooks = (0, _utils.initHooks)(_); | ||
_.hooks._hooks = { _: [_hooks] }; | ||
(0, _utils.$)(initHooks, function (key, val) { | ||
_.hooks[key] = val(_); | ||
}); | ||
_.scan = {}; | ||
(0, _utils.$)(scan, function (key, val) { | ||
_.scan[key] = val(_); | ||
}); | ||
_.$use = function (_object) { | ||
@@ -69,9 +58,9 @@ return $use(_, _object); | ||
var $use = exports.$use = function $use(_, _object) { | ||
var $use = function $use(_, _object) { | ||
if ((typeof _object === "undefined" ? "undefined" : (0, _typeof3.default)(_object)) === "object") { | ||
_.scan.$use(_object); | ||
scan.$use(_, _object); | ||
} | ||
if (Array.isArray(_object)) { | ||
_object.forEach(function (o) { | ||
_.scan.$use(o); | ||
scan.$use(_, o); | ||
}); | ||
@@ -82,15 +71,15 @@ } | ||
var $set = exports.$set = function $set(_, _object) { | ||
var $set = function $set(_, _object) { | ||
if ((typeof _object === "undefined" ? "undefined" : (0, _typeof3.default)(_object)) === "object") { | ||
return _.scan.$set(_object); | ||
return scan.$set(_, _object); | ||
} | ||
}; | ||
var $get = exports.$get = function $get(_, _object) { | ||
var $get = function $get(_, _object) { | ||
if ((typeof _object === "undefined" ? "undefined" : (0, _typeof3.default)(_object)) === "object") { | ||
return _.scan.$get(_object); | ||
return scan.$get(_, _object); | ||
} | ||
}; | ||
var _hooks = exports._hooks = function _hooks(_ref) { | ||
var _hooks = function _hooks(_ref) { | ||
var _ = _ref._, | ||
@@ -101,17 +90,47 @@ _val = _ref._val, | ||
if ((typeof _val === "undefined" ? "undefined" : (0, _typeof3.default)(_val)) === "object") { | ||
_.scan._hook(_val, cp); | ||
var onFunction = function onFunction(_ref2) { | ||
var depth = _ref2.depth, | ||
_val = _ref2._val; | ||
var target = (0, _lodash2.default)(_.hooks, depth, []); | ||
if (!target.includes(_val.bind(cp))) { | ||
target.push(_val.bind(cp)); | ||
(0, _lodash4.default)(_.hooks, depth, target); | ||
} | ||
}; | ||
var onVariable = function onVariable(_ref3) { | ||
var depth = _ref3.depth, | ||
_val = _ref3._val; | ||
if (Array.isArray(_val)) { | ||
_val.forEach(function (val) { | ||
if (typeof val === "function") { | ||
onFunction({ depth: depth, _val: val }); | ||
} | ||
}); | ||
} | ||
}; | ||
var onObject = function onObject(_ref4) { | ||
var object = _ref4.object, | ||
depth = _ref4.depth, | ||
_key = _ref4._key, | ||
_val = _ref4._val; | ||
(0, _utils.scanObject)({ object: object, depth: depth, onObject: onObject, onFunction: onFunction, onVariable: onVariable }); | ||
}; | ||
onObject({ object: _val, depth: "" }); | ||
} | ||
}; | ||
var _mount = exports._mount = { | ||
$: function $(_ref2) { | ||
var _mount = { | ||
$: function $(_ref5) { | ||
var _this = this; | ||
var _ = _ref2._, | ||
_val = _ref2._val, | ||
cp = _ref2.cp; | ||
var _ = _ref5._, | ||
_val = _ref5._val, | ||
cp = _ref5.cp; | ||
var cps = Array.isArray(_val) ? _val : [_val]; | ||
cps.forEach(function () { | ||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(component) { | ||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(component) { | ||
var cp, name; | ||
@@ -146,3 +165,3 @@ return _regenerator2.default.wrap(function _callee$(_context) { | ||
return function (_x) { | ||
return _ref3.apply(this, arguments); | ||
return _ref6.apply(this, arguments); | ||
}; | ||
@@ -149,0 +168,0 @@ }()); |
@@ -19,2 +19,14 @@ "use strict"; | ||
var _scan = require("./utils/scan"); | ||
Object.keys(_scan).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _scan[key]; | ||
} | ||
}); | ||
}); | ||
var _core = require("./core"); | ||
@@ -21,0 +33,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.scanObject = exports.$ = undefined; | ||
exports.scanObject = exports.initHooks = exports.$ = undefined; | ||
@@ -25,2 +25,8 @@ var _regenerator = require("babel-runtime/regenerator"); | ||
var _hooks = require("./hooks"); | ||
var _initHooks = _interopRequireWildcard(_hooks); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -59,2 +65,9 @@ | ||
}; | ||
var initHooks = exports.initHooks = function initHooks(_) { | ||
var cache = {}; | ||
$(_initHooks, function (key, val) { | ||
cache[key] = val(_); | ||
}); | ||
return cache; | ||
}; | ||
@@ -61,0 +74,0 @@ var scanObject = exports.scanObject = function () { |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports._hook = exports.$get = exports.$set = exports.$use = undefined; | ||
exports.$get = exports.$set = exports.$use = undefined; | ||
@@ -21,163 +21,122 @@ var _utils = require("../utils"); | ||
var $use = exports.$use = function $use(_) { | ||
return function (_object) { | ||
var hooks = _.hooks["$use"]; | ||
var BindHook = function BindHook(_ref) { | ||
var hook = _ref.hook, | ||
object = _ref.object, | ||
depth = _ref.depth, | ||
parentDepth = _ref.parentDepth, | ||
_key = _ref._key, | ||
_val = _ref._val; | ||
var $use = exports.$use = function $use(_, _object) { | ||
var hooks = _.hooks["$use"]; | ||
var BindHook = function BindHook(_ref) { | ||
var hook = _ref.hook, | ||
object = _ref.object, | ||
depth = _ref.depth, | ||
parentDepth = _ref.parentDepth, | ||
_key = _ref._key, | ||
_val = _ref._val; | ||
(0, _utils.$)(hooks[hook], function (key, hook) { | ||
hook({ object: object, parentDepth: parentDepth, depth: depth, _key: _key, _val: _val, _object: _object }); | ||
}); | ||
}; | ||
var _hooks = hooks[hook]; | ||
_hooks && (0, _utils.$)(_hooks, function (key, hook) { | ||
hook({ hook: hook, object: object, parentDepth: parentDepth, depth: depth, _key: _key, _val: _val, _object: _object }); | ||
}); | ||
}; | ||
var onObject = function onObject(data) { | ||
var object = data.object, | ||
hook = data.hook, | ||
depth = data.depth; | ||
var onObject = function onObject(data) { | ||
var object = data.object, | ||
hook = data.hook, | ||
depth = data.depth; | ||
hook && BindHook(data); | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onVariable: BindHook, | ||
onFunction: BindHook, | ||
onArray: BindHook, | ||
onAny: BindHook | ||
}); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
hook && BindHook(data); | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onVariable: BindHook, | ||
onFunction: BindHook, | ||
onArray: BindHook, | ||
onAny: BindHook | ||
}); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
}; | ||
var $set = exports.$set = function $set(_) { | ||
return function (_object) { | ||
var cache = {}; | ||
var onVariable = function onVariable(_ref2) { | ||
var object = _ref2.object, | ||
depth = _ref2.depth, | ||
_key = _ref2._key, | ||
_val = _ref2._val; | ||
var $set = exports.$set = function $set(_, _object) { | ||
var cache = {}; | ||
var onVariable = function onVariable(_ref2) { | ||
var object = _ref2.object, | ||
depth = _ref2.depth, | ||
_key = _ref2._key, | ||
_val = _ref2._val; | ||
(0, _lodash4.default)(_, depth, _val); | ||
(0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var onFunction = function onFunction(_ref3) { | ||
var object = _ref3.object, | ||
depth = _ref3.depth, | ||
_key = _ref3._key, | ||
_val = _ref3._val; | ||
(0, _lodash4.default)(_, depth, _val); | ||
(0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var onFunction = function onFunction(_ref3) { | ||
var object = _ref3.object, | ||
depth = _ref3.depth, | ||
_key = _ref3._key, | ||
_val = _ref3._val; | ||
var tar = (0, _lodash2.default)(_, depth); | ||
var result = _val({ tar: tar }); | ||
(0, _lodash4.default)(_, depth, result); | ||
(0, _lodash4.default)(cache, depth, result); | ||
}; | ||
var tar = (0, _lodash2.default)(_, depth); | ||
var result = _val({ tar: tar }); | ||
(0, _lodash4.default)(_, depth, result); | ||
(0, _lodash4.default)(cache, depth, result); | ||
}; | ||
var onObject = function onObject(_ref4) { | ||
var object = _ref4.object, | ||
depth = _ref4.depth, | ||
_key = _ref4._key, | ||
_val = _ref4._val; | ||
var onObject = function onObject(_ref4) { | ||
var object = _ref4.object, | ||
depth = _ref4.depth, | ||
_key = _ref4._key, | ||
_val = _ref4._val; | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onVariable: onVariable, | ||
onFunction: onFunction, | ||
onArray: onVariable | ||
}); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
return cache; | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onVariable: onVariable, | ||
onFunction: onFunction, | ||
onArray: onVariable | ||
}); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
return cache; | ||
}; | ||
var $get = exports.$get = function $get(_) { | ||
return function (_object) { | ||
var cache = {}; | ||
var onVariable = function onVariable(_ref5) { | ||
var object = _ref5.object, | ||
depth = _ref5.depth, | ||
_key = _ref5._key, | ||
_val = _ref5._val; | ||
var $get = exports.$get = function $get(_, _object) { | ||
var cache = {}; | ||
var onVariable = function onVariable(_ref5) { | ||
var object = _ref5.object, | ||
depth = _ref5.depth, | ||
_key = _ref5._key, | ||
_val = _ref5._val; | ||
var result = (0, _lodash2.default)(_, depth); | ||
result && (0, _lodash4.default)(cache, depth, result); | ||
!result && (0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var result = (0, _lodash2.default)(_, depth); | ||
result && (0, _lodash4.default)(cache, depth, result); | ||
!result && (0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var onFunction = function onFunction(_ref6) { | ||
var object = _ref6.object, | ||
depth = _ref6.depth, | ||
_key = _ref6._key, | ||
_val = _ref6._val; | ||
var onFunction = function onFunction(_ref6) { | ||
var object = _ref6.object, | ||
depth = _ref6.depth, | ||
_key = _ref6._key, | ||
_val = _ref6._val; | ||
var tar = (0, _lodash2.default)(_, depth); | ||
var result = _val({ tar: tar }); | ||
result && (0, _lodash4.default)(cache, depth, result); | ||
!result && (0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var tar = (0, _lodash2.default)(_, depth); | ||
var result = _val({ tar: tar }); | ||
result && (0, _lodash4.default)(cache, depth, result); | ||
!result && (0, _lodash4.default)(cache, depth, _val); | ||
}; | ||
var onObject = function onObject(_ref7) { | ||
var object = _ref7.object, | ||
depth = _ref7.depth, | ||
_key = _ref7._key, | ||
_val = _ref7._val; | ||
var onObject = function onObject(_ref7) { | ||
var object = _ref7.object, | ||
depth = _ref7.depth, | ||
_key = _ref7._key, | ||
_val = _ref7._val; | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onFunction: onFunction, | ||
onVariable: onVariable, | ||
onArray: onVariable | ||
}); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
return cache; | ||
(0, _utils.scanObject)({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onFunction: onFunction, | ||
onVariable: onVariable, | ||
onArray: onVariable | ||
}); | ||
}; | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
var _hook = exports._hook = function _hook(_) { | ||
return function (_object, cp) { | ||
var onFunction = function onFunction(_ref8) { | ||
var depth = _ref8.depth, | ||
_val = _ref8._val; | ||
var target = (0, _lodash2.default)(_.hooks, depth, []); | ||
if (!target.includes(_val.bind(cp))) { | ||
target.push(_val.bind(cp)); | ||
(0, _lodash4.default)(_.hooks, depth, target); | ||
} | ||
}; | ||
var onVariable = function onVariable(_ref9) { | ||
var depth = _ref9.depth, | ||
_val = _ref9._val; | ||
if (Array.isArray(_val)) { | ||
_val.forEach(function (val) { | ||
if (typeof val === "function") { | ||
onFunction({ depth: depth, _val: val }); | ||
} | ||
}); | ||
} | ||
}; | ||
var onObject = function onObject(_ref10) { | ||
var object = _ref10.object, | ||
depth = _ref10.depth, | ||
_key = _ref10._key, | ||
_val = _ref10._val; | ||
(0, _utils.scanObject)({ object: object, depth: depth, onObject: onObject, onFunction: onFunction, onVariable: onVariable }); | ||
}; | ||
onObject({ object: _object, depth: "" }); | ||
}; | ||
return cache; | ||
}; |
{ | ||
"name": "menhera", | ||
"version": "0.6.3", | ||
"version": "0.6.4-rc1", | ||
"main": "dist", | ||
@@ -5,0 +5,0 @@ "files": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23849
617
0