ez-common-ts/lib/index.umd.js
2023-11-14 16:17:22 +08:00

3 lines
2.1 KiB
JavaScript

(function(r,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(r=typeof globalThis<"u"?globalThis:r||self,o(r["ez-common-ts"]={}))})(this,function(r){"use strict";var o=(e=>(e[e.delete=2]="delete",e[e.reset=1]="reset",e))(o||{});const m=e=>({clear:function(n=2){n===1?Object.keys(e).forEach(i=>{e[i]=void 0}):n===2&&Object.keys(e).forEach(i=>{delete e[i]})},replace:function(n){this.clear(2),Object.assign(e,n)}});function x(...e){let n=e??[];return{test:function(i){if(n.length<=1)return n.length===1?n[0]:[];let u=i??function(t,s){return t===s};return n.reduce((t,s)=>(s&&s.length>0&&(t.length===0?t.push(...s):s.forEach(f=>{t.some(l=>u(l,f))||t.push(f)})),t),[])},path:function(...i){return this.test((u,t)=>i.every(s=>u[s]===t[s]))}}}function I(e,n,i){const u=n,t=i||n;return function(s){const f=[],c=s.matchAll(e);let l=0;for(const g of c){const h=s.slice(l,g.index);h&&f.push(t(h,!1)),f.push(u(g[0],!0)),l=g.index+g[0].length}return l<s.length&&f.push(t(s.slice(l),!1)),f}}function a(e,n){return typeof e=="string"&&typeof n=="string"?e.toLowerCase()===n.toLowerCase():e===void 0&&n===void 0}const y=(e,n)=>{for(let i=0;i<e.length;i++){let u=e[i];if(a(u,n))return!0}return!1};function O(e){const n=e.lastIndexOf(".");return n===-1?"":e.substring(n+1)}function d(e){let n=e.lastIndexOf("/");return n===-1&&(n=e.lastIndexOf("\\"),n===-1)?e:e.substring(n+1)}function b(e){const n=d(e),i=n.lastIndexOf(".");return i===-1?n:n.substring(0,i)}function E(e,n="win32"){const i=n==="win32"?"\\":"/";let u,t,s,f;const c=e.lastIndexOf(i);c===-1?(u="",t=e):(u=e.substring(0,c+1),t=e.substring(c+1));const l=t.lastIndexOf(".");return l===-1?(s="",f=t):(s=t.substring(l+1),f=t.substring(0,l)),{fileName:t,fileNameNoExt:f,fileExtName:s,fullPath:e,pathOnly:u}}r.RecordClearMode=o,r.assignRecords=x,r.equalsIgnoreCase=a,r.getFileExt=O,r.getFileInfo=E,r.getFileName=d,r.getFileNameWithoutExt=b,r.includeIgnoreCase=y,r.stringTokenizer=I,r.withRecord=m,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=index.umd.js.map