Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/twobin/validate-props
validate customize meta props
https://github.com/twobin/validate-props
Last synced: 16 days ago
JSON representation
validate customize meta props
- Host: GitHub
- URL: https://github.com/twobin/validate-props
- Owner: twobin
- Created: 2017-02-21T08:41:49.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-13T13:28:46.000Z (almost 8 years ago)
- Last Synced: 2024-12-21T16:34:15.535Z (22 days ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
README
# validate-props
validate props
[![npm version](https://badge.fury.io/js/validate-props.png)](https://badge.fury.io/js/validate-props)
[![build status](https://travis-ci.org/twobin/validate-props.svg)](https://travis-ci.org/twobin/validate-props)
[![npm downloads](https://img.shields.io/npm/dt/validate-props.svg?style=flat-square)](https://www.npmjs.com/package/validate-props)## usage
```
$ npm i -S validate-props
```## docs
### validate-props
```
import validateProps from 'validate-props';validateProps(value, type);
```### type
- string
- number
- bool
- array
- object
- func
- func({value: string, data: array}) // 指定函数回调格式
- oneOfString(['detail', 'summary'])
- oneOfNumber([10, 100])
- oneOfType([string, array, number])
- arrayOf(number) // number, string, bool
- shape({ value: number, text: string }) // 输入的格式
- urls // 预定义的一种类型,专门用于配置取数 url