
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.
A fast and efficient JavaScript utility library for modern applications.
简体中文 | English
timSort - An efficient sorting algorithm that combines merge sort and insertion sort
compressToBase64 - Compress a string and encode it as a URL-safe base64 string
decompressFromBase64 - Decompress a base64-encoded compressed string back to the original
Install package:
# ✨ Auto-detect
npx nypm install qva
# npm
npm install qva
# yarn
yarn add qva
# pnpm
pnpm add qva
# bun
bun install qva
# deno
deno install npm:qva
import { timSort } from 'qva'
// Sort in ascending order (default)
const numbers = [3, 1, 4, 1, 5, 9, 2, 6]
const sorted = timSort(numbers)
console.log(sorted) // [1, 1, 2, 3, 4, 5, 6, 9]
// Sort in descending order
const descending = timSort(numbers, 'desc')
console.log(descending) // [9, 6, 5, 4, 3, 2, 1, 1]
import { timSort } from 'qva'
const items = ['apple', 'Banana', 'cherry', 'Date']
// Case-insensitive sorting
const sorted = timSort(items, (a, b) => {
return a.toLowerCase().localeCompare(b.toLowerCase())
})
console.log(sorted) // ['apple', 'Banana', 'cherry', 'Date']
import { timSort } from 'qva'
const users = [
{ name: 'Alice', age: 30 },
{ name: 'Bob', age: 25 },
{ name: 'Charlie', age: 35 }
]
// Sort by age in ascending order
const byAge = timSort(users, 'age', 'asc')
console.log(byAge)
// [
// { name: 'Bob', age: 25 },
// { name: 'Alice', age: 30 },
// { name: 'Charlie', age: 35 }
// ]
// Sort by name in descending order
const byName = timSort(users, 'name', 'desc')
console.log(byName)
// [
// { name: 'Charlie', age: 35 },
// { name: 'Bob', age: 25 },
// { name: 'Alice', age: 30 }
// ]
import { compressToBase64, decompressFromBase64 } from 'qva'
// Compress a large text
const longText = 'This is a very long text that we want to compress...'
const compressed = compressToBase64(longText)
console.log('Compressed:', compressed)
console.log('Size reduction:', ((1 - compressed.length / longText.length) * 100).toFixed(2) + '%')
// Decompress back to original
const decompressed = decompressFromBase64(compressed)
console.log('Decompressed:', decompressed)
console.log('Match:', longText === decompressed) // true
// Perfect for URL parameters
const data = { user: 'Alice', settings: { theme: 'dark', lang: 'en' } }
const compressedData = compressToBase64(JSON.stringify(data))
const url = `https://example.com?data=${compressedData}`
timSort(arr, order?)Sort a number array.
Parameters:
arr: number[] - The array to sortorder: 'asc' | 'desc' - Sort order (default: 'asc')Returns: number[] - The sorted array
timSort(arr, comparator)Sort an array with a custom comparator function.
Parameters:
arr: T[] - The array to sortcomparator: (a: T, b: T) => number - Custom comparison functionReturns: T[] - The sorted array
timSort(arr, key, order?)Sort an object array by a specific key.
Parameters:
arr: Array<Record<string, string | number>> - The array of objects to sortkey: string - The key to sort byorder: 'asc' | 'desc' - Sort order (default: 'asc')Returns: Array<Record<string, string | number>> - The sorted array
compressToBase64(str)Compress a string and encode it as a URL-safe base64 string.
Parameters:
str: string - The string to compressReturns: string - URL-safe base64 encoded compressed string
Features:
+ with -, / with _, removes = padding)decompressFromBase64(base64)Decompress a base64-encoded compressed string back to the original.
Parameters:
base64: string - URL-safe base64 encoded compressed stringReturns: string - The original decompressed string
Features:
Contributions are welcome! Please feel free to submit a Pull Request.
Published under the MIT license.
Made by community 💛
🤖 auto updated with automd
FAQs
一个快速的 JavaScript 实用工具库
We found that qva 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.