See the code: https://github.com/paulshorey/harmony/modules/fn. Clone the whole monorepo.
If something is missing, just add it to your mono-repo. Then use it in any app in the future.
/io- universal pure functions, no side effects, no dependencies, immutable
/browser- relies on the window, location, user agent, OS, screen size, etc.
/requests- external HTTP calls rely on installed NPM dependencies such as
/server- relies on server-side dependencies and variables like
This is currently a work in progress. May have bugs and edge cases.
/iois universal, most mature, has 100% unit test coverage.
/browseris stable but needs testing.
/serveronly has one function but more bash/shell utilities will be added soon.
Everything is tree-shakeable. Import only the function you need, not the entire collection.
import is_ios from "@techytools/fn/browser/device/is_ios";
is_ios(); // true if client is iPhone, iPod, iPad, or emulator
This package is part of a monorepo. It relies on a couple sibling packages
git clone firstname.lastname@example.org:paulshorey/harmony.git mono
cd ./modules/fnto enter this project:
yarn run dev
Run the tests in watch mode:
yarn run test:watch
Run the tests:
yarn run test
Build. Compile Typescript to ES6:
yarn run build
Build documentation to
yarn run docs:build
Open the documentation in a browser:
yarn run docs:serve
-W flag to install the new project dependency into the current project.
yarn add -W <package>
-D flag to install the NPM module as a dev dependency.
yarn add -W -D <package>
The goal of this is to keep a central repository of all the functions any website or application could ever need. Then each app can import only each little code snippet as needed - to keep the bundle size small.
In the future, when this is more mature, this module could be published as a standalone open-source NPM package for anyone anywhere to import to their own app. For now, just clone the entire mono-repo.
However, everyone's codebase has different needs and preferences. The challenge is to create a system that can be used by anyone, but also be customized to fit any project. So for now, I'm practicing organizing the code in my own repository, setting up standards and processes that in the future might meet the needs of a community of developers.
This has no affiliation with the HarmonyJS framework. This will be called "Harmony UX", because it focuses on user experience and developer experience, rather than a specific programming technology.
Generated using TypeDoc