front-end utils
A common utility library for usage across LeafLink's front-end applications.

Installation
npm i @leaflink/front-end-utils
Usage
Import the util(s) you need, and go.
import { obfuscateText } from '@leaflink/front-end-utils';
Adding a new utility
Using a named export instead of a default export is recommended.
A named export ensures the function name is properly reflected in the generated docs. While using a default export will still work, we'll just see default()
displayed instead.
- Export from
src/index.ts
(along with any types).
export { obfuscateText, ObfuscateTextOptions } from './obfuscateText.js';
- Update
entryPoints
in typedoc.json
to include it in the side nav.
Up and running
npm run docs
to start a local dev server
npm run docs:build
to build for production
npm run docs:preview
to locally preview the production build
Testing
To run tests, there's multiple npm scripts available to you:
npm run test
- Run all tests in watch mode.
npm run test <file>
- Run matching spec file(s) quickly and watch for changes.
Peer dependencies
Peer dependencies are specific dependencies that a package requires to work correctly, but expects the consumer of the package to provide. In other words, they are dependencies that the package relies on, but are not bundled with the package itself.
@leaflink/front-end-utils
does not yet require peer deps at this time. This may change if a util has to lean on a dependency like lodash-es
.
These peer dependencies will need to be installed separately by the consumer of the package, ensuring that the correct versions are used to maintain compatibility and avoid conflicts with other dependencies in the project.
Contributing
This library provides functions that help other developers while also promoting consistency and modularity across front-end projects. If there's a utility you'd like to add that solves a common problem or captures a pattern other front-end projects would benefit from, it sounds like a great fit! If it's moreso tied to the specifics of a single app, it should likely remain downstream.
Config
These docs are generated using typedoc
, converted to markdown with typedoc-plugin-markdown
, and then tailored for vitepress
via typedoc-vitepress-theme
.
typedoc.json
notes:
index.md
is currently sourced from README.md
- individual utility pages are auto-generated based on the
entryPoints
defined in
docsRoot
(typedoc-vitepress-theme
) matches out
to correctly link to the generated pages.
Note: The options present in typedoc.json
are a combination of configurations for typedoc-plugin-markdown, typedoc-vitepress-theme, and core typedoc options.
test 2