Skip to content

kikiutils/node-shared

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

533 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@kikiutils/shared

npm version npm downloads codecov License

A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.

TODO: update README

Features

  • 📋 Clipboard utilities — copy text and blobs using the modern Clipboard API (Browser only)
  • 📜 Logging utilities — simple and extensible logging via Consola and Pino
  • 🔒 Crypto utilities — secure hashing functions: MD5, SHA3-224/256/384/512
  • 📅 Datetime utilities — manipulate, format, and offset dates and ranges
  • 🔢 Enum utilities — extract enum keys and values (number or string)
  • 🌱 Environment helpers — safe env var access with error handling (Node only)
  • 📈 Math utilities — rounding, formatting percentages, and ratios
  • 💎 Number utilities — number padding, compact display, currency formatting
  • 🔤 String utilities — casing, trimming, random string generation, etc.
  • 🌐 URL utilities — parse and construct query strings and redirect URLs
  • 🧩 Vue 3 utilities — composables like scroll preservation and key handling
  • 🖥️ Web utilities — browser DOM helpers (e.g. scroll to top, key matching)
  • 🗄️ Storage utilities — enhanced localStorage, Redis, and LRU abstractions
  • 📦 Modular by design — import only what you need via @kikiutils/shared/<module>

Requirements

  • Node.js >=22.12.0

Installation

Using pnpm:

pnpm add @kikiutils/shared

You can also use yarn, npm, or bun.

Note

This package is modular. It does not install all dependencies by default.

If a utility depends on a third-party package (e.g. date-fns), you must install it manually.

Usage

Import the functions or modules you want to use:

import { logger } from '@kikituils/shared/consola';
import { extractFirstValue } from '@kikituils/shared/general';

const data = [
    0,
    1
];

const value = extractFirstValue(data);
console.log(value); // 0
logger.info(value);

Modules & Functions

Each module file includes function-level comments and usage examples.

  • toBuffer
  • copyBlobToClipboard
  • copyTextToClipboard

Console logger integration.

  • cryptoMd5, cryptoMd5ToBuffer
  • cryptoSha3224, cryptoSha3224ToBuffer
  • cryptoSha3256, cryptoSha3256ToBuffer
  • cryptoSha3384, cryptoSha3384ToBuffer
  • cryptoSha3512, cryptoSha3512ToBuffer
  • formatDate
  • getDateRangeFromDate
  • getMidnightDateFromToday
  • createElFormItemRuleWithDefaults
  • getEnumStringValues
  • getEnumNumberValues
  • getEnumValues
  • checkAndGetEnvValue
  • extractFirstValue
  • sha3224
  • sha3256
  • sha3384
  • sha3512
  • toPercentageString
  • toCompactNumberString
  • stringifyObjectDeterministically

Pino logger integration.

  • generateWithNestedRandomLength

storage

  • createKeyedEnhancedLocalStore
  • enhancedLocalStorage
  • createEnhancedRedisStorage
  • createKeyedEnhancedRedisStore
  • createKeyedLruStore
  • randomString
  • appendRedirectParamToUrl
  • appendRedirectParamFromCurrentRouteToUrl
  • clearIntervalRef
  • clearTimeoutRef
  • usePreserveScroll
  • appendRedirectParamFromCurrentLocationToUrl
  • assignUrlWithRedirectParamFromCurrentLocation

License

MIT License

About

A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.

Resources

License

Stars

Watchers

Forks

Contributors

Languages