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

@restart/hooks

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/hooks - npm Package Compare versions

Comparing version 0.3.25 to 0.3.26

2

cjs/useBreakpoint.d.ts

@@ -26,3 +26,3 @@ export declare type BreakpointDirection = 'up' | 'down' | true;

export declare function createBreakpointHook<TKey extends string>(breakpointValues: Record<TKey, string | number>): {
(breakpointMap: Partial<Record<TKey, BreakpointDirection>>): boolean;
(breakpointMap: BreakpointMap<TKey>): boolean;
(breakpoint: TKey, direction?: true | "up" | "down" | undefined): boolean;

@@ -29,0 +29,0 @@ };

@@ -25,2 +25,5 @@ /**

*/
export default function useCallbackRef<TValue = unknown>(): [TValue | null, (ref: TValue | null) => void];
export default function useCallbackRef<TValue = unknown>(): [
TValue | null,
(ref: TValue | null) => void
];

@@ -16,5 +16,5 @@ "use strict";

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

@@ -27,5 +27,3 @@ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

var ObservableMap =
/*#__PURE__*/
function (_Map) {
var ObservableMap = /*#__PURE__*/function (_Map) {
_inheritsLoose(ObservableMap, _Map);

@@ -66,5 +64,3 @@

return ObservableMap;
}(
/*#__PURE__*/
_wrapNativeSuper(Map));
}( /*#__PURE__*/_wrapNativeSuper(Map));
/**

@@ -71,0 +67,0 @@ * Create and return a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) that triggers rerenders when it's updated.

@@ -36,7 +36,7 @@ "use strict";

var nextState = update(state);
return nextState == null ? state : _extends({}, state, {}, nextState);
return nextState == null ? state : _extends({}, state, nextState);
});
} else {
setState(function (state) {
return _extends({}, state, {}, update);
return _extends({}, state, update);
});

@@ -43,0 +43,0 @@ }

@@ -16,5 +16,5 @@ "use strict";

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

@@ -27,5 +27,3 @@ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

var ObservableSet =
/*#__PURE__*/
function (_Set) {
var ObservableSet = /*#__PURE__*/function (_Set) {
_inheritsLoose(ObservableSet, _Set);

@@ -66,5 +64,3 @@

return ObservableSet;
}(
/*#__PURE__*/
_wrapNativeSuper(Set));
}( /*#__PURE__*/_wrapNativeSuper(Set));
/**

@@ -71,0 +67,0 @@ * Create and return a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that triggers rerenders when it's updated.

/**
* Returns a controller object for setting a timeout that is properly cleaned up
* once the component unmounts. New timeouts cancel and replace existing ones.
*
*
*
* ```tsx
* const { set, clear } = useTimeout();
* const [hello, showHello] = useState(false);
* //Display hello after 5 seconds
* set(() => showHello(true), 5000);
* return (
* <div className="App">
* {hello ? <h3>Hello</h3> : null}
* </div>
* );
* ```
*/

@@ -5,0 +19,0 @@ export default function useTimeout(): {

@@ -33,2 +33,16 @@ "use strict";

* once the component unmounts. New timeouts cancel and replace existing ones.
*
*
*
* ```tsx
* const { set, clear } = useTimeout();
* const [hello, showHello] = useState(false);
* //Display hello after 5 seconds
* set(() => showHello(true), 5000);
* return (
* <div className="App">
* {hello ? <h3>Hello</h3> : null}
* </div>
* );
* ```
*/

@@ -35,0 +49,0 @@

@@ -26,3 +26,3 @@ export declare type BreakpointDirection = 'up' | 'down' | true;

export declare function createBreakpointHook<TKey extends string>(breakpointValues: Record<TKey, string | number>): {
(breakpointMap: Partial<Record<TKey, BreakpointDirection>>): boolean;
(breakpointMap: BreakpointMap<TKey>): boolean;
(breakpoint: TKey, direction?: true | "up" | "down" | undefined): boolean;

@@ -29,0 +29,0 @@ };

@@ -25,2 +25,5 @@ /**

*/
export default function useCallbackRef<TValue = unknown>(): [TValue | null, (ref: TValue | null) => void];
export default function useCallbackRef<TValue = unknown>(): [
TValue | null,
(ref: TValue | null) => void
];

@@ -5,5 +5,5 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

@@ -18,5 +18,3 @@ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

import useStableMemo from './useStableMemo';
export var ObservableMap =
/*#__PURE__*/
function (_Map) {
export var ObservableMap = /*#__PURE__*/function (_Map) {
_inheritsLoose(ObservableMap, _Map);

@@ -57,5 +55,3 @@

return ObservableMap;
}(
/*#__PURE__*/
_wrapNativeSuper(Map));
}( /*#__PURE__*/_wrapNativeSuper(Map));
/**

@@ -62,0 +58,0 @@ * Create and return a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) that triggers rerenders when it's updated.

@@ -31,7 +31,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var nextState = update(state);
return nextState == null ? state : _extends({}, state, {}, nextState);
return nextState == null ? state : _extends({}, state, nextState);
});
} else {
setState(function (state) {
return _extends({}, state, {}, update);
return _extends({}, state, update);
});

@@ -38,0 +38,0 @@ }

@@ -5,5 +5,5 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

@@ -18,5 +18,3 @@ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

import useStableMemo from './useStableMemo';
export var ObservableSet =
/*#__PURE__*/
function (_Set) {
export var ObservableSet = /*#__PURE__*/function (_Set) {
_inheritsLoose(ObservableSet, _Set);

@@ -57,5 +55,3 @@

return ObservableSet;
}(
/*#__PURE__*/
_wrapNativeSuper(Set));
}( /*#__PURE__*/_wrapNativeSuper(Set));
/**

@@ -62,0 +58,0 @@ * Create and return a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that triggers rerenders when it's updated.

/**
* Returns a controller object for setting a timeout that is properly cleaned up
* once the component unmounts. New timeouts cancel and replace existing ones.
*
*
*
* ```tsx
* const { set, clear } = useTimeout();
* const [hello, showHello] = useState(false);
* //Display hello after 5 seconds
* set(() => showHello(true), 5000);
* return (
* <div className="App">
* {hello ? <h3>Hello</h3> : null}
* </div>
* );
* ```
*/

@@ -5,0 +19,0 @@ export default function useTimeout(): {

@@ -24,2 +24,16 @@ import { useMemo, useRef } from 'react';

* once the component unmounts. New timeouts cancel and replace existing ones.
*
*
*
* ```tsx
* const { set, clear } = useTimeout();
* const [hello, showHello] = useState(false);
* //Display hello after 5 seconds
* set(() => showHello(true), 5000);
* return (
* <div className="App">
* {hello ? <h3>Hello</h3> : null}
* </div>
* );
* ```
*/

@@ -26,0 +40,0 @@

{
"name": "@restart/hooks",
"version": "0.3.25",
"version": "0.3.26",
"main": "cjs/index.js",

@@ -40,10 +40,8 @@ "types": "cjs/index.d.ts",

"peerDependencies": {
"react": "^16.8.0"
"react": ">=16.8.0"
},
"dependencies": {
"lodash": "^4.17.15",
"lodash-es": "^4.17.15"
},
"readme": "ERROR: No README data found!",
"_id": "@restart/hooks@0.3.21"
"lodash": "^4.17.20",
"lodash-es": "^4.17.20"
}
}
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