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

@vitalicset/faker.ts

v1.0.1

Published

Generate massive amounts of fake contextual data using typescript decorators

Downloads

3

Readme

Faker.ts

Generate massive amounts of fake contextual data using typescript decorators

This package based from faker.js package

Usage

import Faker, { address, internet } from "faker-ts";

@Faker()
class MyObject {
  @address.name()
  randomName: string;

  @internet.email()
  randomEmail: string;
}

const instance = new MyObject();
instance.randomName; // // Rowan Nikolaus
instance.randomEmail; // [email protected]

Setup (typescript)

  • npm i typescript --save-dev

  • npx tsc --init - creates tsconfig.json file

  • Enable experimentalDecorators and emitDecoratorMetadata in your tsconfig.json file

API

Each parameter decorator have an option : alwaysRandom. It means each call of property - generate new value.

Example:

import { Fake, name } from "faker-ts";
@Fake()
class RandomMan {
  @name.firstName({ alwaysRandom: true })
  alwaysRandomName: string;
}
const myModel = new RandomMan();
function hello(name: string) {
  console.log("Hello, ", name);
}
hello(myModel.alwaysRandomName); // output: Hello, Marlin
hello(myModel.alwaysRandomName); // output: Hello, Sydnie

Fake()

Fake class decorator initialze all fakes properties.

Example:

import { Fake, fake } from "faker-ts";
@Fake()
class A {
  @fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}")
  name: string;
}
console.log(new A().name); // outputs: "Marks, Dean Sr."

fake()

fake property decorator that will call original faker.fake() function with the same parameters.

Example:

import { Fake, fake } from "faker-ts";
@Fake()
class A {
  @fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}")
  name: string;
}
console.log(new A().name); // outputs: "Marks, Dean Sr."

API Decorators

  • address
    • zipCode
    • zipCodeByState
    • city
    • cityPrefix
    • citySuffix
    • streetName
    • streetAddress
    • streetSuffix
    • streetPrefix
    • secondaryAddress
    • county
    • country
    • countryCode
    • state
    • stateAbbr
    • latitude
    • longitude
    • direction
    • cardinalDirection
    • ordinalDirection
    • nearbyGPSCoordinate
    • timeZone
  • commerce
    • color
    • department
    • productName
    • price
    • productAdjective
    • productMaterial
    • product
    • productDescription
  • company
    • suffixes
    • companyName
    • companySuffix
    • catchPhrase
    • bs
    • catchPhraseAdjective
    • catchPhraseDescriptor
    • catchPhraseNoun
    • bsAdjective
    • bsBuzz
    • bsNoun
  • database
    • column
    • type
    • collation
    • engine
  • date
    • past
    • future
    • between
    • recent
    • soon
    • month
    • weekday
  • finance
    • account
    • accountName
    • routingNumber
    • mask
    • amount
    • transactionType
    • currencyCode
    • currencyName
    • currencySymbol
    • bitcoinAddress
    • litecoinAddress
    • creditCardNumber
    • creditCardCVV
    • ethereumAddress
    • iban
    • bic
    • transactionDescription
  • git
    • branch
    • commitEntry
    • commitMessage
    • commitSha
    • shortSha
  • hacker
    • abbreviation
    • adjective
    • noun
    • verb
    • ingverb
    • phrase
  • helpers
    • randomize
    • createCard
    • contextualCard
    • userCard
    • createTransaction
  • image
    • image
    • avatar
    • imageUrl
    • abstract
    • animals
    • business
    • cats
    • city
    • food
    • nightlife
    • fashion
    • people
    • nature
    • sports
    • technics
    • transport
    • dataUri
    • lorempixel
    • unsplash
    • lorempicsum -internet
    • avatar
    • email
    • exampleEmail
    • userName
    • protocol
    • url
    • domainName
    • domainSuffix
    • domainWord
    • ip
    • ipv6
    • userAgent
    • color
    • mac
    • password
  • lorem
    • word
    • words
    • sentence
    • slug
    • sentences
    • paragraph
    • paragraphs
    • text
    • lines
    • music
    • genre -name
    • firstName
    • lastName
    • findName
    • jobTitle
    • gender
    • prefix
    • suffix
    • title
    • jobDescriptor
    • jobArea
    • jobType
  • phone
    • phoneNumber
    • phoneNumberFormat
    • phoneFormats
  • random
    • number
    • float
    • arrayElement
    • arrayElements
    • objectElement
    • uuid
    • boolean
    • word
    • words
    • image
    • locale
    • alpha
    • alphaNumeric
    • hexaDecimal
  • system
    • fileName
    • commonFileName
    • mimeType
    • commonFileType
    • commonFileExt
    • fileType
    • fileExt
    • directoryPath
    • filePath
    • semver
  • time
    • recent
    • unique
  • vehicle
    • vehicle
    • manufacturer
    • model
    • type
    • fuel
    • vin
    • color