t0n 0.1.5 → 0.1.6
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.
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,8 +75,7 @@ type EnumStatic<T> = {
|
|
|
75
75
|
declare function Enum<T extends string[] | Record<string, string | number>>(definition: T): EnumStatic<T>;
|
|
76
76
|
|
|
77
77
|
declare class Envir {
|
|
78
|
-
private
|
|
79
|
-
private static memory;
|
|
78
|
+
#private;
|
|
80
79
|
static has(key: string): boolean;
|
|
81
80
|
static get<T = any>(key: string, defaultValue?: T): T | undefined;
|
|
82
81
|
static set<T = any>(key: string, value: T): void;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var c=class r{static{this.UNDEFINED=Symbol("UNDEFINED");}static resolve(t,e){let s=r.UNDEFINED;try{s=t();}catch{}return new r(s,e)}static defined(t){return !this.undefined(t)&&!this.isUnset(t)}static undefined(t){return t===r.UNDEFINED||this.isUnset(t)}static isUnset(t){return t==null}constructor(t,e){this.value=t,this._default=e;}or(t){return r.defined(this.value)?this:r.resolve(t,this._default)}default(t){return this._default=t,this}tap(t){let e=this.get();return t?.(e),this}get(){return r.undefined(this.value)?this._default:this.value}getOrThrow(t){let e=this.get();if(r.undefined(e))throw t??new Error("Value is null or undefined");return e}};var u=class{static encode(t){let e=typeof t;return t=this.toString(t,e),(t?.byteLength||t.length)<1?"":Buffer.from(t).toString("base64")}static decode(t){if(typeof t!="string")throw new TypeError("Expected input to be a string");if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw new Error("Invalid Base64 string");try{return Buffer.from(t,"base64").toString("utf8")}catch{throw new Error("Invalid base64 characters")}}static toString(t,e){return e??=typeof t,Buffer.isBuffer(t)||e==="string"?t:Array.isArray(t)||["function","symbol"].includes(e)?t.toString():t===null||["number","bigint","boolean","undefined"].includes(e)?String(t):e==="object"&&!(t instanceof Uint8Array)&&!(t instanceof ArrayBuffer)?JSON.stringify(t):t}},l=class{static encode(t){return u.encode(t)?.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")||""}static decode(t){let e=t.length%4;return e&&(t+="=".repeat(4-e)),u.decode(t.replace(/-/g,"+").replace(/_/g,"/"))}};var a=class{constructor(t={}){this.data={};this.data={...t};}all(){return {...this.data}}has(t){return t in this.data}add(t={}){this.data={...this.data,...t};}replace(t={}){this.data={...t};}get(t,e){return this.has(t)?this.data[t]:e}set(t,e){if(this.has(t)&&typeof e!=typeof this.data[t])throw new TypeError(`Type mismatch for key ${t}. Expected ${typeof this.data[t]}, got ${typeof e}`);this.data[t]=e;}remove(t){delete this.data[t];}clear(){this.data={};}get length(){return this.keys().length}get size(){return this.length}keys(){return Object.keys(this.data)}values(){return Object.values(this.data)}toArray(){return Object.entries(this.data)}jsonSerialize(){return this.all()}toJson(t=0){return JSON.stringify(this.all(),null,t)}[Symbol.iterator](){return Object.entries(this.data)[Symbol.iterator]()}};function m(r){let t=Array.isArray(r)?Object.fromEntries(r.map(n=>[n,n])):r,e=new Map,s=new Map;Object.entries(t).forEach(([n,i])=>{e.set(n,i),s.set(String(i),n),typeof i=="number"&&s.set(i.toString(),n);});let o=class{static has(n){return e.has(n)||s.has(String(n))}static key(n){return e.has(n)?n:s.get(String(n))||null}static value(n){return e.has(n)?e.get(n):s.has(String(n))?e.get(s.get(String(n))):null}static get keys(){return Object.keys(t)}static get values(){return Object.values(t)}static toObject(){return {...t}}};return Object.entries(t).forEach(([n,i])=>{o[n]=i;}),o}var g=class{static#t;static{this.#t=new a;}static has(t){try{return this.#t.has(t)||t in process.env}catch{return false}}static get(t,e){if(this.#t.has(t))return this.#t.get(t,e);try{let s=process?.env[t];return s!==void 0?s:e}catch{return e}}static set(t,e){this.#t.set(t,e);}static remove(t){this.#t.remove(t);}static add(t={}){this.#t.add(t);}static replace(t={}){this.#t.replace(t);}};function v(r,t){switch(t||(t=typeof r),t){case "string":return r.length;case "number":case "bigint":return r.toString().length;case "object":return r===null?0:Array.isArray(r)?r.length:Object.keys(r).length;case "undefined":default:return 0}}var b=class r{static timestamp(t=null){return t==null?0:typeof t=="number"?t:t instanceof Date?Math.floor(t.getTime()/1e3):0}static minuteToSecond(t=null){return r.timestamp(t)||Math.floor(Date.now()/1e3)}static strToDate(t){return new Date(t)}static now(){return Math.floor(Date.now()/1e3)}static addSeconds(t,e){return t+e}static addMinutes(t,e){return t+e*60}static addHours(t,e){return t+e*3600}static addDays(t,e){return t+e*86400}};function w(r){if(typeof r=="number"&&Number.isInteger(r))return r;let e=JSON.stringify(r).replace(/\D/g,"");return e?parseInt(e.slice(0,16),10):0}
|
|
2
|
+
export{c as Attempt,u as Base64,a as DataBag,m as Enum,g as Envir,b as Timestamp,l as UrlSafeBase64,v as getLength,w as toInt};
|