JSPM

  • Created
  • Published
  • Downloads 1149
  • Score
    100M100P100Q104872F
  • License Apache-2.0

A library that contains shared typescript code.

Package Exports

  • @esposter/shared
  • @esposter/shared/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@esposter/shared) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@esposter/shared

Apache-2.0 licensed NPM version NPM downloads NPM Unpacked Size (with version)

Shared TypeScript utilities, types, and error classes for the Esposter platform. Works in both browser and server environments.

Table of Contents


🚀 Getting Started

pnpm i @esposter/shared @vueuse/core vue zod

📖 Documentation

We highly recommend you take a look at the documentation to level up.

Key Exports

Error Classes

import { InvalidOperationError, NotFoundError, ForbiddenError, NotInitializedError } from "@esposter/shared";

throw new InvalidOperationError(Operation.Read, file.name, zodError.message);

Array Utilities

import { takeOne } from "@esposter/shared";

// Safe index access — throws on out-of-bounds instead of returning undefined
const first = takeOne(items);

Type Utilities

import type { ToData, DeepOmit, GetPaths } from "@esposter/shared";

// ToData<T> — strips class methods, returns plain data shape
type RawColumn = ToData<Column>;

Reactivity

import { toRawDeep, getRawData } from "@esposter/shared";

// Recursively unwrap Vue reactive proxies
const raw = toRawDeep(reactiveObject);

Text / String

import { capitalize, truncate, toKebabCase } from "@esposter/shared";

Error Handling (Result Pattern)

import { getResult, getResultAsync, withFinalizer } from "@esposter/shared";

Commands

Run from packages/shared/:

pnpm build        # compile to dist/
pnpm test         # vitest watch mode (coverage is run from the repo root)
pnpm lint:fix     # auto-fix lint
pnpm typecheck    # type check

⚖️ License

This project is licensed under the Apache-2.0 license.