Skip to content

voxgig/util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@voxgig/util

Small, shared utility functions used across Voxgig front-end and back-end code. The library ships in two languages with matching behaviour:

  • TypeScript — npm package @voxgig/util
  • Go — module github.com/voxgig/util/go

TypeScript is the canonical implementation; the Go package is kept in parity with it.

Install

TypeScript / Node:

npm install @voxgig/util

pino, pino-pretty, and shape are peer dependencies — install them in the host project.

Go:

go get github.com/voxgig/util/go

A first taste

TypeScript:

import { camelify, get, pinify } from '@voxgig/util'

camelify('foo-bar')                 // 'FooBar'
get({ a: { b: 1 } }, 'a.b')         // 1
pinify(['user', 'alice', 'role'])   // 'user:alice,role:'

Go:

import util "github.com/voxgig/util/go"

util.Camelify("foo-bar")                              // "FooBar"
util.Get(map[string]any{"a": map[string]any{"b": 1}}, "a.b") // 1
util.Pinify([]string{"user", "alice", "role"})        // "user:alice,role:"

Documentation

The documentation is organised into four sections, each answering a different question:

If you want to… Read
learn the library by doing Getting started
accomplish a specific task How-to guides
look up a function's exact behaviour TypeScript API · Go API
understand why it works the way it does How it works

Start at the documentation index for an overview.

Working with AI coding agents

Repository conventions and a complete, scannable API quick-reference for AI coding agents live in AGENTS.md.

Building and contributing

This repo contains both implementations, side by side in ts/ and go/. TypeScript output in ts/dist/ and ts/dist-test/ is committed, so rebuild after changing ts/src/ or ts/test/.

# TypeScript (from ts/)
npm install
npm run build          # tsc --build src test -> dist/ and dist-test/
npm test

# Go (from go/)
go test ./...

Continuous-integration workflow definitions live in .github/workflows/.

License

MIT © Voxgig Ltd. See LICENSE.

About

Voxgig Util

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from voxgig/model