Skip to content

string manipulation in pattern #2262

Closed Answered by ahaberbosch
ahaberbosch asked this question in Q&A
Discussion options

You must be logged in to vote

I created a new class that extends Faker class

import { Faker, en, base, en_US } from '@faker-js/faker'


class FilteredFaker extends Faker {
    constructor() {
        super({
            locale: [en_US, en, base],
        })
        this.rawDefinitions.person.last_name = this.rawDefinitions.person.last_name.filter(l => !l.includes(`'`))
    }
}

export const faker = new FilteredFaker()

It seems to work, please let me know if this has particular shortcomings

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ahaberbosch
Comment options

@matthewmayer
Comment options

@ST-DDT
Comment options

@ahaberbosch
Comment options

Answer selected by Shinigami92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants