Skip to content

Commit

Permalink
feat: added isLikeNumber, isLikeBoolean func
Browse files Browse the repository at this point in the history
  • Loading branch information
vtrbo committed Apr 29, 2024
1 parent 3e53562 commit 0086b60
Show file tree
Hide file tree
Showing 5 changed files with 4,680 additions and 3,370 deletions.
12 changes: 6 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
},
"devDependencies": {
"@codemirror/theme-one-dark": "^6.1.2",
"@iconify/json": "^2.2.184",
"@iconify/json": "^2.2.205",
"@vitejs/plugin-vue": "^5.0.4",
"@vueuse/core": "^10.8.0",
"@vueuse/core": "^10.9.0",
"pretty-format": "^29.7.0",
"sass": "^1.71.0",
"unocss": "^0.58.5",
"vite": "^5.1.3",
"sass": "^1.75.0",
"unocss": "^0.59.4",
"vite": "^5.2.10",
"vite-plugin-externals": "^0.6.2",
"vitepress": "1.0.0-rc.29",
"vue": "^3.4.19"
"vue": "^3.4.25"
}
}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@
"@vtrbo/utils-tree": "workspace:*"
},
"devDependencies": {
"@antfu/eslint-config": "^2.6.4",
"@types/node": "^20.11.19",
"@antfu/eslint-config": "^2.16.0",
"@types/node": "^20.12.7",
"@types/shelljs": "^0.8.15",
"bumpp": "^9.3.0",
"esno": "^4.0.0",
"bumpp": "^9.4.0",
"eslint": "8.57.0",
"esno": "^4.7.0",
"lint-staged": "^15.2.2",
"ora": "^8.0.1",
"rimraf": "^5.0.5",
"shelljs": "^0.8.5",
"simple-git-hooks": "^2.9.0",
"simple-git-hooks": "^2.11.1",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "^1.3.1"
"typescript": "^5.4.5",
"vitest": "^1.5.2"
},
"pnpm": {
"patchedDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/is/src/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,11 @@ export function isEmptyArr(array: unknown): boolean {
export function isKeyOfObj<T extends Recordable = Recordable>(object: T, k: keyof any): k is keyof T {
return k in object
}

export function isLikeNumber(value?: unknown): boolean {
return !Number.isNaN(+value!)
}

export function isLikeBoolean(value?: unknown): boolean {
return value === 'true' || value === 'false' || value === true || value === false
}
4 changes: 2 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@vtrbo/utils": "workspace:*",
"vite": "^5.1.3",
"vue": "^3.4.19"
"vite": "^5.2.10",
"vue": "^3.4.25"
}
}
Loading

0 comments on commit 0086b60

Please sign in to comment.