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

@aboutbits/react-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aboutbits/react-toolbox - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

16

dist/async-data/AsyncView.d.ts

@@ -1,13 +0,13 @@

import React from 'react';
type LoadingFunction = () => React.ReactElement<any, any> | null;
type SuccessFunction<Data> = (data: Data) => React.ReactElement<any, any> | null;
type ErrorFunction<Error> = (error: Error) => React.ReactElement<any, any> | null;
import { ReactElement, ReactNode } from 'react';
type LoadingFunction = () => ReactNode;
type SuccessFunction<Data> = (data: NonNullable<Data>) => ReactNode;
type ErrorFunction<Error> = (error: NonNullable<Error>) => ReactNode;
type Props<Data, Error> = {
data?: Data;
error?: Error;
renderLoading?: React.ReactNode | LoadingFunction;
renderSuccess: React.ReactNode | SuccessFunction<Data>;
renderError?: React.ReactNode | ErrorFunction<Error>;
renderLoading?: ReactNode | LoadingFunction;
renderSuccess: ReactNode | SuccessFunction<Data>;
renderError?: ReactNode | ErrorFunction<Error>;
};
declare const AsyncView: <Data, Error_1>(props: Props<Data, Error_1>) => React.ReactElement<any, any> | null;
declare const AsyncView: <Data, Error_1>(props: Props<Data, Error_1>) => ReactElement<any, any> | null;
export { AsyncView };

@@ -9,12 +9,14 @@ "use strict";

var util_1 = require("../util");
var AsyncView = function (props) {
var AsyncView = function (props
// The `ReactElement<any, any> | null` type is for React 17 compatibility (see type FunctionComponent). With React 18 it can be a ReactNode and we can remove the Fragment wrappers.
) {
var data = props.data, error = props.error, _a = props.renderLoading, renderLoading = _a === void 0 ? null : _a, renderSuccess = props.renderSuccess, _b = props.renderError, renderError = _b === void 0 ? null : _b;
if (error != null && error != undefined) {
return (0, util_1.isFunction)(renderError) ? renderError(error) : react_1.default.createElement(react_1.default.Fragment, null, renderError);
if (error !== null && error !== undefined) {
return react_1.default.createElement(react_1.default.Fragment, null, (0, util_1.isFunction)(renderError) ? renderError(error) : renderError);
}
else if (data != null && data != undefined) {
return (0, util_1.isFunction)(renderSuccess) ? (renderSuccess(data)) : (react_1.default.createElement(react_1.default.Fragment, null, renderSuccess));
else if (data !== null && data !== undefined) {
return (react_1.default.createElement(react_1.default.Fragment, null, (0, util_1.isFunction)(renderSuccess) ? renderSuccess(data) : renderSuccess));
}
else {
return (0, util_1.isFunction)(renderLoading) ? renderLoading() : react_1.default.createElement(react_1.default.Fragment, null, renderLoading);
return react_1.default.createElement(react_1.default.Fragment, null, (0, util_1.isFunction)(renderLoading) ? renderLoading() : renderLoading);
}

@@ -21,0 +23,0 @@ };

@@ -1,13 +0,13 @@

import React from 'react';
type LoadingFunction = () => React.ReactElement<any, any> | null;
type SuccessFunction<Data> = (data: Data) => React.ReactElement<any, any> | null;
type ErrorFunction<Error> = (error: Error) => React.ReactElement<any, any> | null;
import { ReactElement, ReactNode } from 'react';
type LoadingFunction = () => ReactNode;
type SuccessFunction<Data> = (data: NonNullable<Data>) => ReactNode;
type ErrorFunction<Error> = (error: NonNullable<Error>) => ReactNode;
type Props<Data, Error> = {
data?: Data;
error?: Error;
renderLoading?: React.ReactNode | LoadingFunction;
renderSuccess: React.ReactNode | SuccessFunction<Data>;
renderError?: React.ReactNode | ErrorFunction<Error>;
renderLoading?: ReactNode | LoadingFunction;
renderSuccess: ReactNode | SuccessFunction<Data>;
renderError?: ReactNode | ErrorFunction<Error>;
};
declare const AsyncView: <Data, Error_1>(props: Props<Data, Error_1>) => React.ReactElement<any, any> | null;
declare const AsyncView: <Data, Error_1>(props: Props<Data, Error_1>) => ReactElement<any, any> | null;
export { AsyncView };
import React from 'react';
import { isFunction } from '../util';
var AsyncView = function (props) {
var AsyncView = function (props
// The `ReactElement<any, any> | null` type is for React 17 compatibility (see type FunctionComponent). With React 18 it can be a ReactNode and we can remove the Fragment wrappers.
) {
var data = props.data, error = props.error, _a = props.renderLoading, renderLoading = _a === void 0 ? null : _a, renderSuccess = props.renderSuccess, _b = props.renderError, renderError = _b === void 0 ? null : _b;
if (error != null && error != undefined) {
return isFunction(renderError) ? renderError(error) : React.createElement(React.Fragment, null, renderError);
if (error !== null && error !== undefined) {
return React.createElement(React.Fragment, null, isFunction(renderError) ? renderError(error) : renderError);
}
else if (data != null && data != undefined) {
return isFunction(renderSuccess) ? (renderSuccess(data)) : (React.createElement(React.Fragment, null, renderSuccess));
else if (data !== null && data !== undefined) {
return (React.createElement(React.Fragment, null, isFunction(renderSuccess) ? renderSuccess(data) : renderSuccess));
}
else {
return isFunction(renderLoading) ? renderLoading() : React.createElement(React.Fragment, null, renderLoading);
return React.createElement(React.Fragment, null, isFunction(renderLoading) ? renderLoading() : renderLoading);
}
};
export { AsyncView };
{
"name": "@aboutbits/react-toolbox",
"version": "0.2.1",
"version": "0.2.2",
"description": "Tools for React",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

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