
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@riveraser/vue-text-utils
Advanced tools
A lightweight Vue 3 plugin offering a collection of custom directives for formatting text directly in your templates.
A lightweight Vue 3 plugin offering a collection of custom directives for formatting text directly in your templates. Format currency, numbers, and date-time values with intuitive syntax like v-format.currency, v-format.number, and v-format.date-time. Designed for internationalization, accessibility, and rapid development.
Check out the interactive demo to see all features in action! Or visit https://riveraser.github.io/vue-text-utils
npm install @riveraser/vue-text-utils
import { createApp } from "vue";
import App from "./App.vue";
import { VueTextUtils } from "@riveraser/vue-text-utils";
const app = createApp(App);
app.use(VueTextUtils);
app.mount("#app");
By default, Vue Text Utils automatically detects your user's preferences from their browser:
import { createApp } from "vue";
import App from "./App.vue";
import { VueTextUtils } from "@riveraser/vue-text-utils";
const app = createApp(App);
// Auto-detects user's locale, timezone, and currency from browser
app.use(VueTextUtils);
app.mount("#app");
import { createApp } from "vue";
import App from "./App.vue";
import { VueTextUtils } from "@riveraser/vue-text-utils";
const app = createApp(App);
app.use(VueTextUtils, {
locale: "es-ES", // Override auto-detected locale
defaultCurrency: "EUR", // Override auto-detected currency
defaultTimezone: "Europe/Madrid", // Override auto-detected timezone
autoDetect: false, // Disable auto-detection (use only specified options)
debug: true, // Enable debug logging
});
app.mount("#app");
You can also use the detection utilities independently:
import {
detectUserPreferences,
detectUserLocale,
detectUserTimezone,
detectUserCurrency,
} from "@riveraser/vue-text-utils";
// Get all user preferences at once
const userPrefs = detectUserPreferences();
console.log(userPrefs);
// { locale: 'en-US', timezone: 'America/New_York', currency: 'USD' }
// Or detect individually
const locale = detectUserLocale(); // 'en-US'
const timezone = detectUserTimezone(); // 'America/New_York'
const currency = detectUserCurrency(); // 'USD'
import { createApp } from "vue";
import App from "./App.vue";
import {
CurrencyDirective,
NumberDirective,
DateTimeDirective,
} from "@riveraser/vue-text-utils";
const app = createApp(App);
app.directive("currency", CurrencyDirective);
app.directive("number", NumberDirective);
app.directive("date-time", DateTimeDirective);
app.mount("#app");
<!-- Currency formatting (explicit - uses binding value) -->
<p v-currency="120"></p>
<!-- Output: $120.00 -->
<p v-currency:EUR="120"></p>
<!-- Output: €120.00 -->
<!-- Number formatting (explicit) -->
<p v-number="1250"></p>
<!-- Output: 1,250 -->
<!-- Date-time formatting (explicit) -->
<p v-date-time="'2025-11-01T20:25:20.000Z'"></p>
<!-- Output: 11/1/2025, 8:25:20 PM -->
<!-- Explicit usage (uses binding value) -->
<p v-format.currency="120"></p>
<p v-format.number="1250"></p>
<p v-format.date-time="'2025-11-01T20:25:20.000Z'"></p>
<!-- Currency with options -->
<p v-currency="{ value: 120, currency: 'USD', currencyDisplay: 'code' }"></p>
<!-- Output: USD 120.00 -->
<!-- Number as percentage -->
<p v-number="{ value: 0.25, percentage: true }"></p>
<!-- Output: 25% -->
<!-- Date with custom style -->
<p
v-date-time="{ value: '2025-11-01T20:25:20.000Z', dateStyle: 'short', timeStyle: 'short' }"
></p>
<!-- Output: 11/1/25, 8:25 PM -->
<template>
<!-- These will automatically show in user's local format -->
<div class="product-card">
<h3>{{ product.name }}</h3>
<!-- Price shows in user's currency automatically -->
<p class="price" v-currency="product.price"></p>
<!-- Date shows in user's timezone automatically -->
<p class="date" v-date-time="product.createdAt"></p>
<!-- Numbers formatted according to user's locale -->
<p class="views" v-number="product.views"></p>
</div>
</template>
<script setup>
// Auto-detection enabled by default - no configuration needed!
// German user sees: 120,00 €, 1.234.567 views, 13.11.2025 format
// US user sees: $120.00, 1,234,567 views, 11/13/2025 format
// Japanese user sees: ¥120, 1,234,567 views, 2025/11/13 format
const product = {
name: "Awesome Product",
price: 120,
createdAt: "2025-11-13T10:30:00Z", // UTC from server
views: 1234567,
};
</script>
The directives use the following priority order for locale and formatting options:
Explicit Mode (recommended - supports reactivity):
<p v-currency="price"></p>Explicit Mode with Options:
<p v-currency="{ value: price, currency: 'EUR' }"></p>value property in the options objectprice changesExplicit Mode with Argument:
<p v-currency:EUR="price"></p>Example:
<script setup>
import { ref } from "vue";
const price = ref(100);
const updatePrice = () => (price.value = 200);
</script>
<template>
<!-- All of these are reactive and will update when price changes -->
<p v-currency="price"></p>
<p v-currency:EUR="price"></p>
<p
v-currency="{ value: price, currency: 'GBP', currencyDisplay: 'code' }"
></p>
<button @click="updatePrice">Update Price</button>
</template>
| Option | Type | Default | Description |
|---|---|---|---|
locale | string | Auto-detected or "en-US" | Default locale for all formatting |
defaultCurrency | string | Auto-detected or "USD" | Default currency code |
defaultTimezone | string | Auto-detected or "UTC" | Default timezone for date formatting |
autoDetect | boolean | true | Enable automatic browser detection |
debug | boolean | false | Enable debug logging |
Vue Text Utils automatically detects user preferences from their browser:
navigator.language and Intl.DateTimeFormatIntl.DateTimeFormat().resolvedOptions().timeZone| User Location | Auto-Detected Settings |
| ----------------- | --------------------------------------------------------------------- | -------- | ------------------------------------ |
| 🇺🇸 USA | locale: 'en-US', currency: 'USD', timezone: 'America/New_York' |
| 🇩🇪 Germany | locale: 'de-DE', currency: 'EUR', timezone: 'Europe/Berlin' |
| 🇯🇵 Japan | locale: 'ja-JP', currency: 'JPY', timezone: 'Asia/Tokyo' |
| 🇧🇷 Brazil | locale: 'pt-BR', currency: 'BRL', timezone: 'America/Sao_Paulo' | "en-US"| Default locale for all formatting | |defaultCurrency| string |"USD" | Default currency code | |defaultTimezone| string |"UTC" | Default timezone for date formatting | |debug | boolean |false` | Enable debug logging |
FAQs
A lightweight Vue 3 plugin offering a collection of custom directives for formatting text directly in your templates.
We found that @riveraser/vue-text-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.