Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhinjs/schema
zhin配置声明
https://github.com/zhinjs/schema
Last synced: about 1 month ago
JSON representation
zhin配置声明
- Host: GitHub
- URL: https://github.com/zhinjs/schema
- Owner: zhinjs
- License: mit
- Created: 2022-10-14T15:17:04.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-09T00:19:49.000Z (over 1 year ago)
- Last Synced: 2024-02-20T02:15:19.173Z (10 months ago)
- Language: TypeScript
- Size: 30.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @zhinjs/schema
zhin配置声明
## 声明number
```javascript
Schema.number()
```
## 声明string
```javascript
Schema.string()
```
## 声明boolean
```javascript
Schema.boolean()
```
## 声明date
```javascript
Schema.date()
```
## 声明regexp
```javascript
Schema.regexp()
```
## 声明object
1. Record
```javascript
Schema.dict(
Schema.string()
)
```
2. Record
```javascript
Schema.dict(
Schema.number()
)
```
3. Record
```javascript
Schema.dict(
Schema.date()
)
```
4. Record
```javascript
Schema.dict(
Schema.list(
Schema.number()
)
)
```
5. Record
```javascript
Schema.dict(
Schema.list(
Schema.object({
foo:Schema.string(),
bar:Schema.list(Schema.number())
})
)
)
```
## 声明array
1. string[]
```javascript
Schema.array(
Schema.string()
)
```
2. {foo:number,bar:string}[]```javascript
Schema.array(
Schema.object({
foo:Schema.number(),
bar:Schema.string()
})
)
```