rap2hpoutre / pg-anonymizer

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

How to put parameters to faker functions? #57

Open Studenich opened 5 months ago

Studenich commented 5 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 3 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);
  }
};