npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

great-generator

v0.1.4

Published

``` npm i great-generator --save ``` ### 友情链接 [great-generator](https://www.npmjs.com/package/great-generator)、 [great-jsutils](https://www.npmjs.com/package/great-jsutils)、 [great-ngform](https://www.npmjs.com/package/great-ngform)、 [great-zorrout

Downloads

4

Readme

great-generator

npm i great-generator --save

友情链接

great-generatorgreat-jsutilsgreat-ngformgreat-zorroutilsgreat-vue

一、基本工具类

1、数字

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number | | min | 生成数字最小值 | 否,默认为0 | number | | max | 生成数字最大值 | 否,默认为10 | number |

const { GNumberUtils} = require('great-generator');
// 生成一个整数
console.log(GNumberUtils.randomInt());
// 生成一个小数
console.log(GNumberUtils.randomFloat());
// 生成10个整数
console.log(GNumberUtils.randomInt({number: 10}));
// 生成10个小数
console.log(GNumberUtils.randomFloat({number: 10}));
// 生成一个最小为100的整数
console.log(GNumberUtils.randomInt({min: 100}));
// 生成一个最小为100的小数
console.log(GNumberUtils.randomFloat({min: 100}));
// 生成一个最大为100的整数
console.log(GNumberUtils.randomInt({max: 100}));
// 生成一个最大为100的小数
console.log(GNumberUtils.randomFloat({max: 100}));
// 生成10个最小为100的整数
console.log(GNumberUtils.randomInt({number: 10, min: 100}));
// 生成10个最小为100的小数
console.log(GNumberUtils.randomFloat({number: 10, min: 100}));

2、个人

const { GPersonUtils} = require('great-generator');

2.1、姓名

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GPersonUtils} = require('great-generator');
console.log(GPersonUtils.randomName()); // 吉云飞
console.log(GPersonUtils.randomName({number: 3 })); // [ '解龙', '党虎', '卜霞霞' ]

2.2、用户

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GPersonUtils} = require('great-generator');
console.log(GPersonUtils.randomUser()); // 生成一个用户
console.log(GPersonUtils.randomUser({number: 3 })); // 生成三个用户

3、联系方式

const { GContactUtils} = require('great-generator');

3.1、手机号

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GContactUtils} = require('great-generator');
// 生成一个手机号
console.log(GContactUtils.mobile()); // 15019056146
// 生成3个手机号
console.log(GContactUtils.mobile({number: 3})); // [ '18052557552', '13822156849', '15667326112' ]

3.2、邮箱

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GContactUtils} = require('great-generator');
// 生成一个邮箱
console.log(GContactUtils.email()); // [email protected]
// 生成3个邮箱
console.log(GContactUtils.email({number: 3})); //[ '[email protected]', '[email protected]', '[email protected]' ]

3.3、地址

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GContactUtils} = require('great-generator');
// 生成一个地址
console.log(GContactUtils.address());
// 生成三个地址
console.log(GContactUtils.address({number: 3}));

4、生成颜色(GColorUtils)

const {GColorUtils} = require('great-generator');

5、编号

const {GCodeUtils} = require('great-generator');

5.1、编号

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number | | upperCase | 是否大写 | 否,默认为true | boolean | | length | 长度 | 否,默认为1 | number | | prefix | 前缀 | 否 | string | | suffix | 后缀 | 否 | string |

const {GCodeUtils} = require('great-generator');
console.log(GCodeUtils.letter()); // E
console.log(GCodeUtils.letter({number:8})); // [ 'W', 'M', 'F', 'H', 'R', 'L', 'H', 'T', 'S' ]
console.log(GCodeUtils.letter({number:8, upperCase: false})); // [ 'd', 'd', 'c', 'w', 'r', 'e', 'u', 'u', 'y' ]
console.log(GCodeUtils.letter({length:8, upperCase: false})); // xgvxrpyb
console.log(GCodeUtils.letter({number:8, length:2, upperCase: false})); // [ 'rylkpddf', 'lguhovtx' ]

6、时间

const {GTimeUtils} = require('great-generator');

6.1、时间

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GTimeUtils} = require('great-generator');
// 生成一个日期类型
console.log(GTimeUtils.date()); // 2021-06-04T21:26:30.713Z
console.log(GTimeUtils.date({number: 2})); // [2021-06-04T21:26:30.713Z, 2021-06-04T21:26:30.713Z]

6.2、时间字符串

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | number | 生成的数量 | 否,默认为1 | number |

const {GTimeUtils} = require('great-generator');
// 生成一个字符串类型
console.log(GTimeUtils.str()); // 2018-07-10 20:06:23
// 生成2个字符串类型
console.log(GTimeUtils.str({number: 2})); // [ '2019-06-17 01:48:32', '2024-10-06 21:30:29' ]

7、树结构数据

| 参数 | 名称 | 必传 | 参数类型 | ------ | ------ | ------ | ------ | | maxLevel | 最多几层 | 否,默认为5 | number | | minLevel | 最少几层 | 否,默认为1 | number | | maxNum | 每层最多几个 | 否,默认为5 | number |

const {GTreeUtils} = require('great-generator');
const nodes1 = GTreeUtils.tree();
console.log(nodes1);
const nodes2 = GTreeUtils.tree({maxLevel: 3, maxNum: 7});
console.log(nodes2);

组织机构

1、机构

const {GOrganizationUtils} = require('great-generator');

2、部门

const {GDepartmentUtils} = require('great-generator');

3、岗位

const {GPostUtils} = require('great-generator');