@stacksjs/faker 0.72.56 → 0.72.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{faker as z}from"@stacksjs/ts-faker";var T={boolean(q){let B=typeof q==="number"?q:q?.probability;return z.random.boolean(B)},number(q){return z.number.int({min:q?.min??0,max:q?.max??100})},float(q){return z.number.float({min:q?.min??0,max:q?.max??1,precision:q?.precision??2})},uuid(){return z.string.uuid()},string(q){return z.string.alphanumeric({length:q??10})},array(q,B){let G=[],H=B??z.number.int({min:1,max:10});for(let J=0;J<H;J++)G.push(q());return G}},K=Object.create(z.number);K.int=(q)=>{return z.number.int(typeof q==="number"?{max:q}:q)};K.float=(q)=>{if(!q)return z.number.float();let{fractionDigits:B,...G}=q;return z.number.float({...G,precision:G.precision??B})};var M=Object.create(z.string);M.alpha=(q)=>{return z.string.alpha(typeof q==="number"?{length:q}:q)};M.alphanumeric=(q)=>{return z.string.alphanumeric(typeof q==="number"?{length:q}:q)};var O=Object.create(z.finance);O.creditCardNumber=(q)=>{if(typeof q!=="string")return z.finance.creditCardNumber(q);return q.replace(/#/g,()=>z.string.numeric(1))};var Q=Object.create(z.image);Q.url=(q)=>{let B=q?.width??640,G=q?.height??480;return`https://picsum.photos/seed/${z.string.alphanumeric({length:12}).toLowerCase()}/${B}/${G}`};var U={street(){return z.address.street()},streetAddress(q){return z.address.streetAddress({useFullAddress:q})},city(){return z.address.city()},state(){return z.address.state()},stateAbbr(){return z.address.stateAbbr()},country(){return z.address.country()},countryCode(){return z.address.countryCode()},zipCode(){return z.address.zipCode()},latitude(q){return z.address.latitude(q)},longitude(q){return z.address.longitude(q)},direction(){return z.address.direction()},buildingNumber(){return z.address.buildingNumber()}},V={...z.company,name(){return z.company.name()},catchPhrase(){let q=z.company;return q.buzzPhrase?.()??q.catchphrase?.()??`${z.word.adjective()} ${z.word.noun()}`},buzzPhrase(){return z.company.buzzPhrase?.()??z.lorem.sentence(3)}},X={...z.vehicle,vrm(){return`${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"0123456789"[Math.floor(Math.random()*10)]}${"0123456789"[Math.floor(Math.random()*10)]} ${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}`},vehicle(){let q=["Toyota","Honda","Ford","Chevrolet","BMW","Mercedes","Audi","Tesla","Nissan","Hyundai"],B=["Sedan","SUV","Truck","Coupe","Hatchback","Wagon","Van","Crossover"];return`${q[Math.floor(Math.random()*q.length)]} ${B[Math.floor(Math.random()*B.length)]}`},type(){let q=["Sedan","SUV","Truck","Van","Coupe","Convertible","Wagon","Hatchback"];return q[Math.floor(Math.random()*q.length)]??"Sedan"},manufacturer(){let q=["Toyota","Honda","Ford","Chevrolet","BMW","Mercedes-Benz","Audi","Tesla","Nissan","Hyundai","Kia","Volkswagen"];return q[Math.floor(Math.random()*q.length)]??"Toyota"},model(){let q=["Camry","Accord","F-150","Silverado","3 Series","C-Class","A4","Model 3","Altima","Elantra"];return q[Math.floor(Math.random()*q.length)]??"Camry"},fuel(){let q=["Gasoline","Diesel","Electric","Hybrid","Plug-in Hybrid"];return q[Math.floor(Math.random()*q.length)]??"Gasoline"},vin(){let B="";for(let G=0;G<17;G++)B+="0123456789ABCDEFGHJKLMNPRSTUVWXYZ"[Math.floor(Math.random()*33)];return B},color(){let q=["Black","White","Silver","Gray","Red","Blue","Green","Brown","Orange","Yellow"];return q[Math.floor(Math.random()*q.length)]??"Black"}},R={...z.helpers,arrayElement(q){if(q.length===0)throw Error("arrayElement: cannot pick from an empty array");return q[Math.floor(Math.random()*q.length)]},arrayElements(q,B){let G=B??Math.floor(Math.random()*q.length)+1;return R.shuffle(q).slice(0,Math.min(G,q.length))},shuffle(q){let B=[...q];for(let G=B.length-1;G>0;G--){let H=Math.floor(Math.random()*(G+1)),J=B[G],S=B[H];B[G]=S,B[H]=J}return B},maybe(q,B){let G=B?.probability??0.5;return Math.random()<G?q():void 0},objectKey(q){let B=Object.keys(q);if(B.length===0)throw Error("objectKey: object has no keys");return B[Math.floor(Math.random()*B.length)]},objectValue(q){let B=Object.values(q);if(B.length===0)throw Error("objectValue: object has no values");return B[Math.floor(Math.random()*B.length)]},slugify(q){return q.normalize("NFKD").replace(/[\u0300-\u036F]/g,"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}};function N(q,B=1){let G=Math.max(B,Math.floor(Math.min(q.min,q.max))),H=Math.max(G,Math.floor(Math.max(q.min,q.max)));return Math.floor(Math.random()*(H-G+1))+G}var Y={...z.lorem,word(){return z.lorem.word()},words(q){return z.lorem.words(q??3)},sentence(q){if(typeof q==="object")return z.lorem.sentence(N(q));if(q!==void 0){let B=Math.max(1,Math.floor(q)),G=Math.min(3,B),H=Math.floor(Math.random()*(B-G+1))+G;return z.lorem.sentence(H)}return z.lorem.sentence()},sentences(q,B){return z.lorem.sentences(q??3,B??" ")},paragraph(q){return z.lorem.paragraph(q)},paragraphs(q,B){let G=typeof q==="object"?N(q):q??3;return z.lorem.paragraphs(G,B??`
2
+ import{faker as r}from"@stacksjs/ts-faker";var h={boolean(e){let n=typeof e==="number"?e:e?.probability;return r.random.boolean(n)},number(e){return r.number.int({min:e?.min??0,max:e?.max??100})},float(e){return r.number.float({min:e?.min??0,max:e?.max??1,precision:e?.precision??2})},uuid(){return r.string.uuid()},string(e){return r.string.alphanumeric({length:e??10})},array(e,n){let t=[],a=n??r.number.int({min:1,max:10});for(let i=0;i<a;i++)t.push(e());return t}},o=Object.create(r.number);o.int=(e)=>r.number.int(typeof e==="number"?{max:e}:e);o.float=(e)=>{if(!e)return r.number.float();let{fractionDigits:n,...t}=e;return r.number.float({...t,precision:t.precision??n})};var s=Object.create(r.string);s.alpha=(e)=>r.string.alpha(typeof e==="number"?{length:e}:e);s.alphanumeric=(e)=>r.string.alphanumeric(typeof e==="number"?{length:e}:e);var u=Object.create(r.finance);u.creditCardNumber=(e)=>{if(typeof e!=="string")return r.finance.creditCardNumber(e);return e.replace(/#/g,()=>r.string.numeric(1))};var l=Object.create(r.image);l.url=(e)=>{let n=e?.width??640,t=e?.height??480;return`https://picsum.photos/seed/${r.string.alphanumeric({length:12}).toLowerCase()}/${n}/${t}`};var g={street(){return r.address.street()},streetAddress(e){return r.address.streetAddress({useFullAddress:e})},city(){return r.address.city()},state(){return r.address.state()},stateAbbr(){return r.address.stateAbbr()},country(){return r.address.country()},countryCode(){return r.address.countryCode()},zipCode(){return r.address.zipCode()},latitude(e){return r.address.latitude(e)},longitude(e){return r.address.longitude(e)},direction(){return r.address.direction()},buildingNumber(){return r.address.buildingNumber()}},p={...r.company,name(){return r.company.name()},catchPhrase(){let e=r.company;return e.buzzPhrase?.()??e.catchphrase?.()??`${r.word.adjective()} ${r.word.noun()}`},buzzPhrase(){return r.company.buzzPhrase?.()??r.lorem.sentence(3)}},d={...r.vehicle,vrm(){return`${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"0123456789"[Math.floor(Math.random()*10)]}${"0123456789"[Math.floor(Math.random()*10)]} ${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}${"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(Math.random()*26)]}`},vehicle(){let e=["Toyota","Honda","Ford","Chevrolet","BMW","Mercedes","Audi","Tesla","Nissan","Hyundai"],n=["Sedan","SUV","Truck","Coupe","Hatchback","Wagon","Van","Crossover"];return`${e[Math.floor(Math.random()*e.length)]} ${n[Math.floor(Math.random()*n.length)]}`},type(){let e=["Sedan","SUV","Truck","Van","Coupe","Convertible","Wagon","Hatchback"];return e[Math.floor(Math.random()*e.length)]??"Sedan"},manufacturer(){let e=["Toyota","Honda","Ford","Chevrolet","BMW","Mercedes-Benz","Audi","Tesla","Nissan","Hyundai","Kia","Volkswagen"];return e[Math.floor(Math.random()*e.length)]??"Toyota"},model(){let e=["Camry","Accord","F-150","Silverado","3 Series","C-Class","A4","Model 3","Altima","Elantra"];return e[Math.floor(Math.random()*e.length)]??"Camry"},fuel(){let e=["Gasoline","Diesel","Electric","Hybrid","Plug-in Hybrid"];return e[Math.floor(Math.random()*e.length)]??"Gasoline"},vin(){let n="";for(let t=0;t<17;t++)n+="0123456789ABCDEFGHJKLMNPRSTUVWXYZ"[Math.floor(Math.random()*33)];return n},color(){let e=["Black","White","Silver","Gray","Red","Blue","Green","Brown","Orange","Yellow"];return e[Math.floor(Math.random()*e.length)]??"Black"}},c={...r.helpers,arrayElement(e){if(e.length===0)throw Error("arrayElement: cannot pick from an empty array");return e[Math.floor(Math.random()*e.length)]},arrayElements(e,n){let t=n??Math.floor(Math.random()*e.length)+1;return c.shuffle(e).slice(0,Math.min(t,e.length))},shuffle(e){let n=[...e];for(let t=n.length-1;t>0;t--){let a=Math.floor(Math.random()*(t+1)),i=n[t],b=n[a];n[t]=b,n[a]=i}return n},maybe(e,n){let t=n?.probability??0.5;return Math.random()<t?e():void 0},objectKey(e){let n=Object.keys(e);if(n.length===0)throw Error("objectKey: object has no keys");return n[Math.floor(Math.random()*n.length)]},objectValue(e){let n=Object.values(e);if(n.length===0)throw Error("objectValue: object has no values");return n[Math.floor(Math.random()*n.length)]},slugify(e){return e.normalize("NFKD").replace(/[\u0300-\u036F]/g,"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}};function m(e,n=1){let t=Math.max(n,Math.floor(Math.min(e.min,e.max))),a=Math.max(t,Math.floor(Math.max(e.min,e.max)));return Math.floor(Math.random()*(a-t+1))+t}var y={...r.lorem,word(){return r.lorem.word()},words(e){return r.lorem.words(e??3)},sentence(e){if(typeof e==="object")return r.lorem.sentence(m(e));if(e!==void 0){let n=Math.max(1,Math.floor(e)),t=Math.min(3,n),a=Math.floor(Math.random()*(n-t+1))+t;return r.lorem.sentence(a)}return r.lorem.sentence()},sentences(e,n){return r.lorem.sentences(e??3,n??" ")},paragraph(e){return r.lorem.paragraph(e)},paragraphs(e,n){let t=typeof e==="object"?m(e):e??3;return r.lorem.paragraphs(t,n??`
3
3
 
4
- `)},text(q){return z.lorem.text(q)},slug(q){return z.lorem.slug(q??3)},lines(q){return z.lorem.lines(q??3)}},_={...z,lorem:Y,datatype:T,image:Q,location:U,company:V,vehicle:X,helpers:R,number:K,string:M,finance:O};export{_ as faker};
4
+ `)},text(e){return r.lorem.text(e)},slug(e){return r.lorem.slug(e??3)},lines(e){return r.lorem.lines(e??3)}},M={...r,lorem:y,datatype:h,image:l,location:g,company:p,vehicle:d,helpers:c,number:o,string:s,finance:u};export{M as faker};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/faker",
3
3
  "type": "module",
4
- "version": "0.72.56",
4
+ "version": "0.72.60",
5
5
  "description": "Faker functions.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,8 +58,8 @@
58
58
  "prepublishOnly": "bun run build"
59
59
  },
60
60
  "devDependencies": {
61
- "@stacksjs/cli": "0.72.56",
62
- "@stacksjs/config": "0.72.56",
61
+ "@stacksjs/cli": "0.72.60",
62
+ "@stacksjs/config": "0.72.60",
63
63
  "better-dx": "^0.2.24",
64
64
  "@stacksjs/ts-faker": "^0.1.7"
65
65
  },