This commit is contained in:
Tutur33
2023-11-24 22:35:41 +01:00
parent 3c0b507a93
commit 7644b2a0f7
45165 changed files with 4803356 additions and 3 deletions
+1
View File
@@ -0,0 +1 @@
"use strict";var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(i,e)=>{for(var r in e)f(i,r,{get:e[r],enumerable:!0})},x=(i,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!h.call(i,t)&&t!==r&&f(i,t,{get:()=>e[t],enumerable:!(n=g(e,t))||n.enumerable});return i};var s=i=>x(f({},"__esModule",{value:!0}),i);var w={};l(w,{NumberModule:()=>d});module.exports=s(w);var u=require("../../errors/faker-error"),o=require("../../internal/bind-this-to-member-functions");class d{constructor(e){this.faker=e;(0,o.bindThisToMemberFunctions)(this)}int(e={}){typeof e=="number"&&(e={max:e});const{min:r=0,max:n=Number.MAX_SAFE_INTEGER}=e,t=Math.ceil(r),a=Math.floor(n);if(t===a)return t;if(a<t)throw n>=r?new u.FakerError(`No integer value between ${r} and ${n} found.`):new u.FakerError(`Max ${n} should be greater than min ${r}.`);const m=this.faker._randomizer.next();return Math.floor(m*(a+1-t)+t)}float(e={}){typeof e=="number"&&(e={max:e});const{min:r=0,max:n=1,precision:t}=e;if(n===r)return r;if(n<r)throw new u.FakerError(`Max ${n} should be greater than min ${r}.`);if(t!==void 0){if(t<=0)throw new u.FakerError("Precision should be greater than 0.");const m=1/t;return this.int({min:r*m,max:n*m})/m}return this.faker._randomizer.next()*(n-r)+r}binary(e={}){typeof e=="number"&&(e={max:e});const{min:r=0,max:n=1}=e;return this.int({max:n,min:r}).toString(2)}octal(e={}){typeof e=="number"&&(e={max:e});const{min:r=0,max:n=7}=e;return this.int({max:n,min:r}).toString(8)}hex(e={}){typeof e=="number"&&(e={max:e});const{min:r=0,max:n=15}=e;return this.int({max:n,min:r}).toString(16)}bigInt(e={}){var b,m;(typeof e=="bigint"||typeof e=="number"||typeof e=="string"||typeof e=="boolean")&&(e={max:e});const r=BigInt((b=e.min)!=null?b:0),n=BigInt((m=e.max)!=null?m:r+BigInt(999999999999999));if(n===r)return r;if(n<r)throw new u.FakerError(`Max ${n} should be larger then min ${r}.`);const t=n-r,a=BigInt(this.faker.string.numeric({length:t.toString(10).length,allowLeadingZeros:!0}))%(t+BigInt(1));return r+a}}0&&(module.exports={NumberModule});