mock官方文档

数据模板定义

String

'name|min-max': string

Data Template

Mock.mock({
 "string|1-10": "★"
})

Result

{
 "string": "★★★"
}

 

'name|count': string

Data Template

Mock.mock({
 "string|3": "★★★"
})

Result

{
 "string": "★★★★★★★★★"
}

 

Number

'name|+1': number

Data Template

Mock.mock({
 "number|+1": 202
})

Result

{
 "number": 201
}

 

'name|min-max': number

Data Template

Mock.mock({
 "number|1-100": 100
})

Result

{
 "number": 39
}

 

'name|min-max.dmin-dmax': number

Data Template

Mock.mock({
 "number|1-100.1-10": 1
})

Result

{
 "number": 99.369
}

 

Data Template

Mock.mock({
 "number|123.1-10": 1
})

Result

{
 "number": 123.95855723
}

 

Data Template

Mock.mock({
 "number|123.3": 1
})

Result

{
 "number": 123.263
}

 

Data Template

Mock.mock({
 "number|123.10": 1.123
})

Result

{
 "number": 123.1235808507
}

 

Boolean

'name|1': boolean

Data Template

Mock.mock({
 "boolean|1": true
})

Result

{
 "boolean": true
}

 

'name|min-max': boolean

Data Template

Mock.mock({
 "boolean|1-2": true
})

Result

{
 "boolean": false
}

 

Object

'name|count': object

Data Template

Mock.mock({
 "object|2": {
   "310000": "上海市",
   "320000": "江苏省",
   "330000": "浙江省",
   "340000": "安徽省"
}
})

Result

{
 "object": {
   "310000": "上海市",
   "320000": "江苏省"
}
}

 

'name|min-max': object

Data Template

Mock.mock({
 "object|2-4": {
   "110000": "北京市",
   "120000": "天津市",
   "130000": "河北省",
   "140000": "山西省"
}
})

Result

{
 "object": {
   "120000": "天津市",
   "130000": "河北省",
   "140000": "山西省"
}
}

 

Array

'name|1': array

Data Template

Mock.mock({
 "array|1": [
   "AMD",
   "CMD",
   "UMD"
]
})

Result

{
 "array": "CMD"
}

 

'name|+1': array

Data Template

Mock.mock({
 "array|+1": [
   "AMD",
   "CMD",
   "UMD"
]
})

Result

{
 "array": "AMD"
}

 

Data Template

Mock.mock({
 "array|1-10": [
  {
     "name|+1": [
       "Hello",
       "Mock.js",
       "!"
    ]
  }
]
})

Result

{
 "array": [
  {
     "name": "Hello"
  },
  {
     "name": "Mock.js"
  },
  {
     "name": "!"
  },
  {
     "name": "Hello"
  },
  {
     "name": "Mock.js"
  },
  {
     "name": "!"
  },
  {
     "name": "Hello"
  },
  {
     "name": "Mock.js"
  },
  {
     "name": "!"
  },
  {
     "name": "Hello"
  }
]
}

 

'name|min-max': array

Data Template

Mock.mock({
 "array|1-10": [
   "Mock.js"
]
})

Result

{
 "array": [
   "Mock.js",
   "Mock.js",
   "Mock.js",
   "Mock.js"
]
}

 

Data Template

Mock.mock({
  "array|1-10": [
    "Hello",
    "Mock.js",
    "!"
  ]
})

Result

{
  "array": [
    "Hello",
    "Mock.js",
    "!",
    "Hello",
    "Mock.js",
    "!",
    "Hello",
    "Mock.js",
    "!"
  ]
}

 

'name|count': array

Data Template

Mock.mock({
  "array|3": [
    "Mock.js"
  ]
})

Result

{
  "array": [
    "Mock.js",
    "Mock.js",
    "Mock.js"
  ]
}

 

Data Template

Mock.mock({
  "array|3": [
    "Hello",
    "Mock.js",
    "!"
  ]
})

Result

{
  "array": [
    "Hello",
    "Mock.js",
    "!",
    "Hello",
    "Mock.js",
    "!",
    "Hello",
    "Mock.js",
    "!"
  ]
}

 

Function

'name': function

Data Template

Mock.mock({
  'foo': 'Syntax Demo',
  'name': function() {
    return this.foo
  }
})

Result

{
  "foo": "Syntax Demo",
  "name": "Syntax Demo"
}

 

RegExp

'name': regexp

Data Template

Mock.mock({
  'regexp': /[a-z][A-Z][0-9]/
})

Result

{
  "regexp": "uD0"
}

 

Data Template

Mock.mock({
  'regexp': /\w\W\s\S\d\D/
})

Result

{
  "regexp": "5/
K0E"
}

 

Data Template

Mock.mock({
  'regexp': /\d{5,10}/
})

Result

{
  "regexp": "22213134"
}

 

Data Template

Mock.mock({
  'regexp|3': /\d{5,10}\-/
})

Result

{
  "regexp": "592054-9311158-685264423-"
}

 

Data Template

Mock.mock({
  'regexp|1-5': /\d{5,10}\-/
})

Result

{
  "regexp": "0644455778-"
}

 

Path

Absolute Path

Data Template

Mock.mock({
  "foo": "Hello",
  "nested": {
    "a": {
      "b": {
        "c": "Mock.js"
      }
    }
  },
  "absolutePath": "@/foo @/nested/a/b/c"
})

Result

{
  "foo": "Hello",
  "nested": {
    "a": {
      "b": {
        "c": "Mock.js"
      }
    }
  },
  "absolutePath": "Hello Mock.js"
}

 

Relative Path

Data Template

Mock.mock({
  "foo": "Hello",
  "nested": {
    "a": {
      "b": {
        "c": "Mock.js"
      }
    }
  },
  "relativePath": {
    "a": {
      "b": {
        "c": "@../../../foo @../../../nested/a/b/c"
      }
    }
  }
})

Result

{
  "foo": "Hello",
  "nested": {
    "a": {
      "b": {
        "c": "Mock.js"
      }
    }
  },
  "relativePath": {
    "a": {
      "b": {
        "c": "Hello Mock.js"
      }
    }
  }
}

 

数据占位符定义

Basic

Random.boolean( min?, max?, current? )

Data Template

// Random.boolean()
Random.boolean()
Mock.mock('@boolean')
Mock.mock('@boolean()')

// Random.boolean( min, max, current )
Random.boolean(1, 9, true)
Mock.mock('@boolean(1, 9, true)')

Result

// Random.boolean()
false
false
false

// Random.boolean( min, max, current )
false
false

 

 

Random.natural( min?, max? )

Data Template

// Random.natural()
Random.natural()
Mock.mock('@natural')
Mock.mock('@natural()')

// Random.natural( min )
Random.natural(10000)
Mock.mock('@natural(10000)')

// Random.natural( min, max )
Random.natural(60, 100)
Mock.mock('@natural(60, 100)')

Result

// Random.natural()
4184573944061948
5372137148377580
1264663646706556

// Random.natural( min )
7567690953799090
8538221064689611

// Random.natural( min, max )
74
78

 

 

Random.integer( min?, max? )

Data Template

// Random.integer()
Random.integer()
Mock.mock('@integer')
Mock.mock('@integer()')

// Random.integer( min )
Random.integer(10000)
Mock.mock('@integer(10000)')

// Random.integer( min, max )
Random.integer(60, 100)
Mock.mock('@integer(60, 100)')

Result

// Random.integer()
-3648387036581740
-6514423632205880
-967625819932748

// Random.integer( min )
8633980170391450
3771098241794691

// Random.integer( min, max )
75
74

 

 

Random.float( min?, max?, dmin?, dmax? )

Data Template

// Random.float()
Random.float()
Mock.mock('@float')
Mock.mock('@float()')

// Random.float( min )
Random.float(0)
Mock.mock('@float(0)')

// Random.float( min, max )
Random.float(60, 100)
Mock.mock('@float(60, 100)')

// Random.float( min, max, dmin )
Random.float(60, 100, 3)
Mock.mock('@float(60, 100, 3)')

// Random.float( min, max, dmin, dmax )
Random.float(60, 100, 3, 5)
Mock.mock('@float(60, 100, 3, 5)')

Result

// Random.float()
3259445696495848.5
7400267621764656
4687915960232208

// Random.float( min )
7856664433617264
7580927266372698

// Random.float( min, max )
88.13564081636468
76.740112853

// Random.float( min, max, dmin )
80.89247064281457
94.67841422118

// Random.float( min, max, dmin, dmax )
65.8103
66.422

 

 

Random.character( pool? )

Data Template

// Random.character()
Random.character()
Mock.mock('@character')
Mock.mock('@character()')

// Random.character( 'lower/upper/number/symbol' )
Random.character('lower')
Random.character('upper')
Random.character('number')
Random.character('symbol')

Mock.mock('@character("lower")')
Mock.mock('@character("upper")')
Mock.mock('@character("number")')
Mock.mock('@character("symbol")')

// Random.character( pool )
Random.character('aeiou')
Mock.mock('@character("aeiou")')

Result

// Random.character()
"E"
"F"
"9"

// Random.character( 'lower/upper/number/symbol' )
"r"
"L"
"7"
"$"

"r"
"K"
"2"
"$"

// Random.character( pool )
"i"
"a"

 

 

Random.string( pool?, min?, max? )

Data Template

// Random.string()
Random.string()
Mock.mock('@string')
Mock.mock('@string()')

// Random.string( length )
Random.string(5)
Mock.mock('@string(5)')

// Random.string( pool, length )
Random.string('lower', 5)
Random.string('upper', 5)
Random.string('number', 5)
Random.string('symbol', 5)
Random.string('aeiou', 5)

Mock.mock('@string("lower", 5)')
Mock.mock('@string("upper", 5)')
Mock.mock('@string("number", 5)')
Mock.mock('@string("symbol", 5)')
Mock.mock('@string("aeiou", 5)')

// Random.string( min, max )
Random.string(7, 10)
Mock.mock('@string(7, 10)')

// Random.string( pool, min, max )
Random.string('lower', 1, 3)
Random.string('upper', 1, 3)
Random.string('number', 1, 3)
Random.string('symbol', 1, 3)
Random.string('aeiou', 1, 3)

Mock.mock('@string("lower", 1, 3)')
Mock.mock('@string("upper", 1, 3)')
Mock.mock('@string("number", 1, 3)')
Mock.mock('@string("symbol", 1, 3)')
Mock.mock('@string("aeiou", 1, 3)')

Result

// Random.string()
"2S3"
"TVtEC"
"Wj^Q0Kd"

// Random.string( length )
"o9)G)"
"Yqslx"

// Random.string( pool, length )
"mmqlm"
"JHTSN"
"31305"
"[[$&("
"iooue"

"pslcg"
"LXJOD"
"49851"
"$[@&!"
"oiaie"

// Random.string( min, max )
"6mCiFiEb"
"rvWwUE#Y"

// Random.string( pool, min, max )
"fj"
"JAD"
"21"
"#("
"aia"

"y"
"QY"
"332"
"^"
"eu"

 

 

Random.range(start?, stop, step?)

Data Template

// Random.range( stop )
Random.range(10)
Mock.mock('@range(10)')

// Random.range( start, stop )
Random.range(3, 7)
Mock.mock('@range(3, 7)')

// Random.range( start, stop, step )
Random.range(1, 10, 2)
Random.range(1, 10, 3)

Mock.mock('@range(1, 10, 2)')
Mock.mock('@range(1, 10, 3)')

Result

// Random.range( stop )
[0,1,2,3,4,5,6,7,8,9]
[0,1,2,3,4,5,6,7,8,9]

// Random.range( start, stop )
[3,4,5,6]
[3,4,5,6]

// Random.range( start, stop, step )
[1,3,5,7,9]
[1,4,7]

[1,3,5,7,9]
[1,4,7]

 

 

Date

Random.date( format? )

Data Template

// Random.date()
Random.date()
Mock.mock('@date')
Mock.mock('@date()')

// Random.date( format )
Random.date('yyyy-MM-dd')
Random.date('yy-MM-dd')
Random.date('y-MM-dd')
Random.date('y-M-d')

Mock.mock('@date("yyyy-MM-dd")')
Mock.mock('@date("yy-MM-dd")')
Mock.mock('@date("y-MM-dd")')
Mock.mock('@date("y-M-d")')

Mock.mock('@date("yyyy yy y MM M dd d")')

Result

// Random.date()
"1998-11-25"
"1981-06-26"
"1994-03-27"

// Random.date( format )
"1972-05-23"
"94-07-27"
"09-03-21"
"18-10-2"

"1976-06-17"
"10-03-14"
"03-10-26"
"90-11-17"

"1989 89 89 03 3 24 24"

 

 

Random.time( format? )

Data Template

// Random.time()
Random.time()
Mock.mock('@time')
Mock.mock('@time()')

// Random.time( format )
Random.time('A HH:mm:ss')
Random.time('a HH:mm:ss')
Random.time('HH:mm:ss')
Random.time('H:m:s')

Mock.mock('@time("A HH:mm:ss")')
Mock.mock('@time("a HH:mm:ss")')
Mock.mock('@time("HH:mm:ss")')
Mock.mock('@time("H:m:s")')

Mock.mock('@datetime("HH H hh h mm m ss s SS S A a T")')

Result

// Random.time()
"17:18:14"
"05:07:26"
"05:42:06"

// Random.time( format )
"AM 04:21:41"
"am 07:20:36"
"16:11:44"
"10:12:35"

"AM 08:05:00"
"am 01:16:42"
"17:38:55"
"3:17:2"

"20 20 08 8 26 26 27 27 622 622 PM pm 1273148787622"

 

 

Random.datetime( format? )

Data Template

// Random.datetime()
Random.datetime()
Mock.mock('@datetime')
Mock.mock('@datetime()')

// Random.datetime( format )
Random.datetime('yyyy-MM-dd A HH:mm:ss')
Random.datetime('yy-MM-dd a HH:mm:ss')
Random.datetime('y-MM-dd HH:mm:ss')
Random.datetime('y-M-d H:m:s')

Mock.mock('@datetime("yyyy-MM-dd A HH:mm:ss")')
Mock.mock('@datetime("yy-MM-dd a HH:mm:ss")')
Mock.mock('@datetime("y-MM-dd HH:mm:ss")')
Mock.mock('@datetime("y-M-d H:m:s")')

Mock.mock('@datetime("yyyy yy y MM M dd d HH H hh h mm m ss s SS S A a T")')

Result

// Random.datetime()
"1986-10-07 13:28:06"
"2007-05-08 10:19:26"
"1972-01-06 22:02:26"

// Random.datetime( format )
"1986-10-27 PM 14:16:24"
"11-09-24 am 07:32:58"
"17-03-11 10:09:13"
"88-2-27 4:16:50"

"2019-01-17 AM 08:46:01"
"02-08-27 am 11:20:36"
"07-01-08 10:37:35"
"85-1-11 8:7:47"

"1985 85 85 12 12 18 18 05 5 05 5 59 59 31 31 510 510 AM am 503704771510"

 

 

Random.now( unit?, format? )

Data Template

// Ranndom.now()
Random.now()
Mock.mock('@now')
Mock.mock('@now()')

// Ranndom.now( unit )
Random.now('year')
Random.now('month')
Random.now('week')
Random.now('day')
Random.now('hour')
Random.now('minute')
Random.now('second')

// Ranndom.now( format )
Random.now('yyyy-MM-dd HH:mm:ss SS')

// Ranndom.now( unit, format )
Random.now('day', 'yyyy-MM-dd HH:mm:ss SS')

Result

// Ranndom.now()
"2021-02-24 21:46:15"
"2021-02-24 21:46:15"
"2021-02-24 21:46:15"

// Ranndom.now( unit )
"2021-01-01 00:00:00"
"2021-02-01 00:00:00"
"2021-02-21 00:00:00"
"2021-02-24 00:00:00"
"2021-02-24 21:00:00"
"2021-02-24 21:46:00"
"2021-02-24 21:46:15"

// Ranndom.now( format )
"2021-02-24 21:46:15 723"

// Ranndom.now( unit, format )
"2021-02-24 00:00:00 000"

 

 

Image

Random.image( size?, background?, foreground?, format?, text? )

Data Template

// Random.image()
Random.image()
// Random.image( size )
Random.image('200x100')
// Random.image( size, background )
Random.image('200x100', '#FF6600')
// Random.image( size, background, text )
Random.image('200x100', '#4A7BF7', 'Hello')
// Random.image( size, background, foreground, text )
Random.image('200x100', '#50B347', '#FFF', 'Mock.js')
// Random.image( size, background, foreground, format, text )
Random.image('200x100', '#894FC4', '#FFF', 'png', '!')

Result

imgimgimgimgimgimg

 

Random.dataImage( size?, text? )

Data Template

// Random.dataImage()
Random.dataImage()

// Random.dataImage( size )
Random.dataImage('200x100')

// Random.dataImage( size, text )
Random.dataImage('200x100', 'Hello Mock.js!')

Result

imgimgimg

 

Color

Random.color()

Data Template

// Random.color()
Random.color()
Mock.mock('@color')
Mock.mock('@color()')

Result

// Random.color()
"#79b4f2"
"#d7f279"
"#e979f2"

 

 

Random.hex()

Data Template

// Random.hex()
Random.hex()
Mock.mock('@hex')
Mock.mock('@hex()')

Result

// Random.hex()
"#79f2c6"
"#f2a279"
"#7f79f2"

 

 

Random.rgb()

Data Template

// Random.rgb()
Random.rgb()
Mock.mock('@rgb')
Mock.mock('@rgb()')

Result

// Random.rgb()
"rgb(150, 242, 121)"
"rgb(242, 121, 185)"
"rgb(121, 220, 242)"

 

 

Random.rgba()

Data Template

// Random.rgba()
Random.rgba()
Mock.mock('@rgba')
Mock.mock('@rgba()')

Result

// Random.rgba()
"rgba(242, 228, 121, 0.63)"
"rgba(192, 121, 242, 0.06)"
"rgba(121, 242, 157, 0.75)"

 

 

Random.hsl()

Data Template

// Random.hsl()
Random.hsl()
Mock.mock('@hsl')
Mock.mock('@hsl()')

Result

// Random.hsl()
"hsl(0, 82, 71)"
"hsl(223, 82, 71)"
"hsl(85, 82, 71)"

 

 

Text

Random.paragraph( min?, max? )

Data Template

// Random.paragraph()
Random.paragraph()

Mock.mock('@paragraph')

Mock.mock('@paragraph()')

// Random.paragraph( len )
Random.paragraph(2)

Mock.mock('@paragraph(2)')

// Random.paragraph( min, max )
Random.paragraph(1, 3)

Mock.mock('@paragraph(1, 3)')

Result

// Random.paragraph()
"Truc kwfow cnzv vjilx wedhblxwpw pgdwfkkwos nyrtv ujtm njiobq xensrakxx wwaafyqe mjewzjhip qblpr. Ivy hcigiv dkvlyb gvdimd syeqsv llo smgmdw xjgyxmph brssvvxq krbk ygdjr hss kfesakijez ekex lughwu akoshndynw bcilybo. Oib ymhq ili pskufgeyuf ojcokuc hychkuqyk kbrejb zxacb plkuaw qzfwuwf cbrleehkf nvytw xggyi. Nyvnrgsh rrxlxyc cbfoeshtm cyopgu uwlbbajcs rsd nult kum ludddv kysfjdk htqqsjpogn tilykbigyw lltyegk civewucb enxws uurxy rfdeyfsyl."

"Bodbeqqtz dcdsxcijgm irc euzbwwq gsystzvyu niwbslleh ikbhd cooirxejs imkpkiwgh mtrjvlvghi izkuiw cgfgt brgu mgols. Dbxnqqdf bgcutbw nmxjjig ybibdht xfo jdg wxtql xgdl mitarimkf eqcijsn wpwh eqftew. Nhfed gohx hmegnfhd yvfaitjoz boqpr mcyaggrs wqohujnaf btkqbeh ekfsp jyesfwzf qmpcjd doffrcsshv slocnq. Jydrjewr tfmkeuqe xhksta lelwmj hfbd pthsbawbx unxlhp ttnqsfz fre dklvjgp sgiyy nvgapxs kliwprbkbg rdttlk lqyifmu mjhyxknik xqbvfrjz. Nmly kroinwjnr orck jatw sekllmfem xgiytmnwrt lcpf aleljqw moll rohbazut pju sto xokiueoaf. Rjnpchiru yywkrsru ykgd brfell mqzbc gqs gshdphvf nlmuegyq vydm lymnrunyet ohjjgzu jtevvir wcivs esmdiy kqxkdy."

"Eyift dlhbc dowrxkklwj hbewjpeim hcfsokknhl vohms bplrfo lhueltgohr fvwfxchzxj idlyepbgt rikggd dfubcdkpd gvqkb zryeahozr cqism dcc kodcbxto. Hgljxwe skbrtnf jpylvjshs iooelcy tnsgvtu hhsn ngekhy lof sfq xoy nwhciqga rrkhilk whdrhk kft cety jondufryx qjncsmhkpp. Qwxlm xhlff vmwevwqlsb prusb tsjujfdp iyjafjrmif havvrho ykb vege vvxguvwje ttmhuf xwbmrbenz fqlp pber xuxgsbxfor wdkhf psowirap. Iesrfy ncpmnrtpl naxukxi wruh lse xwjpynnrrh hbwz xjmr dlchfhua peylwb ekcovpa egfujd. Hrow brgrbzil gsmr lkc iktjdkykg ucwbxidc nndfyvh spuv cfgo atbry pbniv swuewwzfp emifocnvf bbovdw xsbl. Qjtk stey ieppn xnurkrpf wffoi ijqm vsuhcd jpachdvqbq nmimmpp dspldnrqc mfcl bvgic dkyipgi rdidea iverqnc ddoxgjl fbcjrdwpo."

// Random.paragraph( len )
"Ajngidmq srdfnlo kbtlyii rfygpqd jfiossco blyzxnhr unf tmbqk quhiwa aofdgrpt kvxmtqqbt sjhl jceqbrsqj esndbho voiwmxk. Lwcehgvfkp bfobxwdd lgxnld raxrby psll ythld mvfhto hsv mpmlystg wczr jkg rglt vhkonkw qsh yhrggk wurm pabolwr mgbskexjfk."

"Sshidbdo ntsjmxt vdlchnep oho hnaltyfmi okrpxdqw fwmudjh vogrdpil uupqhlpv icmotii lqoaw myspwfj dseblzkmhf. Ghifxizwf rwqiuy izcjyce qwnus gwmu lgrpj gitehf kuuiz cwgl ieqndxvo golzvcsk wwcucdm mbqvl fdykqajgk zzxxhlpke."

// Random.paragraph( min, max )
"Rtdlbs fedf gmhdjkbw ejnwsgjhy hnhuxpfje irmpcg vhtiojy xgpcohuwn njwpsx lfm unuyokptw hechtd uuizge. Hcks ovbwgkfk oka gjtecm divclpp oknrwkw ozrjqvpi ccsmwgj iaoiiyk rxqojprqv wcsveqa oyikspelw utqukbghg. Mpvbyu mbntalmsy kgsfyb uqmrv fetnwlu wwooxyelm fvucagpli ylvlmotvu gdvumux wnrho xjnhxmj oxigiqufg jymvby ritmydws byuoldnmnx inkli hdqeu vtwuiios."

"Vebwxewu eohih rovdms axwckikx ingrtgycvl eapn hujjqj kubfxcd ixqzrun otckaerg dtfnktu glqsyg kihjv yzialzxm kgtemmu guxrfdym. Zgwl orne tfup nrdyepxjfj gydjqojeth xcj tcrayd wferubn vsert ksrry ubopusoo bbiriskx nisekrdbk."

 

 

Random.sentence( min?, max? )

Data Template

// Random.sentence()
Random.sentence()
Mock.mock('@sentence')
Mock.mock('@sentence()')

// Random.sentence( len )
Random.sentence(5)
Mock.mock('@sentence(5)')

// Random.sentence( min, max )
Random.sentence(3, 5)
Mock.mock('@sentence(3, 5)')

Result

// Random.sentence()
"Dstmeke pftlmdvu tro oiaypzd nngewwrcc umnfdypech nbtfygt ayeovn exai wgzd kbhic exbtm oaev tdavjwm."
"Lrupazmzyh wdxnx jcvq nhqnlp tcmy rrousrd ytkncsufhd wzpf ncwi auow nhskfp ntwwe nyhtpvqtmn nvnfwo."
"Kpegtp kxtjnjjei grkqchqy tsptlfyx riynhu uoo vunccx qsv nocbyzkv ukdm ngwcoeyj lqgis enhplqxku xrgwvwvdb wbgqiqng nlbafxltc mijwqqfn lgzpsqv."

// Random.sentence( len )
"Pbtnlgj gxmxnwaok boyocq kttkp nwvejpvw."
"Fcei iwablb jbfkvz qrwdt ibteglh."

// Random.sentence( min, max )
"Iilcx tsbp fywwb hnhvm."
"Bmfnnmm wsqvaiur fwpdg qmpnvduxei."

 

 

Random.word( min?, max? )

Data Template

// Random.word()
Random.word()
Mock.mock('@word')
Mock.mock('@word()')

// Random.word( len )
Random.word(5)
Mock.mock('@word(5)')

// Random.word( min, max )
Random.word(3, 5)
Mock.mock('@word(3, 5)')

Result

// Random.word()
"qmscxofrlf"
"rdzj"
"mwikwjz"

// Random.word( len )
"ntvte"
"ikark"

// Random.word( min, max )
"bhht"
"vutq"

 

 

Random.title( min?, max? )

Data Template

// Random.title()
Random.title()
Mock.mock('@title')
Mock.mock('@title()')

// Random.title( len )
Random.title(5)
Mock.mock('@title(5)')

// Random.title( min, max )
Random.title(3, 5)
Mock.mock('@title(3, 5)')

Result

// Random.title()
"Vfkdhiyw Vqrl Jgks Yokxcx Rrdek Wijfuec Okykcb"
"Yrpr Ewy Cytjrvxwt Qdrm Roxjw Xbrpdiyyd"
"Wzbawi Jtgqeipnk Duja"

// Random.title( len )
"Bcw Qcvl Moessuyhw Lgriusyur Eqfxtjbjgw"
"Jlmpuoy Knmgfov Xutudwhj Dyqtde Dxuyov"

// Random.title( min, max )
"Upjtsdd Apcyi Znwpchxm"
"Tmrxuek Rsjcsnrqk Uhuptykufy Jbpggg"

 

 

Random.cparagraph( min?, max? )

Data Template

// Random.cparagraph()
Random.cparagraph()

Mock.mock('@cparagraph')

Mock.mock('@cparagraph()')

// Random.cparagraph( len )
Random.cparagraph(2)

Mock.mock('@cparagraph(2)')

// Random.cparagraph( min, max )
Random.cparagraph(1, 3)

Mock.mock('@cparagraph(1, 3)')

Result

// Random.cparagraph()
"平过增值四里地重府际要点集重火有话。条已复工较而眼始完象后正风得众何体。节派很元林光们今切每我平。家该六特小根家百时社少名文。题离老基制集论加业参段决年。"

"本华北真收证热该活思了业酸意。常题度由张千委支度红别而么感知理技实。多七包值第究断政他取农比各。每新光斗而山点决半比车处保米学科信。下经前九指东九持办才进中。"

"群社能才素进受物年再天千须发准流常。工于学光又金图物素下管象等规么。着通今任品而上集全内权转。"

// Random.cparagraph( len )
"示转王好规以天听住越或使众教。没理地全果一少清高京九属连展最拉。"

"法标海题教原往必价易查得劳快达准。写速式以许回响方国积县动影等低位。"

// Random.cparagraph( min, max )
"于性火整会温西布个又习论界圆情者三。"

"回美包些合华节传影长期斗情条处。手看王如何十知千速县基它算共装石引。"

 

 

Random.csentence( min?, max? )

Data Template

// Random.csentence()
Random.csentence()
Mock.mock('@csentence')
Mock.mock('@csentence()')

// Random.csentence( len )
Random.csentence(5)
Mock.mock('@csentence(5)')

// Random.csentence( min, max )
Random.csentence(3, 5)
Mock.mock('@csentence(3, 5)')

Result

// Random.csentence()
"江识斯争利道根带万公江能她我。"
"压现图入总为海极义感层低。"
"百当型响万战值红下没改而于之。"

// Random.csentence( len )
"打写又四接。"
"且七走权毛。"

// Random.csentence( min, max )
"清素以。"
"次其作。"

 

 

Random.cword( pool?, min?, max? )

Data Template

// Random.cword()
Random.cword()
Mock.mock('@cword')
Mock.mock('@cword()')

// Random.cword( pool )
Random.cword('零一二三四五六七八九十')
Mock.mock('@cword("零一二三四五六七八九十")')

// Random.cword( length )
Random.cword(3)
Mock.mock('@cword(3)')

// Random.cword( pool, length )
Random.cword('零一二三四五六七八九十', 3)
Mock.mock('@cword("零一二三四五六七八九十", 3)')

// Random.cword( min, max )
Random.cword(3, 5)
Mock.mock('@cword(3, 5)')

// Random.cword( pool, min, max )
Random.cword('零一二三四五六七八九十', 5, 7)
Mock.mock('@cword("零一二三四五六七八九十", 5, 7)')

Result

// Random.cword()
"情"
"亲"
"日"

// Random.cword( pool )
"三"
"一"

// Random.cword( length )
"使或支"
"处阶约"

// Random.cword( pool, length )
"六六十"
"零八四"

// Random.cword( min, max )
"后说育过"
"级与很保"

// Random.cword( pool, min, max )
"零二八九二十"
"九七十五十十"

 

 

Random.ctitle( min?, max? )

Data Template

// Random.ctitle()
Random.ctitle()
Mock.mock('@ctitle')
Mock.mock('@ctitle()')

// Random.ctitle( len )
Random.ctitle(5)
Mock.mock('@ctitle(5)')

// Random.ctitle( min, max )
Random.ctitle(3, 5)
Mock.mock('@ctitle(3, 5)')

Result

// Random.ctitle()
"建拉究从"
"多天车大感"
"省油清集离度"

// Random.ctitle( len )
"气采运酸每"
"切叫区参据"

// Random.ctitle( min, max )
"中展型"
"东基发出整"

 

 

Name

Random.first()

Data Template

// Random.first()
Random.first()
Mock.mock('@first')
Mock.mock('@first()')

Result

// Random.first()
"Anna"
"Frank"
"Anna"

 

 

Random.last()

Data Template

// Random.last()
Random.last()
Mock.mock('@last')
Mock.mock('@last()')

Result

// Random.last()
"Gonzalez"
"Williams"
"Walker"

 

 

Random.name( middle? )

Data Template

// Random.name()
Random.name()
Mock.mock('@name')
Mock.mock('@name()')

// Random.name( middle )
Random.name(true)
Mock.mock('@name(true)')

Result

// Random.name()
"Anna Young"
"Betty Wilson"
"Matthew Jones"

// Random.name( middle )
"Sharon Matthew Wilson"
"Christopher Patricia Moore"

 

 

Random.cfirst()

Data Template

// Random.cfirst()
Random.cfirst()
Mock.mock('@cfirst')
Mock.mock('@cfirst()')

Result

// Random.cfirst()
"孟"
"叶"
"熊"

 

 

Random.clast()

Data Template

// Random.clast()
Random.clast()
Mock.mock('@clast')
Mock.mock('@clast()')

Result

// Random.clast()
"磊"
"洋"
"强"

 

 

Random.cname()

Data Template

// Random.cname()
Random.cname()
Mock.mock('@cname')
Mock.mock('@cname()')

Result

// Random.cname()
"冯娟"
"夏桂英"
"程敏"

 

 

Web

Random.url()

Data Template

// Random.url()
Random.url()
Mock.mock('@url')
Mock.mock('@url()')

Result

// Random.url()
"news://fouron.om/cfnbdw"
"prospero://bwgenfnw.cr/jsbqsxsf"
"mailto://cdkgjn.cy/gsicucwizy"

 

 

Random.domain()

Data Template

// Random.domain()
Random.domain()
Mock.mock('@domain')
Mock.mock('@domain()')

Result

// Random.domain()
"hdpq.bt"
"glyjyd.az"
"grtp.si"

 

 

Random.protocol()

Data Template

// Random.protocol()
Random.protocol()
Mock.mock('@protocol')
Mock.mock('@protocol()')

Result

// Random.protocol()
"news"
"mailto"
"prospero"

 

 

Random.tld()

Data Template

// Random.tld()
Random.tld()
Mock.mock('@tld')
Mock.mock('@tld()')

Result

// Random.tld()
"lt"
"edu"
"gm"

 

 

Random.email()

Data Template

// Random.email()
Random.email()
Mock.mock('@email')
Mock.mock('@email()')

Result

// Random.email()
"u.twyctd@humyaq.ml"
"y.knd@qltgao.sh"
"p.bdxcyyucha@oegscs.ao"

 

 

Random.ip()

Data Template

// Random.ip()
Random.ip()
Mock.mock('@ip')
Mock.mock('@ip()')

Result

// Random.ip()
"110.31.72.25"
"181.133.145.59"
"63.168.92.65"

 

 

Address

Random.region()

Data Template

// Random.region()
Random.region()
Mock.mock('@region')
Mock.mock('@region()')

Result

// Random.region()
"华中"
"华中"
"华北"

 

 

Random.province()

Data Template

// Random.province()
Random.province()
Mock.mock('@province')
Mock.mock('@province()')

Result

// Random.province()
"陕西省"
"河南省"
"新疆维吾尔自治区"

 

 

Random.city( prefix? )

Data Template

// Random.city()
Random.city()
Mock.mock('@city')
Mock.mock('@city()')
// Random.city( prefix )
Random.city(true)
Mock.mock('@city(true)')

Result

// Random.city()
"唐山市"
"白银市"
"大理白族自治州"
// Random.city( prefix )
"河北省 唐山市"
"青海省 海南藏族自治州"

 

 

Random.county( prefix? )

Data Template

// Random.county()
Random.county()
Mock.mock('@county')
Mock.mock('@county()')
// Random.county( prefix )
Random.county(true)
Mock.mock('@county(true)')

Result

// Random.county()
"盐边县"
"梨树区"
"葵青区"
// Random.county( prefix )
"内蒙古自治区 兴安盟 科尔沁右翼前旗"
"福建省 厦门市 海沧区"

 

 

Random.zip()

Data Template

// Random.zip()
Random.zip()
Mock.mock('@zip')
Mock.mock('@zip()')

Result

// Random.zip()
"943610"
"352381"
"339123"

 

 

Helper

Random.capitalize( word )

Data Template

// Random.capitalize( word )
Random.capitalize('hello')
Mock.mock('@capitalize("hello")')

Result

// Random.capitalize( word )
"Hello"
"Hello"

 

 

Random.upper( str )

Data Template

// Random.upper( str )
Random.upper('hello')
Mock.mock('@upper("hello")')

Result

// Random.upper( str )
"HELLO"
"HELLO"

 

 

Random.lower( str )

Data Template

// Random.lower( str )
Random.lower('HELLO')
Mock.mock('@lower("HELLO")')

Result

// Random.lower( str )
"hello"
"hello"

 

 

Random.pick( arr )

Data Template

// Random.pick( arr )
Random.pick(['a', 'e', 'i', 'o', 'u'])
Mock.mock('@pick(["a", "e", "i", "o", "u"])')

Result

// Random.pick( arr )
"o"
"i"

 

 

Random.shuffle( arr )

Data Template

// Random.shuffle( arr )
Random.shuffle(['a', 'e', 'i', 'o', 'u'])
Mock.mock('@shuffle(["a", "e", "i", "o", "u"])')

Result

// Random.shuffle( arr )
["a","o","i","u","e"]
["i","e","a","o","u"]

 

 

Miscellaneous

Random.guid()

Data Template

// Random.guid()
Random.guid()
Mock.mock('@guid')
Mock.mock('@guid()')

Result

// Random.guid()
"D27621E6-ECDA-bbEe-3EB3-d9D8e617Af2d"
"A1a7D79b-420c-AeBE-DAbf-49AAAD55ebe0"
"2cB4d74A-CCEE-A35F-ebB4-ED94C6F775C4"

 

 

Random.id()

Data Template

// Random.id()
Random.id()
Mock.mock('@id')
Mock.mock('@id()')

Result

// Random.id()
"710000197108196463"
"640000197207285527"
"520000201207137569"

 

 

Random.increment( step? )

Data Template

// Random.increment()
Random.increment()
Mock.mock('@increment')
Mock.mock('@increment()')

// Random.increment( step )
Random.increment(100)
Mock.mock('@increment(100)')
Random.increment(1000)
Mock.mock('@increment(1000)')
posted @ 2021-03-23 20:20  焕不涣  阅读(1133)  评论(0编辑  收藏  举报