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

funcl

v1.0.21-alpha

Published

"Some javascript util functions that sure as hell will ring a clojure bell!"

Downloads

25

Readme

FunCl

LICENSE MIT

Some javascript util functions that sure as hell ring a clojure bell!

https://phelsen.github.io/funcl/

NOTE: funcl is still in alpha phase. (However : functions that allready have an exact clojure signature will continue to do so)

Get it

You can install the latest release via npm:

npm i -S funcl

and use it with Node or a bundler like webpack or browserify :

f = require('funcl');
// or 
import f from  'funcl'; 

Test it

npm run test

Understand it

The main goal of this library is to make programming in javascript easier, more fun and less error-prone. Not to mimic clojure 100%. Although an effort has been/will be made to stay close to the clojure api : this library will always choose pragmatism over 'puritanism'. FunCl is not supporting lazy collections, nor will it try to copy the behaviour of macro's. At the other side, functions that seem convenient will be added even though clojure might not offer them.

As an example of the effort towards pragmatism : in this library most functions that lack some of their arguments will return the partial function that makes most sense. That way the very convenient pipe() function can do its magic kinda intuitively.

pipe(range(100),drop(80),reverse,takeWhile(x => x>90),filter(isOdd),map(inc))
=>[100,98,96,94,92]

API documentation is a work in progress : https://phelsen.github.io/funcl/

Do it (some quick examples)

| Code | Result | | --- | --- | |everything=range(1e4); life=pipe(range(1,50),filter(isMultipleOf(6))); theUniverse=filter(isMultipleOf(7),range(1e4)); intersection(life,theUniverse,everything)|[42]| |sum(filter(isAnyOf(isMultipleOf(3),isMultipleOf(5)),range(1e3))) // https://projecteuler.net/problem=1|233168| |arr=range(1,11); arr|[1,2,3,4,5,6,7,8,9,10]| |count(arr)|10| |reverse(arr)|[10,9,8,7,6,5,4,3,2,1]| |count('λλ FUNCL! λλ') |12| |reverse('λλ FUNCL! λλ' )|"λλ !LCNUF λλ"| |[first(arr), last(arr)]|[10,1]| |rest(arr)|[9,8,7,6,5,4,3,2,1]| |takeWhile(x => x < 5, arr)|[]| |takeLast(3, arr)|[3,2,1]| |map(sqr,arr)|[100,81,64,49,36,25,16,9,4,1]| |partition(2,interleave([1,2,3],[4,5,6]))|[[1,4],[2,5],[3,6]]| |pipe(arr,map(sqr),reverse,map(x=>x+100),filter(isOdd))|[101,109,125,149,181]| |dict=assoc({}, 'fn' , 'Bar' , 'ln', 'Foo')|{"fn":"Bar","ln":"Foo"}| |map(type, [arr,dict,11,true,{},[],new Date(),/funcl/])|["array","map","number","boolean","map","array","date","regexp"]| |dict=pipe(dict,assoc('ln', 'StillFoo', 'address',{ street : 'FunclStreet' , nb : '12' }));|{"fn":"Bar","ln":"StillFoo","address":{"street":"FunclStreet","nb":"12"}}| |dict2=clone(dict)|{"fn":"Bar","ln":"StillFoo","address":{"street":"FunclStreet","nb":"12"}}| |eq(dict,dict2)|true| |dict2=assoc(dict2,'nickname','funky' )|{"fn":"Bar","ln":"StillFoo","address":{"street":"FunclStreet","nb":"12"},"nickname":"funky"}| |eq(dict,dict2)|false|