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

ahooks

Package Overview
Dependencies
Maintainers
5
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.1.12 to 3.1.13

1

es/useKeyPress/index.d.ts

@@ -11,4 +11,5 @@ import type { BasicTarget } from '../utils/domTarget';

target?: Target;
exactMatch?: boolean;
};
declare function useKeyPress(keyFilter: KeyFilter, eventHandler: EventHandler, option?: Options): void;
export default useKeyPress;

20

es/useKeyPress/index.js

@@ -158,3 +158,3 @@ var __values = this && this.__values || function (o) {

function genFilterKey(event, keyFilter) {
function genFilterKey(event, keyFilter, exactMatch) {
var e_1, _a; // 浏览器自动补全 input 的时候,会触发 keyDown、keyUp 事件,但此时 event.key 等为空

@@ -207,3 +207,7 @@

return genLen === genArr.length && countKeyByEvent(event) === genArr.length;
if (exactMatch) {
return genLen === genArr.length && countKeyByEvent(event) === genArr.length;
}
return genLen === genArr.length;
}

@@ -217,3 +221,3 @@ /**

function genKeyFormater(keyFilter) {
function genKeyFormater(keyFilter, exactMatch) {
if (typeof keyFilter === 'function') {

@@ -225,3 +229,3 @@ return keyFilter;

return function (event) {
return genFilterKey(event, keyFilter);
return genFilterKey(event, keyFilter, exactMatch);
};

@@ -233,3 +237,3 @@ }

return keyFilter.some(function (item) {
return genFilterKey(event, item);
return genFilterKey(event, item, exactMatch);
});

@@ -252,3 +256,5 @@ };

events = _b === void 0 ? defaultEvents : _b,
target = _a.target;
target = _a.target,
_c = _a.exactMatch,
exactMatch = _c === void 0 ? false : _c;

@@ -271,3 +277,3 @@ var eventHandlerRef = useLatest(eventHandler);

var genGuard = genKeyFormater(keyFilterRef.current);
var genGuard = genKeyFormater(keyFilterRef.current, exactMatch);

@@ -274,0 +280,0 @@ if (genGuard(event)) {

@@ -11,4 +11,5 @@ import type { BasicTarget } from '../utils/domTarget';

target?: Target;
exactMatch?: boolean;
};
declare function useKeyPress(keyFilter: KeyFilter, eventHandler: EventHandler, option?: Options): void;
export default useKeyPress;

@@ -173,3 +173,3 @@ "use strict";

function genFilterKey(event, keyFilter) {
function genFilterKey(event, keyFilter, exactMatch) {
var e_1, _a; // 浏览器自动补全 input 的时候,会触发 keyDown、keyUp 事件,但此时 event.key 等为空

@@ -222,3 +222,7 @@

return genLen === genArr.length && countKeyByEvent(event) === genArr.length;
if (exactMatch) {
return genLen === genArr.length && countKeyByEvent(event) === genArr.length;
}
return genLen === genArr.length;
}

@@ -232,3 +236,3 @@ /**

function genKeyFormater(keyFilter) {
function genKeyFormater(keyFilter, exactMatch) {
if (typeof keyFilter === 'function') {

@@ -240,3 +244,3 @@ return keyFilter;

return function (event) {
return genFilterKey(event, keyFilter);
return genFilterKey(event, keyFilter, exactMatch);
};

@@ -248,3 +252,3 @@ }

return keyFilter.some(function (item) {
return genFilterKey(event, item);
return genFilterKey(event, item, exactMatch);
});

@@ -267,3 +271,5 @@ };

events = _b === void 0 ? defaultEvents : _b,
target = _a.target;
target = _a.target,
_c = _a.exactMatch,
exactMatch = _c === void 0 ? false : _c;

@@ -286,3 +292,3 @@ var eventHandlerRef = useLatest_1["default"](eventHandler);

var genGuard = genKeyFormater(keyFilterRef.current);
var genGuard = genKeyFormater(keyFilterRef.current, exactMatch);

@@ -289,0 +295,0 @@ if (genGuard(event)) {

{
"name": "ahooks",
"version": "3.1.12",
"version": "3.1.13",
"description": "react hooks library",

@@ -62,3 +62,3 @@ "keywords": [

"license": "MIT",
"gitHead": "6d5bda4efbef756056511d23ddc2bcb0327344c3"
"gitHead": "fda70978a7e69c7851ea45e0cb52ce4055f531c4"
}

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