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

fakeme

v0.4.0

Published

Random generate name, email, address, id...

Downloads

23

Readme

Build Status codecov.io

fakeme

随机生成人名,邮箱,性别,id等信息,接口简单,数据覆盖全,支持中英文。

Install

NPM

npm i fakeme

Broswer

Source Code

CDN

https://unpkg.com/[email protected]/lib/fakeme.umd.min.js (更改fakeme后边的version号,获取指定版本的源文件)

Usage

Node

const FakeMe = require('fakeme');
const fm = new FakeMe({
  lang: 'zh',
  sex: 'female'
});
fm.name({count: 10}); // [ '韶妙竹','宁初雪','彭幻珊','明醉波','云幼翠','高如曼','杨涵雁','吴青亦','孔之柔','红元菱' ]
fm.name({lang: 'en', count: 5}); // [ 'Kristine Wood','Claudia Lopez','Annabelle Griffin','Greta Simmons','Sonia Walker' ]
fm.id({length: 18, count: 2}); // [ 'FF4oAsoY_EGi1CJVfb', 'gnfDLKp_tJQd_NyQiK' ]
fm.email(); // [ '[email protected]' ]
fm.sex(); // [ '男' ]
fm.sex({lang: 'en'}); // [ 'female' ]
fm.random(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 5); // [ 'a', 'd', 'c', 'c', 'd' ]

ES Module

import FakeMe from 'fakeme';
const fm = new FakeMe();
fm.name();

浏览器

<script src="https://unpkg.com/[email protected]/lib/fakeme.umd.min.js"></script>
<script>
var fm = new FakeMe();
fm.name();
</script>

Api

FakeMe(opts: Object)

opts.lang

指定全局语言 [默认: zh],lang的值只能为zhzh-hant或者en。(这个值会被具体调用的函数里传的lang覆盖)

opts.sex

指定全局性别 [默认: male],sex的值只能为male或者female。(这个值会被具体调用的函数里传的sex覆盖)

import FakeMe from 'fakeme';
const fm = new FakeMe();

fm.name(opts: Object): Array

返回值为数组。

opts.lang

可选

这个参数指定生成中文或者英文的名字。

如果不指定,默认使用全局配置的langlang的值只能为zhzh-hant或者en

opts.sex

可选

这个参数指定生成男性或者女性的名字。

如果不指定,默认使用全局配置的sexsex的值只能为male或者female

opts.count

可选

(默认值: 1)

这个参数指定随机生成名字的个数。

opts.lastName

可选

这个参数指定生成名字的姓。比如:

fm.name({lastName: '李'}); // [ '李秋白' ]

fm.email(opts: Object): Array

返回值为数组。

opts.type

可选

(默认值: name)

这个参数指定生成邮箱的类型,这个参数有三个可选项:

  • name - 邮箱的前半部分是英文名字
  • number - 邮箱的前半部分是随机的一串数字
  • letter - 邮箱的前半部分是随机的一串字母

opts.sex

可选

这个参数在使用type为name时会生效,指定英文名字是男性还是女性的。

opts.count

可选

(默认值: 1)

这个参数指定随机生成邮箱的个数。

opts.suffix

可选

这个参数可以指定邮箱的后缀。比如:

fm.email({suffix: '@qq.com'}); // [ '[email protected]' ]

fm.sex(opts: Object): Array

返回值是一个数组。

opts.lang

可选

这个参数指定生成中文或者英文的性别。

如果不指定,默认使用全局配置的langlang的值只能为zh或者en

opts.count

可选

(默认值: 1)

这个参数指定随机生成性别的个数。

fm.id(opts: Object): Array

返回值是一个数组。

opts.length

可选

(默认值: 10)

这个参数指定生成Id的长度。

opts.count

可选

(默认值: 1)

这个参数指定生成Id的个数。

fm.random(list: Array, count: Number)

这个函数可以指定一个随机区域,然后从指定的列表中获得随机的元素。

list

可选

(默认值: [])

这个参数指定随机的区域。

count

可选

(默认值: 1)

这个参数制定获取随机元素的个数。

fm.random(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 5); // [ 'a', 'd', 'c', 'c', 'd' ]

LICENSE

MIT © PengJiyuan