@berqnet/utils

A comprehensive Nuxt components and composables
173
Install
npm install @berqnet/utils
Latest Version:1.0.204
Vue:3
License:MIT
Last Updated:Oct 16, 2026
Links: Repository  ·  npm
Maintainer: samet.ozgen

@berqnet/utils

Nuxt module for utility functions and composables.

Table of Contents

Installation

To install this module, you can use npm or yarn:

npm

npm install @berqnet/utils

yarn

yarn add @berqnet/utils

Usage

  1. To use this module in your Nuxt 3 project, add it to your nuxt.config.ts:
export default defineNuxtConfig({
  modules: ['@berqnet/utils'],
});

Composables

usePermissions

Permission checking composable that validates user permissions based on JWT token.

Basic Usage
const { checkPermission, checkAllPermissions } = usePermissions();

// Single permission check
if (checkPermission('users.view')) {
  console.log('User can view users');
}

// Multiple permissions (ANY mode - user needs at least one)
if (checkPermission('users.view', 'users.edit')) {
  console.log('User can view OR edit users');
}

// Multiple permissions (ALL mode - user needs all)
if (checkAllPermissions('users.view', 'users.edit')) {
  console.log('User can view AND edit users');
}

// Template usage
<berqnet-page :is-permitted="checkPermission('users.view')">
<button v-if="checkPermission('users.delete')">Delete User</button>
API Reference
  • checkPermission(...permissions: (string | string[])[]): boolean - Returns true if user has at least one of the specified permissions
  • checkAllPermissions(...permissions: (string | string[])[]): boolean - Returns true only if user has all of the specified permissions
Permission Format

Permissions follow the format: resource.action

  • Resources: users, dashboard, settings, etc.
  • Actions: view, edit, create, delete
Special Cases
  • Super Admin (role.id === 1): Has all permissions
  • Default Role (role.source === 0): Has all permissions
  • Invalid Role: Has no permissions

useAuthTokenInfo

Provides access to parsed JWT token information.

const { tokenParsed } = useAuthTokenInfo();

useBreadcrumb

Manages breadcrumb navigation.

const { breadcrumbs, addBreadcrumb, removeBreadcrumb } = useBreadcrumb();

useBus

Event bus for component communication.

const { emit, on, off } = useBus();

useI18nSearch

Internationalization search functionality.

const { search } = useI18nSearch();

useNotification

Shows notifications to users.

const { notify } = useNotification();

useOpenAIThread

Manages OpenAI conversation threads.

const { thread } = useOpenAIThread();

useRecaptcha

Google reCAPTCHA integration.

const { verify } = useRecaptcha();

useScrollInElement

Handles scrolling within elements.

const { scrollTo } = useScrollInElement();

useSlugCheck

Validates and manages URL slug parameters.

const { id, type, tab, isAuthorized, isFormDisabled } = useSlugCheck('users', ['settings']);

useStorage

Local and session storage management.

const { get, set, remove } = useStorage();

useTable

Table data management and pagination.

const { data, loading, pagination } = useTable();

useValidation

Form validation utilities.

const { validate, errors } = useValidation();

Scripts

The following npm scripts are available:

  • test: Run tests using Vitest.
  • test:watch: Run tests in watch mode.
  • test:types: Check TypeScript types.
  • lint:prettier: Lint code using Prettier.
  • lint:eslint: Lint code using ESLint.
  • lint:stylelint: Lint styles using Stylelint.
  • fix: Fix linting errors.
  • pub: Publish the module.
  • release: Release a new version.

Contributing

If you would like to contribute, please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes.
  4. Push your branch and create a pull request.

License

This project is licensed under the MIT License.

Related Packages

@timus-networks/theme

A comprehensive Nuxt.js module providing a tailored theme experience with integr...

20,127
@berqnet/theme

A comprehensive Nuxt.js module providing a tailored theme experience with integr...

165
nuxt-plotly

nuxt-plotly module is thin Nuxt3 wrapper for plotly.js

35,721 32
nuxt-facebook-chat

Effortless integration of Facebook's Customer Chat SDK into Nuxt 3. Enhance user...

1,874 7

Version History

Version Released Vue License
1.0.204 ^3.x MIT
Pre-releases (1)
Version Released License
0.0.0-stage