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

@peersyst/react-hooks

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peersyst/react-hooks - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

11

esm/useControlled.js

@@ -0,7 +1,10 @@

import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useState } from "react";
export default function useControlled(defaultValue, value, onChange) {
var state = useState(defaultValue);
if (value !== undefined) return [value, onChange || function () {
return undefined;
}];else return state;
var _useState = useState(defaultValue),
_useState2 = _slicedToArray(_useState, 2),
state = _useState2[0],
setState = _useState2[1];
return [value || state, onChange || setState];
}

@@ -0,7 +1,10 @@

import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useState } from "react";
export default function useControlled(defaultValue, value, onChange) {
var state = useState(defaultValue);
if (value !== undefined) return [value, onChange || function () {
return undefined;
}];else return state;
var _useState = useState(defaultValue),
_useState2 = _slicedToArray(_useState, 2),
state = _useState2[0],
setState = _useState2[1];
return [value || state, onChange || setState];
}

@@ -0,7 +1,10 @@

import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useState } from "react";
export default function useControlled(defaultValue, value, onChange) {
var state = useState(defaultValue);
if (value !== undefined) return [value, onChange || function () {
return undefined;
}];else return state;
var _useState = useState(defaultValue),
_useState2 = _slicedToArray(_useState, 2),
state = _useState2[0],
setState = _useState2[1];
return [value || state, onChange || setState];
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,9 +10,13 @@ value: true

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = require("react");
function useControlled(defaultValue, value, onChange) {
var state = (0, _react.useState)(defaultValue);
if (value !== undefined) return [value, onChange || function () {
return undefined;
}];else return state;
var _useState = (0, _react.useState)(defaultValue),
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
state = _useState2[0],
setState = _useState2[1];
return [value || state, onChange || setState];
}
{
"name": "@peersyst/react-hooks",
"author": "Peersyst",
"version": "1.1.3",
"version": "1.1.4",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./node/index.js",

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