Mock.Random
const Random = Mock.Random
Random.email() // => sd.sdf@oksd.com
Mock.mock('@email') // => sd.sdf@oksd.com
Mock.mock({ email: 'sd.sdf@oksd.com' }) // => { email: "sd.sdf@oksd.com" }
- Basic
Random.boolean(min?, max?, current? )
Random.natural(min?, max? )
Random.integer(min?, max? )
Random.float( min?, max?, dmin?, dmax? )
Random.character( pool? ) // pool => lower/upper/number/symbol 生成字符串
Random.string( pool?, min?, max? ) // pool => lower/upper/number/symbol
Random.range( start?, stop, step? )
- Random.Date
- Random.time
- Random.dattime
- Random.now
- Random.image()
第一个参数是尺寸
第二个参数是图片的颜色。
第三个参数是图片后缀或者图片上显示的文字或者图片上文字的颜色。。。各种组合
- Random.dataImage,Base64的图片
- Color
Random.color() // => #3538B2
Random.hex() // => #3538B2
Random.rgb() // => rgb(242, 198, 121)
Random.rgba() // => rgba(242, 198, 121, 0.13)
Random.hsl() // => hsl(345, 82, 71)
- Text
Random.paragraph( min?, max? ):英文段落
Random.cparagraph( min?, max? ):中文段落
Random.sentence( min?, max? )
Random.csentence( min?, max? ):中文句子,里面有几个中文句子
Random.word( min?, max? ):返回英文的单词,
Random.cword( pool?, min?, max? ):中文词
Random.title( min?, max? ):英文标题
Random.ctitle( min?, max? ):中文标题
- Name
Random.first()
Random.last()
Random.name( middle? )
Random.cfirst():中文的姓
Random.clast():中文名字
Random.cname():中文名
- Web
Random.url( protocol?, host? ):随机的url
Random.protocol():协议 http 还是https
Random.domain() // 域名
Random.tld() // 顶级域名
Random.email( domain? )
Random.ip()
- Address ,
Random.region() //返回中国的大区
Random.province() //返回随机的省份
Random.city(true) //随机的地市,如果设置为true那么连同城市也一起返回。
Random.county(true) //镇一级别的。
- Helper
Random.capitalize( word ):英文单词首字母大写
Random.upper( str )
Random.lower( str )
Random.pick( arr )
Random.shuffle( arr )
- Miscellaneous杂项
Random.guid()
Random.id()
Random.increment( step? )