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

portable-fp

v0.0.6

Published

Functional programming support library compact enough for copy-paste inclusion

Downloads

11

Readme

portable-fp

version npm build status Coveralls deps status mit license

Portable-FP is a compact, tested implementation of many common functional programming support methods, acting as lightweight stand-in for a real FP utility library.

Purpose

If you like tacit programming and want a good support library for it, I recommend Ramda. This is the library whose API portable-fp follows. Portable-FP's only objective is to offer a lightweight stand-in replacement when for any reason Ramda itself cannot be used or is too large a dependency for how much it would be used.

Ramda offers a fully featured API for writing and composing pure functions, preserving immutability, and escaping procedural flow control. It is widely supported, well tested, and performant. Portable-FP offers a collection of much more compact "good enough" implementations for the highest value subset of Ramda's API.

In essence, Portable-FP should be seen not as an alternative to Ramda, but to hunting the web for code-golfed implementations of the utility functions commonly used in functional or tacit programming. Portable-FP is the happy medium that still weighs in at minimal size while remaining readable enough to cherry-pick down even smaller, and adequately covered by minimal-dependency test code which can accompany embedded use.

| | Ramda | Portable-FP | Some gist of a single function | | --- | --- | --- | --- | | Size | ~270kb, ~45kb minified | ~6kb, ~3kb minified | ~100 bytes | | Curried | :heavy_check_mark: | :heavy_check_mark: | :x: | | Robust API | :heavy_check_mark: | - | :x: | | Optimal Performance | :x: | :x: | :x: | | Immutable Behavior | :heavy_check_mark: | :heavy_check_mark: | - | | Cross-Platform Tested | :heavy_check_mark: | - | :x: | | ES5 Environment Support | :heavy_check_mark: | :x: | - |

Basic Usage

You can install portable-fp via npm: npm install --save portable-fp. However, the intended use case is for scenarios where installing dependencies is disallowed, unsupported, or otherwise overkill. Examples would include sandbox testing from a browser console, applying FP approaches in systems with little or no support for pulling in 3rd-party code, or publishing small packages with minimal dependency footprint.

As alternative to usage as a dependency, the content of lib/portable-fp.js can be copy-pasted directly into the project. That code returns an object containing the implementations of all supported API methods. There are no interdependencies so any unused API methods can be removed, along with any internal methods unneeded by the remainder.

Documentation

Portable-FP is not itself externally documented. It does however stick closely with Ramda's API specification (that library you should probably be using instead of this one). Details of the subset currently implemented in portable-fp, along with indication on any notable behavioral divergence, can be seen in Travis's test output.

An API summary (list of signatures for implemented functions) will be included here after such list stabilizes and is fully tested.