New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graffy/react

Package Overview
Dependencies
Maintainers
1
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graffy/react - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

111

GraffyConsumer.js

@@ -1,25 +0,40 @@

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
"use strict";
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
exports.__esModule = true;
exports["default"] = void 0;
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
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; }
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
function _asyncIterator(iterable) { var method; if (typeof Symbol !== "undefined") { if (Symbol.asyncIterator) { method = iterable[Symbol.asyncIterator]; if (method != null) return method.call(iterable); } if (Symbol.iterator) { method = iterable[Symbol.iterator]; if (method != null) return method.call(iterable); } } throw new TypeError("Object is not async iterable"); }
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
import React from 'react';
import PropTypes from 'prop-types';
import isEqual from 'lodash/isEqual';
import GraffyContext from './GraffyContext';
var Component = React.Component;
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inheritsLoose"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
var _asyncIterator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncIterator"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
var _GraffyContext = _interopRequireDefault(require("./GraffyContext"));
var Component = _react["default"].Component;
var GraffyConsumer =
/*#__PURE__*/
function (_Component) {
_inheritsLoose(GraffyConsumer, _Component);
(0, _inheritsLoose2["default"])(GraffyConsumer, _Component);
function GraffyConsumer() {
var _context;
var _this;

@@ -31,9 +46,7 @@

_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_defineProperty(_assertThisInitialized(_this), "state", {
_this = _Component.call.apply(_Component, (0, _concat["default"])(_context = [this]).call(_context, args)) || this;
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
data: null,
loading: null
});
return _this;

@@ -47,10 +60,10 @@ }

function () {
var _subscribe = _asyncToGenerator(
var _subscribe = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
_regenerator["default"].mark(function _callee() {
var store, query, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, data;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:

@@ -66,20 +79,20 @@ store = this.context;

_didIteratorError = false;
_context.prev = 7;
_iterator = _asyncIterator(this.subscription);
_context2.prev = 7;
_iterator = (0, _asyncIterator2["default"])(this.subscription);
case 9:
_context.next = 11;
_context2.next = 11;
return _iterator.next();
case 11:
_step = _context.sent;
_step = _context2.sent;
_iteratorNormalCompletion = _step.done;
_context.next = 15;
_context2.next = 15;
return _step.value;
case 15:
_value = _context.sent;
_value = _context2.sent;
if (_iteratorNormalCompletion) {
_context.next = 22;
_context2.next = 22;
break;

@@ -96,32 +109,32 @@ }

_iteratorNormalCompletion = true;
_context.next = 9;
_context2.next = 9;
break;
case 22:
_context.next = 28;
_context2.next = 28;
break;
case 24:
_context.prev = 24;
_context.t0 = _context["catch"](7);
_context2.prev = 24;
_context2.t0 = _context2["catch"](7);
_didIteratorError = true;
_iteratorError = _context.t0;
_iteratorError = _context2.t0;
case 28:
_context.prev = 28;
_context.prev = 29;
_context2.prev = 28;
_context2.prev = 29;
if (!(!_iteratorNormalCompletion && _iterator["return"] != null)) {
_context.next = 33;
_context2.next = 33;
break;
}
_context.next = 33;
_context2.next = 33;
return _iterator["return"]();
case 33:
_context.prev = 33;
_context2.prev = 33;
if (!_didIteratorError) {
_context.next = 36;
_context2.next = 36;
break;

@@ -133,10 +146,10 @@ }

case 36:
return _context.finish(33);
return _context2.finish(33);
case 37:
return _context.finish(28);
return _context2.finish(28);
case 38:
case "end":
return _context.stop();
return _context2.stop();
}

@@ -159,3 +172,3 @@ }

_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (isEqual(this.props.query, prevProps.query)) return;
if ((0, _isEqual["default"])(this.props.query, prevProps.query)) return;
this.subscribe();

@@ -171,9 +184,7 @@ };

_defineProperty(GraffyConsumer, "contextType", GraffyContext);
_defineProperty(GraffyConsumer, "propTypes", {
query: PropTypes.object,
children: PropTypes.func
});
export { GraffyConsumer as default };
exports["default"] = GraffyConsumer;
(0, _defineProperty2["default"])(GraffyConsumer, "contextType", _GraffyContext["default"]);
(0, _defineProperty2["default"])(GraffyConsumer, "propTypes", {
query: _propTypes["default"].object,
children: _propTypes["default"].func
});

@@ -1,16 +0,29 @@

import React from 'react';
import PropTypes from 'prop-types';
var createContext = React.createContext;
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
exports.__esModule = true;
exports.GraffyProvider = GraffyProvider;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var createContext = _react["default"].createContext;
var GraffyContext = createContext();
export default GraffyContext;
export function GraffyProvider(_ref) {
var _default = GraffyContext;
exports["default"] = _default;
function GraffyProvider(_ref) {
var store = _ref.store,
children = _ref.children;
return React.createElement(GraffyContext.Provider, {
return _react["default"].createElement(GraffyContext.Provider, {
value: store
}, children);
}
GraffyProvider.propTypes = {
store: PropTypes.object.isRequired,
children: PropTypes.node
store: _propTypes["default"].object.isRequired,
children: _propTypes["default"].node
};

@@ -1,3 +0,18 @@

export { GraffyProvider } from './GraffyContext';
export { default as GraffyConsumer } from './GraffyConsumer';
export { default as useGraffy } from './useGraffy';
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
exports.__esModule = true;
exports.useGraffy = exports.GraffyConsumer = exports.GraffyProvider = void 0;
var _GraffyContext = require("./GraffyContext");
exports.GraffyProvider = _GraffyContext.GraffyProvider;
var _GraffyConsumer = _interopRequireDefault(require("./GraffyConsumer"));
exports.GraffyConsumer = _GraffyConsumer["default"];
var _useGraffy = _interopRequireDefault(require("./useGraffy"));
exports.useGraffy = _useGraffy["default"];

@@ -5,3 +5,3 @@ {

"author": "aravind (https://github.com/aravindet)",
"version": "0.8.0",
"version": "0.8.1",
"repository": {

@@ -15,3 +15,6 @@ "type": "git",

"lodash": "^4.17.11"
},
"peerDependencies": {
"react": "^16.8.4"
}
}

@@ -1,24 +0,34 @@

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
"use strict";
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
function _asyncIterator(iterable) { var method; if (typeof Symbol !== "undefined") { if (Symbol.asyncIterator) { method = iterable[Symbol.asyncIterator]; if (method != null) return method.call(iterable); } if (Symbol.iterator) { method = iterable[Symbol.iterator]; if (method != null) return method.call(iterable); } } throw new TypeError("Object is not async iterable"); }
exports.__esModule = true;
exports["default"] = useGraffy;
import React from 'react';
import isEqual from 'lodash/isEqual';
import GraffyContext from './GraffyContext';
var useRef = React.useRef,
useState = React.useState,
useEffect = React.useEffect,
useContext = React.useContext;
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
var _asyncIterator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncIterator"));
var _react = _interopRequireDefault(require("react"));
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
var _GraffyContext = _interopRequireDefault(require("./GraffyContext"));
var useRef = _react["default"].useRef,
useState = _react["default"].useState,
useEffect = _react["default"].useEffect,
useContext = _react["default"].useContext;
var consumeSubscription =
/*#__PURE__*/
function () {
var _ref = _asyncToGenerator(
var _ref = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(sub, setValue, setLoading) {
_regenerator["default"].mark(function _callee(sub, setValue, setLoading) {
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, val;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {

@@ -30,3 +40,3 @@ switch (_context.prev = _context.next) {

_context.prev = 2;
_iterator = _asyncIterator(sub);
_iterator = (0, _asyncIterator2["default"])(sub);

@@ -111,3 +121,3 @@ case 4:

export default function useGraffy(query) {
function useGraffy(query) {
var queryRef = useRef(null);

@@ -123,4 +133,4 @@

var store = useContext(GraffyContext);
var queryHasChanged = !isEqual(queryRef.current, query);
var store = useContext(_GraffyContext["default"]);
var queryHasChanged = !(0, _isEqual["default"])(queryRef.current, query);
if (queryHasChanged) queryRef.current = query;

@@ -127,0 +137,0 @@ useEffect(function () {

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