🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

vue-string-directives

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-string-directives - npm Package Compare versions

Comparing version
1.2.1
to
1.2.2
+96
-88
dist/vue-string-directives.js
/*!
* Vue String Directives v1.2.1
* Vue String Directives v1.2.2
* Homepage (https://tarkhov.github.io/vue-string-directives/)

@@ -7,142 +7,150 @@ * Copyright 2020-2026 Tarkhov

*/
function o(e, t = !1) {
let a = e.charAt(0).toUpperCase(), u = e.slice(1);
return t && (u = u.toLowerCase()), `${a}${u}`;
function n(e, u = !1) {
if (!e) return null;
let l = e.charAt(0).toUpperCase(), t = e.slice(1);
return u && (t = t.toLowerCase()), `${l}${t}`;
}
function j(e, t = { numbers: !1, lower: !1 }) {
const a = t?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
let u = e.match(a);
if (u.length <= 1) return null;
let l = u.shift();
const n = t?.lower;
return n && (l = l.toLowerCase()), u = u.map((E) => o(E, n)), u.unshift(l), u.join("");
function j(e, u = { numbers: !1, lower: !1 }) {
if (!e) return null;
const l = u?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
let t = e.match(l);
if (!t || t.length <= 1) return null;
let a = t.shift();
const r = u?.lower;
return r && (a = a.toLowerCase()), t = t.map((E) => n(E, r)), t.unshift(a), t.join("");
}
function N(e, t = !1) {
let a = t ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu"), u = e.match(a);
return u.length <= 1 ? null : u.map((l) => l.toLowerCase()).join("");
function N(e, u = !1) {
if (!e) return null;
let l = u ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu"), t = e.match(l);
return !t || t.length <= 1 ? null : t.map((a) => a.toLowerCase()).join("");
}
function R(e, t = !1) {
let a = t ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu, u = e.match(a);
return u.length <= 1 ? null : u.map((l) => l.toLowerCase()).join("-");
function R(e, u = !1) {
if (!e) return null;
let l = u ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu, t = e.match(l);
return !t || t.length <= 1 ? null : t.map((a) => a.toLowerCase()).join("-");
}
function k(e, t, a = " ") {
const u = Math.floor((t - e.length) / 2) + e.length;
return e.padStart(u, a).padEnd(t, a);
function k(e, u, l = " ") {
if (!e) return null;
const t = Math.floor((u - e.length) / 2) + e.length;
return e.padStart(t, l).padEnd(u, l);
}
function S(e, t = { numbers: !1, lower: !1 }) {
const a = t?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
let u = e.match(a);
return u.length <= 1 ? null : u.map((l) => o(l, t?.lower)).join("");
function S(e, u = { numbers: !1, lower: !1 }) {
if (!e) return null;
const l = u?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
let t = e.match(l);
return !t || t.length <= 1 ? null : t.map((a) => n(a, u?.lower)).join("");
}
function _(e, t = !1) {
let a = t ? /[\p{L}\p{N}_]+/gu : /[\p{L}_]+/gu, u = e.match(a);
return u.length <= 1 ? null : u.map((l) => l.toLowerCase()).join("_");
function _(e, u = !1) {
if (!e) return null;
let l = u ? /[\p{L}\p{N}_]+/gu : /[\p{L}_]+/gu, t = e.match(l);
return !t || t.length <= 1 ? null : t.map((a) => a.toLowerCase()).join("_");
}
function r(e, t = !1) {
return e.replace(new RegExp("\\p{L}+", "gu"), (a) => o(a, t));
function o(e, u = !1) {
return e ? e.replace(new RegExp("\\p{L}+", "gu"), (l) => n(l, u)) : null;
}
function z(e, t = { numbers: !1, lower: !1 }) {
const a = t?.numbers ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu;
let u = e.match(a);
return u.length <= 1 ? null : u.map((l) => o(l, t?.lower)).join("-");
function z(e, u = { numbers: !1, lower: !1 }) {
if (!e) return null;
const l = u?.numbers ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu;
let t = e.match(l);
return !t || t.length <= 1 ? null : t.map((a) => n(a, u?.lower)).join("-");
}
function A(e, t = 32, a = "...") {
return e.substring(0, t) + a;
function A(e, u = 32, l = "...") {
return e ? e.substring(0, u) + l : null;
}
const s = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value || t.modifiers, u = j(e.value, a);
u !== null && (e.value = u);
const l = u.value || u.modifiers, t = j(e.value, l);
t !== null && (e.value = t);
}
}
}, c = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.modifiers?.lower || t.value?.lower;
e.value = o(e.value, a);
const l = u.modifiers?.lower || u.value?.lower;
e.value = n(e.value, l);
}
}
}, v = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.modifiers?.numbers || t.value?.numbers, u = N(e.value, a);
u !== null && (e.value = u);
const l = u.modifiers?.numbers || u.value?.numbers, t = N(e.value, l);
t !== null && (e.value = t);
}
}
}, i = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.modifiers?.numbers || t.value?.numbers, u = R(e.value, a);
u !== null && (e.value = u);
const l = u.modifiers?.numbers || u.value?.numbers, t = R(e.value, l);
t !== null && (e.value = t);
}
}
}, f = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value || t.modifiers;
e.value = a?.first ? e.value.charAt(0).toLowerCase() + e.value.slice(1) : e.value.toLowerCase();
const l = u.value || u.modifiers;
e.value = l?.first ? e.value.charAt(0).toLowerCase() + e.value.slice(1) : e.value.toLowerCase();
}
}
}, p = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value?.count || t.arg, u = t.value?.chars || t.value;
t.modifiers?.start || t.value?.start ? e.value = e.value.padStart(a, u) : t.modifiers?.end || t.value?.end ? e.value = e.value.padEnd(a, u) : e.value = k(e.value, a, u);
const l = u.value?.count || u.arg, t = u.value?.chars || u.value;
u.modifiers?.start || u.value?.start ? e.value = e.value.padStart(l, t) : u.modifiers?.end || u.value?.end ? e.value = e.value.padEnd(l, t) : e.value = k(e.value, l, t);
}
}
}, m = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value || t.modifiers, u = S(e.value, a);
u !== null && (e.value = u);
const l = u.value || u.modifiers, t = S(e.value, l);
t !== null && (e.value = t);
}
}
}, h = {
updated: function(e, u) {
e.value.length && u.value && (u.value?.string && u.value?.count ? e.value = e.value + u.value.string.repeat(u.value.count) : u.arg && (e.value = e.value + u.value.repeat(u.arg)));
}
}, d = {
updated: function(e, t) {
e.value.length && t.value && (t.value?.string && t.value?.count ? e.value = e.value + t.value.string.repeat(t.value.count) : t.arg && (e.value = e.value + t.value.repeat(t.arg)));
updated: function(e, u) {
e.value.length && (e.value = e.value.replace(new RegExp(u.value.regexp, u.value.flags), u.value.string || ""));
}
}, h = {
updated: function(e, t) {
e.value.length && (e.value = e.value.replace(new RegExp(t.value.regexp, t.value.flags), t.value.string || ""));
}
}, w = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.modifiers?.numbers || t.value?.numbers, u = _(e.value, a);
u !== null && (e.value = u);
const l = u.modifiers?.numbers || u.value?.numbers, t = _(e.value, l);
t !== null && (e.value = t);
}
}
}, g = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.modifiers?.lower || t.value?.lower, u = r(e.value, a);
u !== null && (e.value = u);
const l = u.modifiers?.lower || u.value?.lower, t = o(e.value, l);
t !== null && (e.value = t);
}
}
}, L = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value || t.modifiers, u = z(e.value, a);
u !== null && (e.value = u);
const l = u.value || u.modifiers, t = z(e.value, l);
t !== null && (e.value = t);
}
}
}, C = {
updated: function(e, t) {
let a = e.value.length;
if (a) {
let u = t.value?.omission || t.value, l = t.value?.count || t.arg;
a > l && (e.value = A(e.value, l, u));
updated: function(e, u) {
let l = e.value.length;
if (l) {
let t = u.value?.omission || u.value, a = u.value?.count || u.arg;
l > a && (e.value = A(e.value, a, t));
}
}
}, x = {
updated: function(e, t) {
updated: function(e, u) {
if (e.value.length) {
const a = t.value || t.modifiers;
if (a?.first)
if (a?.every) {
const u = r(e.value);
u !== null && (e.value = u);
const l = u.value || u.modifiers;
if (l?.first)
if (l?.every) {
const t = o(e.value);
t !== null && (e.value = t);
} else
e.value = o(e.value);
e.value = n(e.value);
else

@@ -161,4 +169,4 @@ e.value = e.value.toUpperCase();

pascal: m,
repeat: d,
replace: h,
repeat: h,
replace: d,
snake: w,

@@ -172,3 +180,3 @@ title: g,

install(e) {
e.directive("camel", s), e.directive("capitalize", c), e.directive("flat", v), e.directive("kebab", i), e.directive("lower", f), e.directive("pad", p), e.directive("pascal", m), e.directive("repeat", d), e.directive("replace", h), e.directive("snake", w), e.directive("title", g), e.directive("train", L), e.directive("truncate", C), e.directive("upper", x);
e.directive("camel", s), e.directive("capitalize", c), e.directive("flat", v), e.directive("kebab", i), e.directive("lower", f), e.directive("pad", p), e.directive("pascal", m), e.directive("repeat", h), e.directive("replace", d), e.directive("snake", w), e.directive("title", g), e.directive("train", L), e.directive("truncate", C), e.directive("upper", x);
}

@@ -186,4 +194,4 @@ };

m as pascal,
d as repeat,
h as replace,
h as repeat,
d as replace,
w as snake,

@@ -190,0 +198,0 @@ g as title,

/*!
* Vue String Directives v1.2.1
* Vue String Directives v1.2.2
* Homepage (https://tarkhov.github.io/vue-string-directives/)

@@ -7,2 +7,2 @@ * Copyright 2020-2026 Tarkhov

*/
(function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.VueStringDirectives={}))})(this,(function(l){"use strict";function o(e,t=!1){let a=e.charAt(0).toUpperCase(),u=e.slice(1);return t&&(u=u.toLowerCase()),`${a}${u}`}function E(e,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let u=e.match(a);if(u.length<=1)return null;let n=u.shift();const j=t?.lower;return j&&(n=n.toLowerCase()),u=u.map(_=>o(_,j)),u.unshift(n),u.join("")}function k(e,t=!1){let a=t?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu"),u=e.match(a);return u.length<=1?null:u.map(n=>n.toLowerCase()).join("")}function N(e,t=!1){let a=t?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu,u=e.match(a);return u.length<=1?null:u.map(n=>n.toLowerCase()).join("-")}function y(e,t,a=" "){const u=Math.floor((t-e.length)/2)+e.length;return e.padStart(u,a).padEnd(t,a)}function D(e,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let u=e.match(a);return u.length<=1?null:u.map(n=>o(n,t?.lower)).join("")}function R(e,t=!1){let a=t?/[\p{L}\p{N}_]+/gu:/[\p{L}_]+/gu,u=e.match(a);return u.length<=1?null:u.map(n=>n.toLowerCase()).join("_")}function S(e,t=!1){return e.replace(new RegExp("\\p{L}+","gu"),a=>o(a,t))}function M(e,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu;let u=e.match(a);return u.length<=1?null:u.map(n=>o(n,t?.lower)).join("-")}function z(e,t=32,a="..."){return e.substring(0,t)+a}const r={updated:function(e,t){if(e.value.length){const a=t.value||t.modifiers,u=E(e.value,a);u!==null&&(e.value=u)}}},c={updated:function(e,t){if(e.value.length){const a=t.modifiers?.lower||t.value?.lower;e.value=o(e.value,a)}}},s={updated:function(e,t){if(e.value.length){const a=t.modifiers?.numbers||t.value?.numbers,u=k(e.value,a);u!==null&&(e.value=u)}}},i={updated:function(e,t){if(e.value.length){const a=t.modifiers?.numbers||t.value?.numbers,u=N(e.value,a);u!==null&&(e.value=u)}}},v={updated:function(e,t){if(e.value.length){const a=t.value||t.modifiers;e.value=a?.first?e.value.charAt(0).toLowerCase()+e.value.slice(1):e.value.toLowerCase()}}},f={updated:function(e,t){if(e.value.length){const a=t.value?.count||t.arg,u=t.value?.chars||t.value;t.modifiers?.start||t.value?.start?e.value=e.value.padStart(a,u):t.modifiers?.end||t.value?.end?e.value=e.value.padEnd(a,u):e.value=y(e.value,a,u)}}},p={updated:function(e,t){if(e.value.length){const a=t.value||t.modifiers,u=D(e.value,a);u!==null&&(e.value=u)}}},d={updated:function(e,t){e.value.length&&t.value&&(t.value?.string&&t.value?.count?e.value=e.value+t.value.string.repeat(t.value.count):t.arg&&(e.value=e.value+t.value.repeat(t.arg)))}},m={updated:function(e,t){e.value.length&&(e.value=e.value.replace(new RegExp(t.value.regexp,t.value.flags),t.value.string||""))}},h={updated:function(e,t){if(e.value.length){const a=t.modifiers?.numbers||t.value?.numbers,u=R(e.value,a);u!==null&&(e.value=u)}}},g={updated:function(e,t){if(e.value.length){const a=t.modifiers?.lower||t.value?.lower,u=S(e.value,a);u!==null&&(e.value=u)}}},w={updated:function(e,t){if(e.value.length){const a=t.value||t.modifiers,u=M(e.value,a);u!==null&&(e.value=u)}}},L={updated:function(e,t){let a=e.value.length;if(a){let u=t.value?.omission||t.value,n=t.value?.count||t.arg;a>n&&(e.value=z(e.value,n,u))}}},C={updated:function(e,t){if(e.value.length){const a=t.value||t.modifiers;if(a?.first)if(a?.every){const u=S(e.value);u!==null&&(e.value=u)}else e.value=o(e.value);else e.value=e.value.toUpperCase()}}},T={directives:{camel:r,capitalize:c,flat:s,kebab:i,lower:v,pad:f,pascal:p,repeat:d,replace:m,snake:h,title:g,train:w,truncate:L,upper:C}},V={install(e){e.directive("camel",r),e.directive("capitalize",c),e.directive("flat",s),e.directive("kebab",i),e.directive("lower",v),e.directive("pad",f),e.directive("pascal",p),e.directive("repeat",d),e.directive("replace",m),e.directive("snake",h),e.directive("title",g),e.directive("train",w),e.directive("truncate",L),e.directive("upper",C)}};l.StringDirectivesMixin=T,l.VueStringDirectives=V,l.camel=r,l.capitalize=c,l.flat=s,l.kebab=i,l.lower=v,l.pad=f,l.pascal=p,l.repeat=d,l.replace=m,l.snake=h,l.title=g,l.train=w,l.truncate=L,l.upper=C,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
(function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.VueStringDirectives={}))})(this,(function(a){"use strict";function r(e,u=!1){if(!e)return null;let l=e.charAt(0).toUpperCase(),t=e.slice(1);return u&&(t=t.toLowerCase()),`${l}${t}`}function E(e,u={numbers:!1,lower:!1}){if(!e)return null;const l=u?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let t=e.match(l);if(!t||t.length<=1)return null;let n=t.shift();const j=u?.lower;return j&&(n=n.toLowerCase()),t=t.map(_=>r(_,j)),t.unshift(n),t.join("")}function k(e,u=!1){if(!e)return null;let l=u?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu"),t=e.match(l);return!t||t.length<=1?null:t.map(n=>n.toLowerCase()).join("")}function N(e,u=!1){if(!e)return null;let l=u?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu,t=e.match(l);return!t||t.length<=1?null:t.map(n=>n.toLowerCase()).join("-")}function y(e,u,l=" "){if(!e)return null;const t=Math.floor((u-e.length)/2)+e.length;return e.padStart(t,l).padEnd(u,l)}function D(e,u={numbers:!1,lower:!1}){if(!e)return null;const l=u?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let t=e.match(l);return!t||t.length<=1?null:t.map(n=>r(n,u?.lower)).join("")}function R(e,u=!1){if(!e)return null;let l=u?/[\p{L}\p{N}_]+/gu:/[\p{L}_]+/gu,t=e.match(l);return!t||t.length<=1?null:t.map(n=>n.toLowerCase()).join("_")}function S(e,u=!1){return e?e.replace(new RegExp("\\p{L}+","gu"),l=>r(l,u)):null}function M(e,u={numbers:!1,lower:!1}){if(!e)return null;const l=u?.numbers?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu;let t=e.match(l);return!t||t.length<=1?null:t.map(n=>r(n,u?.lower)).join("-")}function z(e,u=32,l="..."){return e?e.substring(0,u)+l:null}const o={updated:function(e,u){if(e.value.length){const l=u.value||u.modifiers,t=E(e.value,l);t!==null&&(e.value=t)}}},i={updated:function(e,u){if(e.value.length){const l=u.modifiers?.lower||u.value?.lower;e.value=r(e.value,l)}}},c={updated:function(e,u){if(e.value.length){const l=u.modifiers?.numbers||u.value?.numbers,t=k(e.value,l);t!==null&&(e.value=t)}}},s={updated:function(e,u){if(e.value.length){const l=u.modifiers?.numbers||u.value?.numbers,t=N(e.value,l);t!==null&&(e.value=t)}}},v={updated:function(e,u){if(e.value.length){const l=u.value||u.modifiers;e.value=l?.first?e.value.charAt(0).toLowerCase()+e.value.slice(1):e.value.toLowerCase()}}},f={updated:function(e,u){if(e.value.length){const l=u.value?.count||u.arg,t=u.value?.chars||u.value;u.modifiers?.start||u.value?.start?e.value=e.value.padStart(l,t):u.modifiers?.end||u.value?.end?e.value=e.value.padEnd(l,t):e.value=y(e.value,l,t)}}},p={updated:function(e,u){if(e.value.length){const l=u.value||u.modifiers,t=D(e.value,l);t!==null&&(e.value=t)}}},d={updated:function(e,u){e.value.length&&u.value&&(u.value?.string&&u.value?.count?e.value=e.value+u.value.string.repeat(u.value.count):u.arg&&(e.value=e.value+u.value.repeat(u.arg)))}},m={updated:function(e,u){e.value.length&&(e.value=e.value.replace(new RegExp(u.value.regexp,u.value.flags),u.value.string||""))}},h={updated:function(e,u){if(e.value.length){const l=u.modifiers?.numbers||u.value?.numbers,t=R(e.value,l);t!==null&&(e.value=t)}}},g={updated:function(e,u){if(e.value.length){const l=u.modifiers?.lower||u.value?.lower,t=S(e.value,l);t!==null&&(e.value=t)}}},w={updated:function(e,u){if(e.value.length){const l=u.value||u.modifiers,t=M(e.value,l);t!==null&&(e.value=t)}}},L={updated:function(e,u){let l=e.value.length;if(l){let t=u.value?.omission||u.value,n=u.value?.count||u.arg;l>n&&(e.value=z(e.value,n,t))}}},C={updated:function(e,u){if(e.value.length){const l=u.value||u.modifiers;if(l?.first)if(l?.every){const t=S(e.value);t!==null&&(e.value=t)}else e.value=r(e.value);else e.value=e.value.toUpperCase()}}},T={directives:{camel:o,capitalize:i,flat:c,kebab:s,lower:v,pad:f,pascal:p,repeat:d,replace:m,snake:h,title:g,train:w,truncate:L,upper:C}},V={install(e){e.directive("camel",o),e.directive("capitalize",i),e.directive("flat",c),e.directive("kebab",s),e.directive("lower",v),e.directive("pad",f),e.directive("pascal",p),e.directive("repeat",d),e.directive("replace",m),e.directive("snake",h),e.directive("title",g),e.directive("train",w),e.directive("truncate",L),e.directive("upper",C)}};a.StringDirectivesMixin=T,a.VueStringDirectives=V,a.camel=o,a.capitalize=i,a.flat=c,a.kebab=s,a.lower=v,a.pad=f,a.pascal=p,a.repeat=d,a.replace=m,a.snake=h,a.title=g,a.train=w,a.truncate=L,a.upper=C,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
{
"name": "vue-string-directives",
"version": "1.2.1",
"version": "1.2.2",
"description": "Vue string directives library can change form input value dynamically.",

@@ -65,3 +65,3 @@ "type": "module",

"dependencies": {
"string-filters": "^0.3.6",
"string-filters": "^0.3.7",
"vue": "^3.5.24"

@@ -68,0 +68,0 @@ },

@@ -10,3 +10,2 @@ # Vue String Directives

1. [NPM](#npm)
2. [Manually](#manually)
3. [Usage](#usage)

@@ -44,11 +43,2 @@ 1. [Camel case](#camel-case)

### Manually
[Download](https://github.com/tarkhov/vue-string-directives/releases/download/v1.2.1/vue-string-directives.zip) package and unpack it or use following commands:
```bash
wget https://github.com/tarkhov/vue-string-directives/releases/download/v1.2.1/vue-string-directives.zip
unzip vue-string-directives.zip
```
## Usage

@@ -55,0 +45,0 @@