@citruslime/utils 2.0.5-beta.0 → 2.0.6-beta.0

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.
@@ -2,7 +2,7 @@ function g(t, ...n) {
2
2
  let e = 0;
3
3
  return t.replace(/{\d+}/g, () => typeof n[e] < "u" ? n[e++] : "");
4
4
  }
5
- function f(t, n, e = "cl-bg-primary-light cl-font-bold cl-px-0.5") {
5
+ function f(t, n, e = "cl:bg-primary-light cl:font-bold") {
6
6
  const o = n.map((r) => `(${p(r)})`).join("|");
7
7
  return t.replace(
8
8
  new RegExp(o, "ig"),
@@ -67,13 +67,13 @@ function m(t, n) {
67
67
  let o;
68
68
  for (let r = 1; r <= n.length; r++) {
69
69
  let i = r;
70
- const c = n[r - 1];
70
+ const h = n[r - 1];
71
71
  for (let l = 1; l <= t.length; l++) {
72
- if (c === t[l - 1])
72
+ if (h === t[l - 1])
73
73
  o = e[l - 1];
74
74
  else {
75
- const h = i + 1, u = e[l] + 1, a = h - (h - u & u - h >> 7), s = e[l - 1] + 1;
76
- o = a - (a - s & s - a >> 7);
75
+ const a = i + 1, u = e[l] + 1, c = a - (a - u & u - a >> 7), s = e[l - 1] + 1;
76
+ o = c - (c - s & s - c >> 7);
77
77
  }
78
78
  e[l - 1] = i, i = o;
79
79
  }
@@ -96,8 +96,8 @@ function C(t, n, e) {
96
96
  }
97
97
  function v(t, n) {
98
98
  let e = "";
99
- const o = decodeURIComponent(t), r = "[\\?&]" + n + "=([^&#]*)", c = new RegExp(r).exec(o);
100
- return c && c[1] && (e = decodeURIComponent(c[1].replace(/\+/g, " "))), e;
99
+ const o = decodeURIComponent(t), r = "[\\?&]" + n + "=([^&#]*)", h = new RegExp(r).exec(o);
100
+ return h && h[1] && (e = decodeURIComponent(h[1].replace(/\+/g, " "))), e;
101
101
  }
102
102
  function w(t, n) {
103
103
  const e = Object.keys(t).find((o) => o.toLowerCase() === n.toLowerCase());
@@ -1 +1 @@
1
- (function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i.CitrusLimeUtils={}))})(this,function(i){"use strict";function c(e,...n){let t=0;return e.replace(/{\d+}/g,()=>typeof n[t]<"u"?n[t++]:"")}function f(e,n,t="cl-bg-primary-light cl-font-bold cl-px-0.5"){const o=n.map(r=>`(${g(r)})`).join("|");return e.replace(new RegExp(o,"ig"),r=>`<span class="${t}">${r}</span>`)}function g(e){return e.replace(/[-[\]{}()*+?.,\\/^$|]/g,"\\$&")}String.prototype.similarity=function(e){let n=0,t=this.toLowerCase(),o=e.toLowerCase();if(t<o){const l=o;o=t,t=l}const r=t.length;return r===0?n=100:n=Math.round((r-d(t,o))/r*100),n},String.prototype.trimChar=function(e){return this.trimStartChar(e).trimEndChar(e)},String.prototype.trimStartChar=function(e){return e!==""&&this.startsWith(e)?this.slice(1):this},String.prototype.trimEndChar=function(e){return e!==""&&this.endsWith(e)?this.slice(0,-1):this},String.prototype.trimToLength=function(e,n=!1){const t=this.length<e?this.length:e;return n&&t>=4&&t<this.length?`${this.slice(0,Math.max(t-3,1))}...`:this.slice(0,Math.max(t,1))},String.prototype.removeWhitespace=function(){return this.replace(/\s/g,"")},String.prototype.removeNonAlphanumeric=function(){return this.replace(/[^a-zA-Z0-9]/g,"")},String.prototype.removeNonAlphabetic=function(){return this.replace(/[^a-zA-Z]/g,"")},String.prototype.removeNonNumeric=function(){return this.replace(/[^0-9]/g,"")},String.prototype.replacePlaceholders=function(...e){return c(this,...e)},String.prototype.toDateFromTime=function(){return new Date(`${new Date().toISOString().substr(0,11)}${this}`)};function d(e,n){if(e.length===0)return n.length;if(n.length===0)return e.length;if(e.length>n.length){const r=e;e=n,n=r}const t=new Int8Array(e.length+1);for(let r=0;r<=e.length;r++)t[r]=r;let o;for(let r=1;r<=n.length;r++){let l=r;const h=n[r-1];for(let a=1;a<=e.length;a++){if(h===e[a-1])o=t[a-1];else{const u=l+1,p=t[a]+1,s=u-(u-p&p-u>>7),m=t[a-1]+1;o=s-(s-m&m-s>>7)}t[a-1]=l,l=o}t[e.length]=l}return t[e.length]}function*y(e,n){for(let t=0;t<e.length;t+=n)yield e.slice(t,t+n)}function v(){return Math.random().toString(36).slice(2,8)}function C(e){return e}function T(e,n,t){return e[t]<n[t]?-1:e[t]>n[t]?1:0}function P(e,n){let t="";const o=decodeURIComponent(e),r="[\\?&]"+n+"=([^&#]*)",h=new RegExp(r).exec(o);return h&&h[1]&&(t=decodeURIComponent(h[1].replace(/\+/g," "))),t}function x(e,n){const t=Object.keys(e).find(o=>o.toLowerCase()===n.toLowerCase());return t?e[t]:null}function w(e){return!!e&&/^[^@]+@[^@]+\.[^@]+$/.exec(e)!==null}function S(){return navigator&&"maxTouchPoints"in navigator&&navigator.maxTouchPoints>0}i.chunk=y,i.compareByProperty=T,i.escapeStringForRegExp=g,i.generateStringId=v,i.getCaseInsensitiveQueryParam=x,i.getParamsByName=P,i.highlightText=f,i.isTouchDevice=S,i.nameOf=C,i.replacePlaceholders=c,i.validateEmail=w,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i.CitrusLimeUtils={}))})(this,function(i){"use strict";function c(e,...n){let t=0;return e.replace(/{\d+}/g,()=>typeof n[t]<"u"?n[t++]:"")}function f(e,n,t="cl:bg-primary-light cl:font-bold"){const o=n.map(r=>`(${g(r)})`).join("|");return e.replace(new RegExp(o,"ig"),r=>`<span class="${t}">${r}</span>`)}function g(e){return e.replace(/[-[\]{}()*+?.,\\/^$|]/g,"\\$&")}String.prototype.similarity=function(e){let n=0,t=this.toLowerCase(),o=e.toLowerCase();if(t<o){const l=o;o=t,t=l}const r=t.length;return r===0?n=100:n=Math.round((r-d(t,o))/r*100),n},String.prototype.trimChar=function(e){return this.trimStartChar(e).trimEndChar(e)},String.prototype.trimStartChar=function(e){return e!==""&&this.startsWith(e)?this.slice(1):this},String.prototype.trimEndChar=function(e){return e!==""&&this.endsWith(e)?this.slice(0,-1):this},String.prototype.trimToLength=function(e,n=!1){const t=this.length<e?this.length:e;return n&&t>=4&&t<this.length?`${this.slice(0,Math.max(t-3,1))}...`:this.slice(0,Math.max(t,1))},String.prototype.removeWhitespace=function(){return this.replace(/\s/g,"")},String.prototype.removeNonAlphanumeric=function(){return this.replace(/[^a-zA-Z0-9]/g,"")},String.prototype.removeNonAlphabetic=function(){return this.replace(/[^a-zA-Z]/g,"")},String.prototype.removeNonNumeric=function(){return this.replace(/[^0-9]/g,"")},String.prototype.replacePlaceholders=function(...e){return c(this,...e)},String.prototype.toDateFromTime=function(){return new Date(`${new Date().toISOString().substr(0,11)}${this}`)};function d(e,n){if(e.length===0)return n.length;if(n.length===0)return e.length;if(e.length>n.length){const r=e;e=n,n=r}const t=new Int8Array(e.length+1);for(let r=0;r<=e.length;r++)t[r]=r;let o;for(let r=1;r<=n.length;r++){let l=r;const h=n[r-1];for(let a=1;a<=e.length;a++){if(h===e[a-1])o=t[a-1];else{const u=l+1,p=t[a]+1,s=u-(u-p&p-u>>7),m=t[a-1]+1;o=s-(s-m&m-s>>7)}t[a-1]=l,l=o}t[e.length]=l}return t[e.length]}function*y(e,n){for(let t=0;t<e.length;t+=n)yield e.slice(t,t+n)}function v(){return Math.random().toString(36).slice(2,8)}function C(e){return e}function T(e,n,t){return e[t]<n[t]?-1:e[t]>n[t]?1:0}function P(e,n){let t="";const o=decodeURIComponent(e),r="[\\?&]"+n+"=([^&#]*)",h=new RegExp(r).exec(o);return h&&h[1]&&(t=decodeURIComponent(h[1].replace(/\+/g," "))),t}function w(e,n){const t=Object.keys(e).find(o=>o.toLowerCase()===n.toLowerCase());return t?e[t]:null}function x(e){return!!e&&/^[^@]+@[^@]+\.[^@]+$/.exec(e)!==null}function S(){return navigator&&"maxTouchPoints"in navigator&&navigator.maxTouchPoints>0}i.chunk=y,i.compareByProperty=T,i.escapeStringForRegExp=g,i.generateStringId=v,i.getCaseInsensitiveQueryParam=w,i.getParamsByName=P,i.highlightText=f,i.isTouchDevice=S,i.nameOf=C,i.replacePlaceholders=c,i.validateEmail=x,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citruslime/utils",
3
- "version": "2.0.5-beta.0",
3
+ "version": "2.0.6-beta.0",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Citrus-Lime Ltd",