File: url.md

package info (click to toggle)
node-chance 2.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,612 kB
  • sloc: javascript: 16,572; makefile: 4
file content (53 lines) | stat: -rw-r--r-- 1,096 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# url

```js
// usage
chance.url()
chance.url({protocol: 'ftp'})
chance.url({domain: 'www.socialradar.com'})
chance.url({domain_prefix: 'docs'})
chance.url({path: 'images'})
chance.url({extensions: ['gif', 'jpg', 'png']})
```

Return a random url.

```js
chance.url()
=> 'http://vanogsi.io/pateliivi'
```

Optionally specify a protocol and the url will be random but the protocol will not.

```js
chance.url({protocol: 'ftp'})
=> 'ftp://mibfu.nr/kardate'
```

Optionally specify a domain and the url will be random but the domain will not.

```js
chance.url({domain: 'www.socialradar.com'})
=> 'http://www.socialradar.com/hob'
```

Optionally specify a domain prefix and domain will be random, and domain prefix will not.

```js
chance.url({domain_prefix: 'docs'})
=> 'http://docs.tuos.ni/itecabup'
```

Optionally specify a path and it will be obeyed.

```js
chance.url({path: 'images'})
=> 'http://tainvoz.net/images'
```

Optionally specify an array of extensions and one will be picked at random.

```js
chance.url({extensions: ['gif', 'jpg', 'png']})
=> 'http://vagjiup.gov/udmopke.png'
```