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

feku

v0.1.1

Published

Generate intelligent fake data

Downloads

37

Readme

Feku

Generate intelligent random data based on a spec file.

Features

  • CLI
  • examples
  • helper functions to generate random data
  • customizable output JSON lines (jsonld / ndjson) or JSON Array
  • custom spec files to generate new rows based on previously generated data (for example account balance must take into account previous transaction as well)

Usage

Options

  • --count or -n accepts number of items to generate
  • --array or -a

Examples:

feku examples/movies.js by default produces json lines (jsonld / ndjson)

{"title":"sint voluptatem","year":2014,"rating":4,"duration":102,"genre":"Romance","image":"http://loremflickr.com/640/480/abstract","description":"Laudantium minima quae libero asperiores voluptatem adipisci. Doloribus rerum praesentium.","cast":["Shawna Pollich DVM","Miss Josefina Schmidt","Lizeth"]}
{"title":"aperiam nostrum odit excepturi sint","year":2001,"rating":2,"duration":110,"genre":"Comedy","image":"http://loremflickr.com/640/480/business","description":"Fuga quod culpa qui. Provident voluptatum qui eum omnis.","cast":["Phil Casper","Sergio Pfeffer","Yvonne"]}
{"title":"iure","year":1985,"rating":5,"duration":134,"genre":"Drama","image":"http://loremflickr.com/640/480/abstract","description":"Quia incidunt ipsum maiores. Libero similique assumenda deserunt aliquam harum iure nemo fuga consequatur.","cast":["Kristin Hintz","Dr. Danielle Batz","Mavis"]}
{"title":"aliquam","year":1989,"rating":1,"duration":113,"genre":"Comedy","image":"http://loremflickr.com/640/480/people","description":"Et omnis ipsam placeat est harum adipisci. Illum et consequatur.","cast":["Gerardo MacGyver","Miss Lester Brakus","Retha"]}

feku examples/people.js --count=5 --array produces an array of five person objects

[
  {
    "name": "Lindsay Swaniawski",
    "age": 85
  },
  {
    "name": "Mattie Romaguera",
    "age": 37
  },
  {
    "name": "Tabitha Harber",
    "age": 99
  },
  {
    "name": "Virginia Schinner",
    "age": 69
  },
  {
    "name": "Kara Kihn",
    "age": 47
  }
]

We can pass in extra args like start and end date.

feku examples/account.js --count 5 --startDate 2022-04-01 --endDate 2022-04-30


{"date":"2022-04-01","desc":"laudantium quae","amt":-8,"bal":1241}
{"date":"2022-04-02","desc":"dolorum eligendi omnis officiis qui","amt":22,"bal":1263}
{"date":"2022-04-05","desc":"rem qui incidunt et","amt":-61,"bal":1202}
{"date":"2022-04-08","desc":"libero porro","amt":-32,"bal":1170}
{"date":"2022-04-20","desc":"aut id","amt":-20,"bal":1150}

Writing a spec file

At minimum, the spec file needs to export a default function (you can give it whatever name the suits it purpose, see examples)

export default function rowBuilder({faker}) {
    return {
        name: faker.name.findName()
    }
}

we can export initialContext, that is passed to the rowBuilder as well which can be used to control seed data. These attributes can be overridden from the CLI as well.

export const initialContext = {
    count: 30
}

Built on libraries

Other libraries worth checking out: