Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pixcai/giveme

A random data generator
https://github.com/pixcai/giveme

Last synced: 26 days ago
JSON representation

A random data generator

Awesome Lists containing this project

README

        

# giveme
A random data generator

## Install
```shell
npm install --save-dev giveme
```

## Usage
Browser:
```html

```
Node.js:
```js
var giveme = require('giveme')
```

## Types
### color
Get a random hex color.

Options: `min`, `max`.

```js
console.log(giveme('color'))
console.log(giveme('color', {
min: 0x222222,
max: 0xcccccc
}))
```

### image
Get a random placeholder image.

Options: `width`, `height`, `background`, `foreground`, `format`, `text`.

```js
console.log(giveme('image'))
console.log(giveme('image', {
width: 200,
height: 400,
format: '.jpg',
text: 'hello'
}))
```
### word
Get a word.

Options: `lang`, `length`.

```js
console.log(giveme('word'))
console.log(giveme('word', {
lang: 'zh_CN',
length: 5
}))
```

### rgb
Get a rgb color.

Options: `r`, `g`, `b`.

```js
console.log(giveme('rgb'))
console.log(giveme('rgb', {
r: {
min: 0
max: 214
},
b: {
min: 112,
max: 140
}
}))
```

### rgba
Get a rgba color.

Options: `r`, `g`, `b`, `a`.

```js
console.log(giveme('rgba'))
console.log(giveme('rgba', {
r: {
min: 0,
max: 214
},
a: {
min: 0.5,
max: 1
}
}))
```

### time
Get a random time.

Options: `format`.

`H`: 24-hour system

`h`: 12-hour system

`HH`, `hh`, `MM`, `mm`, `SS`, `ss`: with prefix 0. e.g. `07:23:01`

`h`, `H`, `M`, `m`, `S`, `s`: widthout prefix 0. e.g. `7:23:1`
```js
console.log(giveme('time'))
console.log(giveme('time', {
format: 'hh:mm:ss'
}))
```

### boy-friend
Get a boy friend.

Options: `age`, `height`, `weight`, `houses`, `cars`, `money`.
```js
console.log(giveme('boy-friend'))
```

### girl-friend
Get a girl friend.

Options: `age`, `height`, `weight`, `bust`, `waist`, `hips`, `money`.
```js
console.log(giveme('girl-friend', {
age: 18
}))
```

## License
MIT