# @tempots/std

> Std library for TypeScript. Natural complement to the Tempo libraries.

Latest version **0.30.0** (published 2026-11-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @tempots/std
pnpm add @tempots/std
yarn add @tempots/std
bun add @tempots/std
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.30.0 |
| Published | 2026-11-19 |
| First published | 2023-04-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 419.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Franco Ponticelli |
| Maintainers | fponticelli |
| Keywords | tempo, tempots, framework, std, library |

## Links

- npm: https://www.npmjs.com/package/@tempots/std
- Repository: https://github.com/fponticelli/tempots
- Issues: https://github.com/fponticelli/tempots/issues
- npm.io page: https://npm.io/package/@tempots/std

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.30.0 (latest) — 2026-11-19
- 0.29.1 — 2026-03-23
- 0.29.0 — 2026-03-22
- 0.28.1 — 2026-03-22
- 0.28.0 — 2026-03-22
- 0.27.0 — 2026-03-04
- 0.26.1 — 2026-02-16
- 0.26.0 — 2026-02-16
- 0.25.2 — 2026-01-20
- 0.25.1 — 2026-01-20
- 0.25.0 — 2026-01-20
- 0.24.0 — 2025-09-26
- 0.23.0 — 2025-09-26
- 0.22.1 — 2025-07-26
- 0.22.0 — 2025-07-05
- … 24 more at https://npm.io/package/@tempots/std/versions

## README

# Tempo Standard Library (@tempots/std)

A comprehensive standard library for TypeScript that provides utility functions and types commonly used in web applications. This package serves as a natural complement to the Tempo libraries but can be used independently in any TypeScript project.

[![npm version](https://img.shields.io/npm/v/@tempots/std.svg)](https://www.npmjs.com/package/@tempots/std)
[![license](https://img.shields.io/npm/l/@tempots/std.svg)](https://github.com/fponticelli/tempots/blob/main/LICENSE)
[![codecov](https://codecov.io/gh/fponticelli/tempots/branch/main/graph/badge.svg)](https://codecov.io/gh/fponticelli/tempots)
[![CI](https://github.com/fponticelli/tempots/workflows/CI/badge.svg)](https://github.com/fponticelli/tempots/actions)

## Installation

```bash
# npm
npm install @tempots/std

# yarn
yarn add @tempots/std

# pnpm
pnpm add @tempots/std
```

## Features

The library provides utility functions for working with:

### Array Operations

```typescript
import { filterArray, mapArray, uniquePrimitives } from '@tempots/std'
// or
import { filterArray, mapArray, uniquePrimitives } from '@tempots/std/array'

// Filter an array
const numbers = [1, 2, 3, 4, 5]
const evenNumbers = filterArray(numbers, n => n % 2 === 0) // [2, 4]

// Map an array
const doubled = mapArray(numbers, n => n * 2) // [2, 4, 6, 8, 10]

// Get unique values
const withDuplicates = [1, 2, 2, 3, 3, 3]
const unique = uniquePrimitives(withDuplicates) // [1, 2, 3]
```

### String Utilities

```typescript
import { capitalizeWords, ellipsis } from '@tempots/std'
// or
import { capitalizeWords, ellipsis } from '@tempots/std/string'

// Capitalize words
const capitalized = capitalizeWords('hello world') // 'Hello World'

// Truncate with ellipsis
const truncated = ellipsis('This is a very long text', 10) // 'This is a...'
```

### Async Utilities

```typescript
import { deferred } from '@tempots/std'
// or
import { deferred } from '@tempots/std/deferred'

// Create a deferred promise
const { promise, resolve, reject } = deferred<number>()

// Use the promise
promise.then(value => console.log(value))

// Resolve it later
setTimeout(() => resolve(42), 1000)
```

### Timer Functions

```typescript
import { delayed, interval } from '@tempots/std'
// or
import { delayed, interval } from '@tempots/std/timer'

// Delay execution
const cancelDelay = delayed(() => {
  console.log('Executed after 1 second')
}, 1000)

// Set up an interval
const cancelInterval = interval(() => {
  console.log('Executed every 2 seconds')
}, 2000)

// Cancel if needed
cancelDelay() // Cancel the delayed execution
cancelInterval() // Stop the interval
```

### Result and Validation

```typescript
import { Result, success, failure } from '@tempots/std'
// or
import { Result, success, failure } from '@tempots/std/result'

// Create success or failure results
const successResult = success(42)
const failureResult = failure('Something went wrong')

// Handle results
successResult.match({
  success: value => console.log(`Success: ${value}`),
  failure: error => console.error(`Error: ${error}`)
})
```

## Available Modules

The library is organized into the following modules:

- `array` - Array manipulation utilities
- `async-result` - Asynchronous result handling
- `bigint` - BigInt utilities
- `boolean` - Boolean utilities
- `deferred` - Promise deferral utilities
- `domain` - Domain-specific types
- `equal` - Deep equality comparison
- `error` - Error handling utilities
- `function` - Function composition and manipulation
- `json` - JSON utilities
- `number` - Number utilities
- `object` - Object manipulation
- `promise` - Promise utilities
- `regexp` - Regular expression utilities
- `result` - Result type for error handling
- `string` - String manipulation utilities
- `timer` - Timing utilities
- `validation` - Data validation utilities

## Documentation

For comprehensive documentation, visit the [Tempo Documentation Site](https://tempo-ts.com/library/tempots-std.html).

## License

This package is licensed under the Apache License 2.0.

---
_Source: https://npm.io/package/@tempots/std · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
