Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fetch-component-data

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-component-data - npm Package Compare versions

Comparing version 7.6.20 to 7.8.0

175

lib/fetchComponentData.js

@@ -18,6 +18,14 @@ "use strict";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _excluded = ["store", "action", "parallel"];
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
// Executes fetchdata on a component, handles async or callback formats

@@ -65,6 +73,4 @@ function executeFetch(Component, executeFetchOpts) {

function _executeFetchComponentData2() {
_executeFetchComponentData2 = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee(options) {
var store, action, parallel, rest, promises, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, branch, match, route, Component, componentModule, p, _res, results, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, res;
_executeFetchComponentData2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
var store, action, parallel, rest, promises, result, _iterator, _step, branch, match, route, Component, componentModule, p, _res, results, _iterator2, _step2, res;

@@ -75,14 +81,13 @@ return _regenerator["default"].wrap(function _callee$(_context) {

case 0:
store = options.store, action = options.action, parallel = options.parallel, rest = (0, _objectWithoutProperties2["default"])(options, ["store", "action", "parallel"]);
store = options.store, action = options.action, parallel = options.parallel, rest = (0, _objectWithoutProperties2["default"])(options, _excluded);
promises = [];
result = {};
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 6;
_iterator = options.branch[Symbol.iterator]();
_iterator = _createForOfIteratorHelper(options.branch);
_context.prev = 4;
case 8:
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context.next = 33;
_iterator.s();
case 6:
if ((_step = _iterator.n()).done) {
_context.next = 30;
break;

@@ -96,22 +101,22 @@ }

if (Component) {
_context.next = 14;
_context.next = 12;
break;
}
return _context.abrupt("continue", 30);
return _context.abrupt("continue", 28);
case 14:
case 12:
if (!Component.load) {
_context.next = 19;
_context.next = 17;
break;
}
_context.next = 17;
_context.next = 15;
return Component.load();
case 17:
case 15:
componentModule = _context.sent;
Component = componentModule["default"];
case 19:
case 17:
while (Component.WrappedComponent) {

@@ -122,7 +127,7 @@ Component = Component.WrappedComponent;

if (!Component.fetchData) {
_context.next = 30;
_context.next = 28;
break;
}
p = executeFetch(Component, _objectSpread({}, rest, {
p = executeFetch(Component, _objectSpread(_objectSpread({}, rest), {}, {
store: store,

@@ -135,3 +140,3 @@ action: action,

if (!parallel) {
_context.next = 26;
_context.next = 24;
break;

@@ -141,110 +146,62 @@ }

promises.push(p);
_context.next = 30;
_context.next = 28;
break;
case 26:
_context.next = 28;
case 24:
_context.next = 26;
return p;
case 28:
case 26:
_res = _context.sent;
if (_res) result = _objectSpread({}, result, {}, _res);
if (_res) result = _objectSpread(_objectSpread({}, result), _res);
case 30:
_iteratorNormalCompletion = true;
_context.next = 8;
case 28:
_context.next = 6;
break;
case 33:
_context.next = 39;
case 30:
_context.next = 35;
break;
case 32:
_context.prev = 32;
_context.t0 = _context["catch"](4);
_iterator.e(_context.t0);
case 35:
_context.prev = 35;
_context.t0 = _context["catch"](6);
_didIteratorError = true;
_iteratorError = _context.t0;
case 39:
_context.prev = 39;
_context.prev = 40;
_iterator.f();
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
return _context.finish(35);
case 42:
_context.prev = 42;
if (!_didIteratorError) {
_context.next = 45;
break;
}
throw _iteratorError;
case 45:
return _context.finish(42);
case 46:
return _context.finish(39);
case 47:
case 38:
if (!parallel) {
_context.next = 70;
_context.next = 44;
break;
}
_context.next = 50;
_context.next = 41;
return Promise.all(promises);
case 50:
case 41:
results = _context.sent;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 54;
_iterator2 = _createForOfIteratorHelper(results);
for (_iterator2 = results[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
res = _step2.value;
if (res) result = _objectSpread({}, result, {}, res);
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
res = _step2.value;
if (res) result = _objectSpread(_objectSpread({}, result), res);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
_context.next = 62;
break;
case 58:
_context.prev = 58;
_context.t1 = _context["catch"](54);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 62:
_context.prev = 62;
_context.prev = 63;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 65:
_context.prev = 65;
if (!_didIteratorError2) {
_context.next = 68;
break;
}
throw _iteratorError2;
case 68:
return _context.finish(65);
case 69:
return _context.finish(62);
case 70:
case 44:
return _context.abrupt("return", result);
case 71:
case 45:
case "end":

@@ -254,3 +211,3 @@ return _context.stop();

}
}, _callee, null, [[6, 35, 39, 47], [40,, 42, 46], [54, 58, 62, 70], [63,, 65, 69]]);
}, _callee, null, [[4, 32, 35, 38]]);
}));

@@ -265,5 +222,3 @@ return _executeFetchComponentData2.apply(this, arguments);

function _fetchComponentData() {
_fetchComponentData = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee2(options, callback) {
_fetchComponentData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(options, callback) {
var res;

@@ -270,0 +225,0 @@ return _regenerator["default"].wrap(function _callee2$(_context2) {

{
"name": "fetch-component-data",
"version": "7.6.20",
"version": "7.8.0",
"description": "Small util functions for Frameworkstein",

@@ -32,3 +32,3 @@ "main": "lib/index.js",

"babel-jest": "^24.0.0",
"jest": "^24.0.0"
"jest": "^27.0.0"
},

@@ -35,0 +35,0 @@ "jest": {

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