{"id":25830916,"url":"https://github.com/lab5e/toolbox","last_synced_at":"2026-06-13T05:32:23.416Z","repository":{"id":57126075,"uuid":"418894861","full_name":"lab5e/toolbox","owner":"lab5e","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-29T09:18:52.000Z","size":2033,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T23:18:31.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lab5e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-19T11:29:47.000Z","updated_at":"2021-10-25T06:06:38.000Z","dependencies_parsed_at":"2022-08-31T12:12:10.577Z","dependency_job_id":null,"html_url":"https://github.com/lab5e/toolbox","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/lab5e/toolbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Ftoolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Ftoolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Ftoolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Ftoolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lab5e","download_url":"https://codeload.github.com/lab5e/toolbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Ftoolbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34273788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-28T19:34:48.389Z","updated_at":"2026-06-13T05:32:23.401Z","avatar_url":"https://github.com/lab5e.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toolbox\n\nSimple toolbox 🧰 to keep our utility functions that we scatter across several repos and diverge over time.\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Documentation](https://img.shields.io/badge/docs-tsdoc-blue.svg)](https://lab5e.github.io/toolbox)\n[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@lab5e/toolbox.svg)](#tiny)\n[![toolbox](https://img.shields.io/npm/v/@lab5e/toolbox.svg)](https://www.npmjs.com/package/@lab5e/toolbox)\n[![CI](https://github.com/lab5e/toolbox/actions/workflows/main.yml/badge.svg)](https://github.com/lab5e/toolbox/actions/workflows/main.yml)\n\n## Available tools\n\n## Validation\n\nA simple, yet comprehensive Validation tool which gives you both validation rules and a `Validation` class to play with. You can either use the validation rules directly or create a curried Validation class that can be reused.\n\n```ts\nimport { validation } from \"@lab5e/toolbox\";\n\nconst value = \"5\";\n\nconst validation = validation\n  .initValidation()\n  .min(0)\n  .max(10)\n  .validate(value);\n\nif (value === true) {\n  console.log(\"Yay, our number is between 0 and 10\");\n} else {\n  console.log(`Validation failed. Message. ${validation}`);\n}\n```\n\n## CopyToClipboard\n\nA simple promisified version to copy some text to the user clipboard.\n\n```ts\nimport { copyToClipboard } from \"@lab5e/toolbox\";\n\n/* Using await */\n(async () =\u003e {\n  await copyToClipboard(\"Text to clipboard\");\n  console.log(\"Success!\");\n})();\n\n/* Using promise directly */\ncopyToClipboard(\"Text to clipboard\").then(() =\u003e {\n  console.log(\"Success!\");\n});\n```\n\n## Sleep\n\nWhile not idiomatic, and utterly wrong in most cases, a promisified sleep can always be handy sometimes.\n\n```ts\nimport { sleep } from \"@lab5e/toolbox\";\n\n/* Using await */\n(async () =\u003e {\n  await sleep(500);\n  console.log(\"Ah, good to be awake again\");\n})();\n\n/* Using promise directly */\nsleep(500).then(() =\u003e {\n  console.log(\"Ah, good to be awake again\");\n});\n```\n\n## Development\n\nWe use [TSDX](https://github.com/formium/tsdx) for pretty much everything, and most npm scripts just proxy to `tsdx`.\n\n### Run single build\n\nUse `npm run build`.\n\n### Run tests\n\nTo run tests, use `npm test`.\n\n## Configuration\n\nCode quality is set up with `prettier`, `husky`, and `lint-staged`.\n\n### Jest\n\nJest tests are set up to run with `npm test`.\n\n#### Watch mode\n\nTo run in watch mode run `npm run test:watch`\n\n#### Coverage\n\nTo see coverage run `npm run test:coverage`\n\n### Bundle Analysis\n\n[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.\n\n### Rollup\n\nWe us TSDX which uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.\n\nWe create UMD, CommonJS, and JavaScript Modules in our build. The appropriate paths are configured in `package.json` and `dist/index.js`\n\n### TypeScript\n\nWe use TypeScript for everything, giving us types for all the published packages.\n\n## Continuous Integration\n\n### GitHub Actions\n\n- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix\n- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)\n\n## Publishing to NPM\n\nWe use `np`. To publish a new version, write `npx np` and follow the interactive tutorial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Ftoolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flab5e%2Ftoolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Ftoolbox/lists"}