Skip to content

Fast.Utils export inventory

Each module links to method signatures, runnable examples, parameter types/descriptions, and return contracts. Object and returned-function methods are documented within their owning module.

ModulesMethod reference
ArrayReference
AsyncReference
Base64Reference
ColorReference
CryptoReference
DateReference
DOMReference
EnvironmentReference
FunctionReference
IdentityReference
LoggerReference
NumberReference
ObjectReference
StorageReference
StringReference
VueReference

This inventory follows the @fast-china/utils 2.1.8 root exports. Import every member by name from the root; no public module subpaths exist. Use import type for types. See the API guide and runtime contract for storage, cryptography, error, and platform constraints.

ts
import { chunk, sleep, encodeBase64, parseHexColor, addDays, addCssUnit, isBrowser, once, clamp, pick, Local, camelCase } from "@fast-china/utils";

const pages = chunk([1, 2, 3, 4], 2);
await sleep(20);
const encoded = encodeBase64("Fast");
const color = parseHexColor("#409eff");
const tomorrow = addDays(new Date(), 1);
const size = addCssUnit(24);
const browser = isBrowser();
const initialize = once(() => ({ ready: true }));
const progress = clamp(120, 0, 100);
const selected = pick({ id: 1, name: "Fast" }, ["id"] as const);
Local.set("profile", selected);
const className = camelCase("fast-element-plus");

Array

  • Types: KeySelector.
  • Functions: chunk, removeNullishValues, unique, uniqueBy, groupBy, partition, difference, intersection, symmetricDifference, hasDuplicatesBy, allEqualBy.

Async

  • Types: AbortOptions, TimeoutOptions, RetryContext, RetryOptions, ConcurrentMapOptions, DebouncedFunction, ThrottledFunction.
  • Functions: sleep, withTimeout, retry, mapConcurrent, debounce, throttle.

Async APIs preserve original failure reasons and propagate cancellation through AbortSignal. Debounced functions expose cancel/flush/pending; throttled functions expose cancel/pending.

Base64

  • Types: DecodedText.
  • Functions: encodeBase64Bytes, decodeBase64Bytes, encodeBase64, decodeBase64, encodeBase64UrlBytes, decodeBase64UrlBytes, encodeBase64Url, decodeBase64Url, encodeLatin1Base64, decodeLatin1Base64, encodeSecureBase64, decodeSecureBase64.

DecodedText works as an ordinary string; only explicit .parseJson<T>() attempts JSON parsing. SecureBase64 is compatibility encoding, not encryption.

Color

  • Types: RgbColor, RgbaColor.
  • Functions: parseHexColor, formatHexColor, mixHexColors, mixHexColorWithBlack, mixHexColorWithWhite, relativeLuminance, contrastRatio, pickHigherContrastColor.

Crypto

  • Types: AesCipherMode, AesPaddingMode, PemKeyPair, EcNamedCurve.
  • Randomness and comparison: GenerateRandomBytes, FixedTimeEquals.
  • Digests: MD5Encrypt, SHA1Encrypt, SHA256Bytes, SHA256Encrypt, SHA384Bytes, SHA384Encrypt, SHA512Bytes, SHA512Encrypt.
  • HMAC and derivation: HMACSHA256Encrypt, HMACSHA384Encrypt, HMACSHA512Encrypt, PBKDF2SHA256, HashPasswordPBKDF2SHA256, VerifyPasswordPBKDF2SHA256, HKDFSHA256.
  • AES:AESEncryptAESDecryptAESEncryptAuthenticatedAESDecryptAuthenticatedAESEncryptWithPasswordAESDecryptWithPassword
  • RSA:GenerateRSAKeyPairRSAEncryptOAEPRSADecryptOAEPRSASignPSSRSAVerifyPSS
  • EC:GenerateECDSAKeyPairECDSASignECDSAVerifyGenerateECDHKeyPairDeriveECDHSecretDeriveECDHKeySHA256
ts
import { AESDecryptWithPassword, AESEncryptWithPassword, HashPasswordPBKDF2SHA256, VerifyPasswordPBKDF2SHA256 } from "@fast-china/utils";

const payload = await AESEncryptWithPassword("message", "password");
const plaintext = await AESDecryptWithPassword(payload, "password");
const passwordHash = await HashPasswordPBKDF2SHA256("password");
const valid = await VerifyPasswordPBKDF2SHA256("password", passwordHash);

Date

  • Types: DateInput, RelativeTimeOptions, DateShortcut, DateRangeShortcut.
  • Functions: toDate, isValidDate, startOfDay, endOfDay, addDays, addMonths, addYears, isSameDay, isFuture, getLocalDayBounds, isWithinInterval, formatRelativeTime, formatChineseRelativeTime, createOneMonthRangeFromToday, isDateAfterNow, getLocalTimeGreeting, createDateRangeShortcuts, createDateShortcuts, getStartOfToday.

DOM

  • Types: StyleValue, StyleObject, StyleInput.
  • Functions: addCssUnit, serializeStyle.

Environment

  • Types: RuntimeKind.
  • Functions: isBrowser, isWebWorker, isNode, isUniApp, hasWebCrypto, detectRuntime, isMobileUserAgent, isTabletUserAgent.

Detection describes current capabilities or User-Agent heuristics, not support for every library function.

Function and Identity

  • Function:once
  • Identity types: InstallationIdentityConfiguration, InstallationIdentity.
  • Identity values: configureInstallationIdentity, installationIdentity, getOrCreateInstallationId.

Installation identity describes one installation in the current storage area; it is not an authentication credential, hardware identifier, or secret.

Logger

  • Types: LogLevel, LoggerSink, LoggerOptions, Logger.
  • Values: createLogger, configureLogger, logger.

Number

  • Types: FormatBytesOptions.
  • Functions: clamp, inRange, roundTo, sum, average, lerp, formatBytes, randomInt.

Object and Query

  • Types: QueryPrimitive, QueryValue, QueryStringOptions.
  • Functions: isPlainObject, hasOwn, cloneDeep, isEqual, pick, omit, omitBy, pickBy, mapValues, shallowEqual, toQueryString.

Storage

  • Types: StorageCodec, StorageConfiguration, StorageReadOptions, StorageWriteOptions, StorageArea.
  • Values: base64StorageCodec, Local, Session, configureStorage, isStorageConfigured.

String

  • Types: ParsedQueryParameters, StringLocale.
  • Functions: decodeURIComponentRepeatedly, parseQueryString, isValidJson, splitWords, upperFirst, lowerFirst, camelCase, pascalCase, kebabCase, truncateGraphemes, copy, randomString, generateUuidV4, isUuidV4, escapeHtml, normalizeWhitespace.

Vue

  • Types: AwaitableFunction, Breakpoints, ElementSize, EmitHandlers, EventTargetSource, ResizeObserverTarget, UseBreakpointsReturn, UseElementSizeReturn, UseWindowSizeReturn, VueInstallValue, Installable, TSXWithInstall, TypedSlots, TypedSlotsDeclaration.
  • Functions: callOptionalFunction, useBreakpoints, useElementSize, useEmits, useEventListener, useExpose, useNow, useResizeObserver, useWindowSize, definePropType, useProps, useRender, makeSlots, withDefineType, withInstall, withNoopInstall, withInstallDirective.
ts
import { definePropType, makeSlots, withInstall } from "@fast-china/utils";
import { defineComponent } from "vue";

const slots = makeSlots<{ default: () => unknown }>();
const valueType = definePropType<string>(String);
const component = withInstall(defineComponent({ name: "ExampleComponent", props: { value: valueType }, slots }));

Vue helpers target component-library authors. Most business applications need only data, async, environment, and Storage APIs.