rap2hpoutre / pg-anonymizer

Dump anonymized PostgreSQL database with a NodeJS CLI
https://raph.site
MIT License
228 stars 32 forks source link

How to put parameters to faker functions? #57

Open Studenich opened 9 months ago

Studenich commented 9 months ago

Trying to send parameter to zipCode function but it can't handle this

Error: faker.address.zipCode('#####') is not a function

JargeZ commented 7 months ago
# path may vary depends on your base docker image
const faker = require('/usr/local/lib/node_modules/pg-anonymizer/node_modules/faker');

module.exports = {
  generateCity: (val) => {
    # use faker whatever you want
    let city = faker.address.city();
    return city.substring(0, 15);
  }
};