Skip to content

Commit

Permalink
chore: 升级选择器
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Sep 22, 2023
1 parent 0a449b9 commit 0ade427
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@gkd-kit/selector": "0.0.12",
"@gkd-kit/selector": "0.0.13",
"@types/file-saver": "^2.0.5",
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.5.6",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions src/utils/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type Selector = {
};

export const parseSelector = (source: string): Selector => {
if (!simpleCheck(source)) throw new Error(`invalid selector syntax`);
const cs = CommonSelector.Companion.parse(source);
const selector: Selector = {
toString: () => cs.toString(),
Expand All @@ -41,16 +40,6 @@ export const parseSelector = (source: string): Selector => {
return selector;
};

const matchEndChar = /[0-9a-zA-Z\]\*\s]+$/;
/**
*
*/
const simpleCheck = (source: string) => {
source = source.trim();
if (!source || !source.match(matchEndChar)) return false;
return true;
};

export const checkSelector = (source: string) => {
try {
return !!parseSelector(source);
Expand Down

0 comments on commit 0ade427

Please sign in to comment.