docs: update docs (#4466)

* chore: fixed known issues with form components

* docs: add vben form doc
This commit is contained in:
Vben
2024-09-22 14:16:06 +08:00
committed by GitHub
parent dac80703d9
commit 5ce3a18785
36 changed files with 1938 additions and 139 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
getFirstNonNullOrUndefined,
isBoolean,
isEmpty,
isHttpUrl,
isObject,
@@ -96,6 +97,21 @@ describe('isWindow', () => {
});
});
describe('isBoolean', () => {
it('should return true for boolean values', () => {
expect(isBoolean(true)).toBe(true);
expect(isBoolean(false)).toBe(true);
});
it('should return false for non-boolean values', () => {
expect(isBoolean(null)).toBe(false);
expect(isBoolean(42)).toBe(false);
expect(isBoolean('string')).toBe(false);
expect(isBoolean({})).toBe(false);
expect(isBoolean([])).toBe(false);
});
});
describe('isObject', () => {
it('should return true for objects', () => {
expect(isObject({})).toBe(true);

View File

@@ -10,6 +10,15 @@ function isUndefined(value?: unknown): value is undefined {
return value === undefined;
}
/**
* 检查传入的值是否为boolean
* @param value
* @returns 如果值是布尔值返回true否则返回false。
*/
function isBoolean(value: unknown): value is boolean {
return typeof value === 'boolean';
}
/**
* 检查传入的值是否为空。
*
@@ -141,6 +150,7 @@ function getFirstNonNullOrUndefined<T>(
export {
getFirstNonNullOrUndefined,
isBoolean,
isEmpty,
isFunction,
isHttpUrl,