From 4bffc83650f47145ff465c0b7d4a94f65de5b288 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Tue, 20 Jan 2026 13:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E8=87=B3=200.0.5=EF=BC=8C=E5=B9=B6=E5=9C=A8=20filter=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=AD=E6=B7=BB=E5=8A=A0=E7=A9=BA=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f2928f6..b337a74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/js-filter", - "version": "0.0.4", + "version": "0.0.5", "description": "用于 JavaScript 数组的 SQL LIKE 过滤器函数", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index cbd9317..a6fe540 100644 --- a/src/index.ts +++ b/src/index.ts @@ -422,6 +422,9 @@ export function createFilter(query: string): (item: any) => boolean { } export function filter(data: any[], query: string): any[] { + if (!query || query.trim() === '') { + return data; + } const lexer = new Lexer(query); const parser = new Parser(lexer); const ast = parser.parse();