MCPcopy Create free account
hub / github.com/RubyLouvre/anu / wrapWithStateOrWrapper

Function wrapWithStateOrWrapper

test/babel.js:42739–42773  ·  view source on GitHub ↗
(oldVisitor, state, wrapper)

Source from the content-addressed store, hash-verified

42737 }
42738
42739 function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
42740 var newVisitor = {};
42741
42742 var _loop = function _loop(key) {
42743 var fns = oldVisitor[key];
42744
42745 if (!Array.isArray(fns)) return "continue";
42746
42747 fns = fns.map(function (fn) {
42748 var newFn = fn;
42749
42750 if (state) {
42751 newFn = function newFn(path) {
42752 return fn.call(state, path, state);
42753 };
42754 }
42755
42756 if (wrapper) {
42757 newFn = wrapper(state.key, key, newFn);
42758 }
42759
42760 return newFn;
42761 });
42762
42763 newVisitor[key] = fns;
42764 };
42765
42766 for (var key in oldVisitor) {
42767 var _ret = _loop(key);
42768
42769 if (_ret === "continue") continue;
42770 }
42771
42772 return newVisitor;
42773 }
42774
42775 function ensureEntranceObjects(obj) {
42776 for (var key in obj) {

Callers 1

mergeFunction · 0.85

Calls 1

_loopFunction · 0.85

Tested by

no test coverage detected