Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YutangShi committed Feb 18, 2018
1 parent a9ede59 commit 1b22a05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# form-validation

[![Build Status](https://travis-ci.org/tigercosmos/date2obj.svg?branch=master)](https://travis-ci.org/tigercosmos/date2obj)
[![npm version](https://badge.fury.io/js/date2obj.svg)](https://badge.fury.io/js/date2obj)
[![npm version](https://badge.fury.io/js/%40yutangshi%2Fform-validation.svg)](https://badge.fury.io/js/date2obj)
[![npm](https://img.shields.io/npm/dt/date2obj.svg?style=flat-square)](https://www.npmjs.com/package/date2obj)
[![Greenkeeper badge](https://badges.greenkeeper.io/tigercosmos/date2obj.svg)](https://greenkeeper.io/)

Expand All @@ -14,12 +14,23 @@ npm i form-validation --save
```

```js
var dataValid new dataValidation() // Get validate object
const res = form.userName("Allen");
console.log('姓名驗證:' + JSON.stringify(res))
assert.deepEqual(
res, { status: 200, message: "" }
)
const form = new formValidation(); // Get validate object

const res = form.userName("Allen"); // Validate user name input.
// response format
// {
// status: 200,
// message: ""
// }

const res = form.mobile("Allen"); // Validate mobile input.
// response format
// {
// status: 512,
// message: "您輸入的手機格式不正確。"
// }


```


Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "form-validation",
"name": "@yutangshi/form-validation",
"version": "1.0.1",
"description": "Validate each field data format in JavaScript ",
"main": "index.js",
Expand All @@ -22,5 +22,6 @@
"homepage": "https://github.com/YutangShi/form-validation",
"devDependencies": {
"assert": "^1.4.1"
}
}
},
"dependencies": {}
}

0 comments on commit 1b22a05

Please sign in to comment.