npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@techytools/fn

v0.1.0

Published

Universal utility functions for both browser and node (like @lodash, but with more dashes). Mostly "pure" functions (sorting ones use [].sort()). Promises, filtering, sorting, combining, text analysis, math, curry, sleep, etc. See also platform specific f

Downloads

6

Readme

See the code: https://github.com/paulshorey/harmony/modules/fn. Clone the whole monorepo.

A system for organizing utility functions - for use by multiple apps

If something is missing, just add it. Then use it in any app in the future.

Categories

  • /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 axios
  • /server - relies on server-side dependencies and variables like process, env, fs

This is currently a work in progress. May have bugs and edge cases.
/io is universal, most mature, and has has full unit test coverage. /browser is stable but needs testing. /requests is experimental. /server only has one function but more bash/shell utilities will be added soon.

How to use

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

Development:

This package is part of a monorepo. It relies on a couple sibling packages @techytools/constants and @techytools/cconsole.

  1. Clone the entire monorepo: git clone [email protected]:paulshorey/harmony.git mono

Enter the monorepo ROOT directory cd ./mono:

  1. Install from the root monorepo directory. Yarn works better than npm: yarn install

To edit the utility functions, now enter this project cd ./modules/fn:

  1. Develop: yarn run dev

  2. Run the tests in watch mode: yarn run test:watch

  3. Run the tests: yarn run test

  4. Build. Compile Typescript to ES6: yarn run build

To update documentation, stay in the project directory:

  1. Build documentation to _docs folder: yarn run docs:build

  2. Open the documentation in a browser: yarn run docs:serve

Maintenance:

Install new NPM dependencies in the project directory (cd ./modules/fn)

Use the -W flag to install the new project dependency into the current project.

yarn add -W <package>

Use the -D flag to install the NPM module as a dev dependency.

yarn add -W -D <package>

Notes

This is meant to be used in a monorepo by any JavaScript framework that supports ES Modules and ES2015+ (NodeJS on the server or Webpack/Babel/NextJS compiler on the client).

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.