generate-by-validation
Module to generate String based on validation
Last updated 3 years ago by sunupf .
MIT · Original npm · Tarball · package.json
$ cnpm install generate-by-validation 
SYNC missed versions from official npm registry.

generate-by-validation

Generate data based on validation. we can generate valid data and invalid data so we can use it for our functional test activity

I'm using https://github.com/fent/randexp.js to generate the data

Installation

npm install generate-by-validation

Usage

First include the module to your project

var data = require('gen-by-validation');

For example you want generate name with minimal length = 5 and maximal length = 10

var name = data.generate(['required','min:5','max:10'])
console.log(name)
//will output something like : 'SnDueGq-IG' =>length beetwen 5-10 

If you want generate data which not match with name, min:5, and max:10 you can set second parameter to false

var name = data.generate(['required','min:5','max:10'],false)
console.log(name)
//will output something like : '/,!/"474]5{$*\'/6~,8\'\'*%}!' => length more than 10

The result is random that's why the result ussually unpronounceable

Supported validation rule

  • alpha : a-z
  • min:x
  • max:y
  • between:x,y
  • exact:x

Current Tags

  • 0.0.26                                ...           latest (3 years ago)

25 Versions

  • 0.0.26                                ...           3 years ago
  • 0.0.25                                ...           3 years ago
  • 0.0.24                                ...           3 years ago
  • 0.0.23                                ...           4 years ago
  • 0.0.22                                ...           4 years ago
  • 0.0.21                                ...           4 years ago
  • 0.0.20                                ...           4 years ago
  • 0.0.19                                ...           4 years ago
  • 0.0.18                                ...           4 years ago
  • 0.0.17                                ...           4 years ago
  • 0.0.16                                ...           4 years ago
  • 0.0.15                                ...           4 years ago
  • 0.0.14                                ...           4 years ago
  • 0.0.13                                ...           4 years ago
  • 0.0.11                                ...           4 years ago
  • 0.0.10                                ...           4 years ago
  • 0.0.9                                ...           4 years ago
  • 0.0.8                                ...           4 years ago
  • 0.0.7                                ...           4 years ago
  • 0.0.6                                ...           4 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (3)

Copyright 2014 - 2017 © taobao.org |