UNPKG

@noeldemartin/faker

Version:

Generate massive amounts of fake contextual data

4 lines (3 loc) 1.53 kB
"use strict";var i=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(a,e)=>{for(var t in e)i(a,t,{get:e[t],enumerable:!0})},k=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!m.call(a,r)&&r!==t&&i(a,r,{get:()=>e[r],enumerable:!(n=h(e,r))||n.enumerable});return a};var l=a=>k(i({},"__esModule",{value:!0}),a);var p={};f(p,{GitModule:()=>s});module.exports=l(p);class s{constructor(e){this.faker=e;for(const t of Object.getOwnPropertyNames(s.prototype))t==="constructor"||typeof this[t]!="function"||(this[t]=this[t].bind(this))}branch(){const e=this.faker.hacker.noun().replace(" ","-"),t=this.faker.hacker.verb().replace(" ","-");return`${e}-${t}`}commitEntry(e={}){const{merge:t=this.faker.datatype.number({min:0,max:4})===0,eol:n="CRLF"}=e,r=[`commit ${this.faker.git.commitSha()}`];t&&r.push(`Merge: ${this.shortSha()} ${this.shortSha()}`),r.push(`Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>`,`Date: ${this.faker.date.recent().toString()}`,"",`\xA0\xA0\xA0\xA0${this.commitMessage()}`,"");const o=n==="CRLF"?`\r `:` `;return r.join(o)}commitMessage(){return`${this.faker.hacker.verb()} ${this.faker.hacker.adjective()} ${this.faker.hacker.noun()}`}commitSha(){return this.faker.datatype.hexadecimal({length:40,case:"lower",prefix:""})}shortSha(){return this.faker.datatype.hexadecimal({length:7,case:"lower",prefix:""})}}0&&(module.exports={GitModule});