npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qnx/composables

v0.8.0

Published

Collection of basic Vue Composition Utilities

Readme

@qnx/composables

@qnx/composables is a collection of Vue composition utilities for building reactive, data-driven applications. It provides core form helpers and Axios-based request composables with built-in error handling.

📑 Table of Contents

🚀 Features

| Feature | Description | | -------------------------- | -------------------------------------------------------------- | | 📦 Form Utilities | Convert objects to FormData or query strings with ease | | ⚡ Reactive Requests | useAxios returns reactive refs for response, loading, cancel | | 🔄 Async Support | useAsyncAxios for promise-based request handling | | 📄 Paginated Generator | useAsyncAxiosGenerator for cursor/page-based data fetching | | 🚫 Built-in Error Handling | Automatically handles 400/401/422 responses | | 🧠 TypeScript-First | Fully typed API with excellent IntelliSense support |

📦 Installation

Install @qnx/composables via npm, yarn, pnpm, or bun:

# Using npm
npm install @qnx/composables

# Using yarn
yarn add @qnx/composables

# Using pnpm
pnpm install @qnx/composables

# Using bun
bun install @qnx/composables

Peer Dependencies

@qnx/composables has optional peer dependencies depending on the features you use:

# Required for Axios integration features
npm install axios vue

💡 Usage

Core Utilities

objectToFormData

Transforms a plain object into a FormData instance. Handles nested objects, Date, File, and Blob values recursively.

import { objectToFormData } from '@qnx/composables'

const formData = objectToFormData({
  name: 'foo',
  profileImage: fileObject // File or Blob
})

objectToQueryString

Converts an object into a URL-encoded query string, including support for nested objects.

import { objectToQueryString } from '@qnx/composables'

const queryString = objectToQueryString({
  name: 'foo',
  address: 'bar'
})
// => "name=foo&address=bar"

Axios Integration

Import from the @qnx/composables/axios sub-path:

useAxios

Returns reactive refs for response, loading, and cancel controls. The request fires immediately on call.

import { useAxios } from '@qnx/composables/axios'

const { response, isLoading, abort } = useAxios<User[]>('/users', { method: 'GET' })

useAsyncAxios

Promise-based request — awaits the response and returns the data directly.

import { useAsyncAxios } from '@qnx/composables/axios'

const users = await useAsyncAxios<User[]>('/users', { method: 'GET' })

useAsyncAxiosGenerator

An async generator for paginated data fetching. Yields one page at a time and advances when .next() is called.

import { useAsyncAxios } from '@qnx/composables/axios'

const generator = useAsyncAxiosGenerator('/users', { method: 'GET' }, {
  queryParams: { search: '' },
  page_size: 10
})

const { value } = await generator.next()

useErrorResponse

Processes an AxiosError and returns structured reactive refs for status, statusText, and the error response body.

import { useErrorResponse } from '@qnx/composables/axios'

const { getErrorResponse } = useErrorResponse()

try {
  await useAsyncAxios('/users', { method: 'GET' })
} catch (e) {
  const { status, eResponse } = await getErrorResponse(e)
}

setHandleUnauthenticated

Registers a global callback invoked automatically when a 401 Unauthorized response is received.

import { setHandleUnauthenticated } from '@qnx/composables/axios'

setHandleUnauthenticated(() => {
  router.push('/login')
})

📘 API Reference

Core Utilities

| Function | Description | | ------------------------------------- | ----------------------------------------------- | | objectToFormData(obj, form?, ns?) | Recursively converts an object to FormData | | objectToQueryString(obj, prefix?) | Converts an object to a URL query string |

Axios Composables

Imported from @qnx/composables/axios.

useAxios

useAxios<T>(url: string, config: RawAxiosRequestConfig): UseAxiosReturn<T, E>

| Returned Ref / Method | Type | Description | | --------------------- | ----------------- | ------------------------------------- | | response | Ref<T> | Reactive response data | | isLoading | Ref<boolean> | true while the request is in flight | | isFinished | Ref<boolean> | true once the request completes | | loading | Ref<boolean> | Alias for isLoading | | finished | Ref<boolean> | Alias for isFinished | | aborted | Ref<boolean> | true if the request was aborted | | canceled | Ref<boolean> | Alias for aborted | | abort(message?) | Function | Cancels the in-flight request | | cancel(message?) | Function | Alias for abort |

useAsyncAxios

useAsyncAxios<T>(url: string, config: RawAxiosRequestConfig): Promise<T>

useAsyncAxiosGenerator

useAsyncAxiosGenerator<T>(url, config, { queryParams, page_size, page?, deley? }): AsyncGenerator<T>

useErrorResponse

getErrorResponse<T>(error: AxiosError<T>): Promise<{ status, statusText, eResponse: Ref<T> }>

Handles status codes automatically:

| Status Code | Behavior | | ----------- | ------------------------------------------- | | 400, 422 | Populates eResponse with the error body | | 401 | Calls the handler set by setHandleUnauthenticated | | 404, 405 | Throws an Error | | Other | Throws an Error |

setHandleUnauthenticated

setHandleUnauthenticated(fn: () => void | Promise<void>): void

🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

📄 License

MIT License © 2023-PRESENT Yatendra Kushwaha