You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes I've thought about this! I'd like to do something using regex syntax so users can define an alphanumeric pattern, eg: [A-Z]{2}[0-9]{3}[A-Z]{2} but I need to set aside some time to investigate it.
In the meantime I've thrown together a customer helper you can use that'll generate a completely random pattern of characters:
const customHelpers = {
alphanumeric(count) {
let string = '';
for (let i = 0; i < count; i++) {
string += dummyjson.utils.random() > 0.5
? dummyjson.utils.randomChar()
: dummyjson.utils.randomInt(0, 9)
}
return string;
}
}
const template = `{{alphanumeric 10}}`
const result = dummyjson.parse(template, { helpers: customHelpers });
Hello,
Will there be an alphanumeric field in the future?
{{ alphanumeric 10 }}
KLK893KLE0
The text was updated successfully, but these errors were encountered: