A collection of small, focused, fully-typed TypeScript utilities for Node.js, published under the @tselect namespace on npm.
Each package is developed and released independently in its own repository.
| Package | Description | npm |
|---|---|---|
@tselect/access-control |
Simple, flexible RBAC / ABAC access control for Node.js and TypeScript. | |
@tselect/countries |
Country, currency and language enums and data (ISO 3166 / 4217 / 639). | |
@tselect/http-method |
HTTP method enum and type guards / case utilities. | |
@tselect/schema |
Typed, composable, programmatic JSON schemas. | |
@tselect/status-code |
HTTP status code enum and classification helpers. | |
@tselect/thrown |
Handle specific exceptions in TypeScript like a classic OOP try/catch. |
|
@tselect/url |
Small URL string utilities (slashes, protocol, join). |
// @tselect/status-code
import { StatusCode, is5xx } from '@tselect/status-code';
StatusCode.OK; // 200
is5xx(StatusCode.INTERNAL_SERVER_ERROR); // true
// @tselect/http-method
import { HTTPMethod, isHTTPMethod } from '@tselect/http-method';
HTTPMethod.GET; // get
isHTTPMethod('get'); // true
// @tselect/countries
import { Countries, CountryCode } from '@tselect/countries';
Countries.get(CountryCode.AC).getMainCurrency().getDecimals(); // 2
// @tselect/schema
import { object, email } from '@tselect/schema';
object({ foo: email() }); // { type: 'object', additionalProperties: false, ... }
// @tselect/url
import * as URL from '@tselect/url';
URL.ensureSlashes('/foo', { leading: false, trailing: true }); // foo/
// @tselect/thrown
import { thrown } from '@tselect/thrown';
try { doSomething(); }
catch (err: any) { thrown(err).catch(TypeError, e => {/* ... */}).rethrowUncaught(); }- Small and single-purpose — each package solves one problem and has minimal dependencies.
- Fully typed — first-class TypeScript, shipping
.d.tstypings for editor autocompletion. - CommonJS output — compiled to
dist/and consumed frommain+typings. - MIT licensed.
MIT © Sylvain Estevez