UNPKG

@noeldemartin/faker

Version:

Generate massive amounts of fake contextual data

2 lines (1 loc) 1.76 kB
"use strict";var i=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of o(e))!p.call(t,a)&&a!==r&&i(t,a,{get:()=>e[a],enumerable:!(s=h(e,a))||s.enumerable});return t};var u=t=>c(i({},"__esModule",{value:!0}),t);var m={};f(m,{VehicleModule:()=>n});module.exports=u(m);class n{constructor(e){this.faker=e;for(const r of Object.getOwnPropertyNames(n.prototype))r==="constructor"||typeof this[r]!="function"||(this[r]=this[r].bind(this))}vehicle(){return`${this.manufacturer()} ${this.model()}`}manufacturer(){return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.manufacturer)}model(){return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.model)}type(){return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.type)}fuel(){return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.fuel)}vin(){const e=["o","i","q","O","I","Q"];return`${this.faker.random.alphaNumeric(10,{casing:"upper",bannedChars:e})}${this.faker.random.alpha({count:1,casing:"upper",bannedChars:e})}${this.faker.random.alphaNumeric(1,{casing:"upper",bannedChars:e})}${this.faker.datatype.number({min:1e4,max:99999})}`.toUpperCase()}color(){return this.faker.color.human()}vrm(){return`${this.faker.random.alpha({count:2,casing:"upper"})}${this.faker.datatype.number({min:0,max:9})}${this.faker.datatype.number({min:0,max:9})}${this.faker.random.alpha({count:3,casing:"upper"})}`.toUpperCase()}bicycle(){return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.bicycle_type)}}0&&(module.exports={VehicleModule});