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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@keepzen/flp

v0.0.4

Published

Function Light Programe for nodejs

Downloads

12

Readme

FLP

Some symbol definations:

| Symbol | Defination | |---------|------| | f(t) | A function, require one argument, which type is t. | | f(t1,t2,...,tn)| A function, require n arguments. | | f' | The variant of functon f, have some result but not differtne parames. | | f_n | A function, require n argument. |

FLP~unary(fn) ⇒ function

Change the fn to unary function.

f(anys) => f'.

Kind: inner method of FLP
Returns: function - - a function just require one arg.

| Param | Type | Description | | --- | --- | --- | | fn | function | A function require n args. |

FLP~identity(v) ⇒ any

any=>any

Kind: inner method of FLP
Returns: any - - the value was passed in.

| Param | Type | | --- | --- | | v | any |

FLP~constant(v) ⇒ function

any=>f(any)

Kind: inner method of FLP
Returns: function - - a function, which always return the passed v.

| Param | Type | | --- | --- | | v | any |

FLP~paritial(fn, ...presentArgs) ⇒ function

Praital a function.

(fn,...args)=>fm

If fn is a function require n arguments and fm = paritial(fn,arg1,arg2,...argx), then fm is a function require (n-x) arguments and fm(1,2,3) have same mean as fn(arg1,arg2,...argx,1,2,3).

Kind: inner method of FLP

| Param | Type | Description | | --- | --- | --- | | fn | function | A function require n arguments. | | ...presentArgs | Array(any) | Zero or more arugemnt use to paritial fn. |

FLP~reverseArg(fn) ⇒ function

Reverse function fn argumentes.

f_n=>f'_n

If f(a,b,c), and g=reverseArg(f), then 'g(1,2,3) === f(3,2,1)'.

Kind: inner method of FLP

| Param | Type | | --- | --- | | fn | function |

FLP~paritialRight(fn, ...presentArgs) ⇒ function

If f is a function require 5 arguments. and g = paritialRight(f,a1,a2,a3), then f(b1,b2,a1,a2,a3) same as g(b1,b2).

(f_n,a1,a2,..am) => f'_{n-m}

Kind: inner method of FLP

| Param | Type | | --- | --- | | fn | function | | ...presentArgs | Array(any) |

FLP~curry(fn, arity) ⇒ function

Curry a function.

See Wikipedia About Currying

Kind: inner method of FLP

| Param | Type | Description | | --- | --- | --- | | fn | function | A function have more than one argumentes. | | arity | number | How many argumentes the fn required. |

FLP~looseCurry(fn, arity) ⇒ function

Loose curry a function.

If a function fn require 3 argument, it be curried c=curry(fn), to get result, we must do like that c(1)(2)(3).

Now lc=looseCurry(fn), get same result, we can do like:

  1. lc(1,2,3)
  2. lc(1,2)(3)
  3. lc(1)(2,3)
  4. lc(1)(2)(3)

Kind: inner method of FLP

| Param | Type | Description | | --- | --- | --- | | fn | function | | | arity | number | How many argument of fn required. |

FLP~uncurry(fn) ⇒ function

Change a churryed function to a loose curry function.

Kind: inner method of FLP

| Param | Type | | --- | --- | | fn | function |

FLP~combine(...fns) ⇒ function

Combine the input functions to a new function.

Kind: inner method of FLP
Returns: function - - combined function.

| Param | Type | | --- | --- | | ...fns | Array(function) |

FLP~pipe(...fns) ⇒ function

Pipe functions. pipe(f1,f2,f3,...fn) === combine(fn,...f3,f2,f1)

Kind: inner method of FLP
Returns: function - return fn

| Param | Type | | --- | --- | | ...fns | Array(function) |

FLP~pipeable(fn) ⇒ function

Make the function fn pipeable to other functions.

Kind: inner method of FLP
Returns: function - - A function have a properity .pipe(...fns).

| Param | Type | | --- | --- | | fn | function |

FLP~trampoline(ret) ⇒ any

Help a function recursion.

Example:

function sumFromOneTo(n){
  function _sum(ret,i){
    if(i == 0){
      return ret;
    }else{
        //Do some operationes on argumemtes,
        //but delay to call function.
      return _sum.bind(null,ret+n,i-1);
    }
  }
  return trampoline(_sum.bind(0,n));
}

Kind: inner method of FLP

| Param | Type | Description | | --- | --- | --- | | ret | function | A function need no argument and return a value or return another function need no argument. |