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 🙏

© 2026 – Pkg Stats / Ryan Hefner

rfcc

v1.0.0

Published

A tiny utility for creating functional, curried access to class prototype methods and properties.

Downloads

4

Readme

rffc

rffc (Reuse Function From Class) is a tiny, powerful utility that transforms class prototype methods and properties into curried, data-last functions. It promotes a more functional and composable programming style in JavaScript and TypeScript.


✨ Why rffc?

In traditional object-oriented programming, interacting with object methods often looks like instance.method(args). While effective, this can sometimes make function composition and partial application less straightforward. rffc bridges this gap by allowing you to:

  • Embrace Functional Composition: Seamlessly integrate class methods with pipe, compose, and other higher-order functions from functional programming libraries.
  • Achieve Partial Application (Currying): Easily create specialized functions by pre-filling method arguments, leading to more reusable and declarative code.
  • Unify Interface: Access both properties (like length or getters) and methods (with or without arguments) with a consistent, functional signature (fn(instance, ...args) or fn(...args)(instance)).
  • Improve Readability: For specific functional patterns, rffc can make your code more concise and expressive.

🚀 Installation

Install rffc using npm or yarn:

npm install rffc

📖 Usage

Import rffc and start transforming your class interactions:

import rffc from "rffc";

// Example 1: Accessing a getter property
class User {
  constructor(public name: string, public age: number) {}
  get fullName() {
    return `${this.name} is ${this.age} years old`;
  }
}

const getFullName = rffc(User).fullName;
console.log(getFullName(new User("Alice", 18))); // Output: "Alice is 18 years old"

// Example 2: Currying a method with arguments
const toLocaleDate = rffc(Date).toLocaleDateString;

// Create specialized date formatters
const toLocaleDateEn = toLocaleDate("en-US");
const toLocaleDateDE = toLocaleDate("de-DE");

console.log(toLocaleDateEn(new Date())); // Output: "7/20/2025" (or current date in en-US format)
console.log(toLocaleDateDE(new Date())); // Output: "20.7.2025" (or current date in de-DE format)

// Direct usage without explicit currying
console.log(toLocaleDate("uk-UA", new Date())); // Output: "20.07.2025" (or current date in uk-UA format)

// Example 3: Using a method that mutates (e.g., Array.prototype.push)
const pushItem = rffc(Array<number>).push;

const myArray = [1, 2, 3];
console.log("Before push:", myArray); // Output: [1, 2, 3]
pushItem(myArray, 4); // The array is mutated directly
console.log("After push:", myArray);  // Output: [1, 2, 3, 4]

// Example 4: Accessing a simple property
const getLength = rffc(Array<any>).length;
console.log(getLength([1, 2, 3])); // Output: 3
console.log(getLength([]));       // Output: 0

// Example 5: Using built-in prototype methods (e.g., String.prototype.toUpperCase)
const toUpperCase = rffc(String).toUpperCase;
console.log(toUpperCase("hello world")); // Output: "HELLO WORLD"

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.


📄 License

This project is MIT licensed.