Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/pixcai/giveme
- Owner: pixcai
- License: mit
- Created: 2016-09-28T03:15:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-29T14:11:03.000Z (about 8 years ago)
- Last Synced: 2024-01-27T09:02:17.475Z (9 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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