Skip to content

Commit

Permalink
docs(kitify): Enhance DOM and add type docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinerer committed Dec 22, 2024
1 parent 3292592 commit 64e74e3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
11 changes: 9 additions & 2 deletions libs/kitify/docs/dom.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import detectMouseDirection from 'kitify/detectMouseDirection'

## detectMouseDirection

检测获取鼠标移动到指定元素的移入和移出的方向。
Detect the direction of mouseenter and mouseleave when the mouse moves over element.

检测鼠标移动到指定元素时的移入和移出方向。

```ts
function detectMouseDirection(
Expand All @@ -15,5 +17,10 @@ function detectMouseDirection(
onLeave: Callback
): () => void

// Callback = (direction: 'up' | 'down' | 'left' | 'right') => void
/*
Callback = (
direction: 'up' | 'down' | 'left' | 'right',
event: MouseEvent
) => void
*/
```
30 changes: 30 additions & 0 deletions libs/kitify/docs/type.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# type

Provides some methods for interpreting data types.

提供一些判读数据类型的方法。

```ts
import { isType, isObject, isFunction } from 'kitify'
// or
import { isType, isObject, isFunction } from 'kitify/type'

isObject({}) // true
isFunction(() => {})) // true
isType(123) // number
isType('hello', 'string') // true
```

## isType

```ts
function isType(value: any, type?: string): string | boolean
```

**examples:**

```ts
isType(123) // number
isType(new Date()) // date
isType('hello', 'string') // true
isType('hello', 'number') // false
```
8 changes: 0 additions & 8 deletions libs/kitify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
"files": [
"dist"
],
"buildOptions": {
"input": "src/index.ts",
"name": "kitify",
"target": [
"es2015",
"es5"
]
},
"keywords": [
"kitify",
"kit",
Expand Down

0 comments on commit 64e74e3

Please sign in to comment.