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

ahooks

Package Overview
Dependencies
Maintainers
4
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ahooks - npm Package Compare versions

Comparing version 3.7.0 to 3.7.1

es/utils/isDev.d.ts

3

es/useDebounceFn/index.js

@@ -41,2 +41,3 @@ var __read = this && this.__read || function (o, n) {

import { isFunction } from '../utils';
import isDev from '../utils/isDev';

@@ -46,3 +47,3 @@ function useDebounceFn(fn, options) {

if (process.env.NODE_ENV === 'development') {
if (isDev) {
if (!isFunction(fn)) {

@@ -49,0 +50,0 @@ console.error("useDebounceFn expected parameter is a function, got " + typeof fn);

@@ -11,2 +11,3 @@ import useLatest from '../useLatest';

var optionsRef = useLatest(options);
var dataRef = useLatest(data);
useEffectWithTarget(function () {

@@ -23,3 +24,3 @@ var targetElement = getTargetElement(target);

(_b = (_a = optionsRef.current).onDragStart) === null || _b === void 0 ? void 0 : _b.call(_a, event);
event.dataTransfer.setData('custom', JSON.stringify(data));
event.dataTransfer.setData('custom', JSON.stringify(dataRef.current));
};

@@ -26,0 +27,0 @@

import { useMemo, useRef } from 'react';
import { isFunction } from '../utils';
import isDev from '../utils/isDev';
function useMemoizedFn(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev) {
if (!isFunction(fn)) {

@@ -7,0 +8,0 @@ console.error("useMemoizedFn expected parameter is a function, got " + typeof fn);

import { useEffect } from 'react';
import { isFunction } from '../utils';
import isDev from '../utils/isDev';
var useMount = function useMount(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev) {
if (!isFunction(fn)) {

@@ -7,0 +8,0 @@ console.error("useMount: parameter `fn` expected to be a function, but got \"" + typeof fn + "\".");

@@ -411,11 +411,3 @@ var __assign = this && this.__assign || function () {

Fetch.prototype.mutate = function (data) {
var targetData;
if (isFunction(data)) {
// @ts-ignore
targetData = data(this.state.data);
} else {
targetData = data;
}
var targetData = isFunction(data) ? data(this.state.data) : data;
this.runPluginHandler('onMutate', targetData);

@@ -422,0 +414,0 @@ this.setState({

@@ -123,2 +123,3 @@ var __read = this && this.__read || function (o, n) {

data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined,
returnNow: true

@@ -129,3 +130,4 @@ };

return {
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined
};

@@ -132,0 +134,0 @@ }

@@ -1,2 +0,3 @@

declare function subscribe(listener: () => void): () => void;
declare type Listener = () => void;
declare function subscribe(listener: Listener): () => void;
export default subscribe;

@@ -1,2 +0,3 @@

declare function subscribe(listener: () => void): () => void;
declare type Listener = () => void;
declare function subscribe(listener: Listener): () => void;
export default subscribe;

@@ -66,4 +66,4 @@ var __read = this && this.__read || function (o, n) {

newPosition = {
left: Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop),
top: Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft)
left: Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft),
top: Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop)
};

@@ -70,0 +70,0 @@ }

@@ -41,2 +41,3 @@ var __read = this && this.__read || function (o, n) {

import { isFunction } from '../utils';
import isDev from '../utils/isDev';

@@ -46,3 +47,3 @@ function useThrottleFn(fn, options) {

if (process.env.NODE_ENV === 'development') {
if (isDev) {
if (!isFunction(fn)) {

@@ -49,0 +50,0 @@ console.error("useThrottleFn expected parameter is a function, got " + typeof fn);

import { useEffect } from 'react';
import useLatest from '../useLatest';
import { isFunction } from '../utils';
import isDev from '../utils/isDev';
var useUnmount = function useUnmount(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev) {
if (!isFunction(fn)) {

@@ -8,0 +9,0 @@ console.error("useUnmount expected parameter is a function, got " + typeof fn);

@@ -58,6 +58,8 @@ "use strict";

var isDev_1 = __importDefault(require("../utils/isDev"));
function useDebounceFn(fn, options) {
var _a;
if (process.env.NODE_ENV === 'development') {
if (isDev_1["default"]) {
if (!utils_1.isFunction(fn)) {

@@ -64,0 +66,0 @@ console.error("useDebounceFn expected parameter is a function, got " + typeof fn);

@@ -25,2 +25,3 @@ "use strict";

var optionsRef = useLatest_1["default"](options);
var dataRef = useLatest_1["default"](data);
useEffectWithTarget_1["default"](function () {

@@ -37,3 +38,3 @@ var targetElement = domTarget_1.getTargetElement(target);

(_b = (_a = optionsRef.current).onDragStart) === null || _b === void 0 ? void 0 : _b.call(_a, event);
event.dataTransfer.setData('custom', JSON.stringify(data));
event.dataTransfer.setData('custom', JSON.stringify(dataRef.current));
};

@@ -40,0 +41,0 @@

"use strict";
var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {

@@ -11,4 +17,6 @@ value: true

var isDev_1 = __importDefault(require("../utils/isDev"));
function useMemoizedFn(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev_1["default"]) {
if (!utils_1.isFunction(fn)) {

@@ -15,0 +23,0 @@ console.error("useMemoizedFn expected parameter is a function, got " + typeof fn);

"use strict";
var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {

@@ -11,4 +17,6 @@ value: true

var isDev_1 = __importDefault(require("../utils/isDev"));
var useMount = function useMount(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev_1["default"]) {
if (!utils_1.isFunction(fn)) {

@@ -15,0 +23,0 @@ console.error("useMount: parameter `fn` expected to be a function, but got \"" + typeof fn + "\".");

@@ -416,11 +416,3 @@ "use strict";

Fetch.prototype.mutate = function (data) {
var targetData;
if (utils_1.isFunction(data)) {
// @ts-ignore
targetData = data(this.state.data);
} else {
targetData = data;
}
var targetData = utils_1.isFunction(data) ? data(this.state.data) : data;
this.runPluginHandler('onMutate', targetData);

@@ -427,0 +419,0 @@ this.setState({

@@ -174,2 +174,3 @@ "use strict";

data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined,
returnNow: true

@@ -180,3 +181,4 @@ };

return {
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data
data: cacheData === null || cacheData === void 0 ? void 0 : cacheData.data,
error: undefined
};

@@ -183,0 +185,0 @@ }

@@ -1,2 +0,3 @@

declare function subscribe(listener: () => void): () => void;
declare type Listener = () => void;
declare function subscribe(listener: Listener): () => void;
export default subscribe;

@@ -1,2 +0,3 @@

declare function subscribe(listener: () => void): () => void;
declare type Listener = () => void;
declare function subscribe(listener: Listener): () => void;
export default subscribe;

@@ -81,4 +81,4 @@ "use strict";

newPosition = {
left: Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop),
top: Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft)
left: Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft),
top: Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop)
};

@@ -85,0 +85,0 @@ }

@@ -58,6 +58,8 @@ "use strict";

var isDev_1 = __importDefault(require("../utils/isDev"));
function useThrottleFn(fn, options) {
var _a;
if (process.env.NODE_ENV === 'development') {
if (isDev_1["default"]) {
if (!utils_1.isFunction(fn)) {

@@ -64,0 +66,0 @@ console.error("useThrottleFn expected parameter is a function, got " + typeof fn);

@@ -19,4 +19,6 @@ "use strict";

var isDev_1 = __importDefault(require("../utils/isDev"));
var useUnmount = function useUnmount(fn) {
if (process.env.NODE_ENV === 'development') {
if (isDev_1["default"]) {
if (!utils_1.isFunction(fn)) {

@@ -23,0 +25,0 @@ console.error("useUnmount expected parameter is a function, got " + typeof fn);

{
"name": "ahooks",
"version": "3.7.0",
"version": "3.7.1",
"description": "react hooks library",

@@ -24,2 +24,5 @@ "keywords": [

"homepage": "https://github.com/alibaba/hooks",
"scripts": {
"build": "gulp && webpack-cli"
},
"files": [

@@ -61,6 +64,3 @@ "dist",

"license": "MIT",
"gitHead": "11f6ad571bd365c95ecb9409ca3050cbbfc9b34a",
"scripts": {
"build": "gulp && webpack-cli"
}
}
"gitHead": "11f6ad571bd365c95ecb9409ca3050cbbfc9b34a"
}

Sorry, the diff of this file is too big to display

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