UNPKG

@noeldemartin/faker

Version:

Generate massive amounts of fake contextual data

2 lines (1 loc) 1.15 kB
"use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var m=(p,r)=>{for(var e in r)s(p,e,{get:r[e],enumerable:!0})},b=(p,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!u.call(p,n)&&n!==e&&s(p,n,{get:()=>r[n],enumerable:!(t=g(r,n))||t.enumerable});return p};var U=p=>b(s({},"__esModule",{value:!0}),p);var $={};m($,{Placeholder:()=>a});module.exports=U($);class a{constructor(r){this.faker=r;for(const e of Object.getOwnPropertyNames(a.prototype))e==="constructor"||typeof this[e]!="function"||(this[e]=this[e].bind(this))}imageUrl(r,e,t,n,o,l){r=r||640,e=e||r;let i="https://via.placeholder.com";if(i+=`/${r}x${e}`,o!=null&&(i+=`/${o.replace("#","").toUpperCase()}`,l!=null&&(i+=`/${l.replace("#","").toUpperCase()}`)),n!=null&&(i+=`.${n}`),t!=null){const c=new URLSearchParams({text:t});i+=`?${c.toString()}`}return i}randomUrl(r,e,t){return this.imageUrl(r,e,this.faker.lorem.word(),t,this.faker.color.rgb({casing:"upper",prefix:""}),this.faker.color.rgb({casing:"upper",prefix:""}))}}0&&(module.exports={Placeholder});