@carry0987/utils
v4.1.0
Published
A library for using common tools and alias methods
Readme
Utils-JS
A utility library for common browser and universal helpers.
Installation
pnpm add @carry0987/utils -DDocumentation
Full documentation is available on GitHub Pages:
https://carry0987.github.io/Utils-JS/
Quick Start
import { generateUUID, getUrlParam } from '@carry0987/utils';
import { storageUtils, injectStylesheet } from '@carry0987/utils/browser';
const uuid = generateUUID();
const foo = getUrlParam('foo');
storageUtils.setLocalValue('key', 'value');
injectStylesheet('/styles/app.css');Use @carry0987/utils for universal-safe helpers and @carry0987/utils/browser for DOM, storage, event, and stylesheet utilities.
Type Imports
import type { CookieOptions, FetchOptions, URLParams } from '@carry0987/utils/types';
const query: URLParams = { page: 1, search: 'utils' };
const requestOptions: FetchOptions = {
url: '/api/items',
method: 'GET'
};
const cookieOptions: CookieOptions = {
path: '/',
sameSite: 'Lax'
};Import public library types from @carry0987/utils/types. The package no longer exposes a separate interfaces entrypoint.
License
This project is licensed under the MIT License. See the LICENSE file for details.
