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

sweet-ramda

v0.0.2

Published

Macros utilities for Ramda

Downloads

2

Readme

sweet-ramda : SweetJS macros for Ramda

This project aims to use the power of SweetJS macros to provide syntaxic sugar over Ramda library.

For the moment, this is an alpha release and mostly experimental.

How to get sweet-ramda macros

You can fetch it using NPM npm install sweet-ramda or directly download the sweet-ramda.sjs file from this repo.

All the macros are defined in sweet-ramda.sjs.

Requirements

To be able to use it in your project, you must have SweetJS installed. You can do it also via NPM : npm install sweet.js

How to use it with a build tool

For the moment, I only tried to use SweetJS with Gulp. To do so, you will need to install "gulp-sweetjs" module : npm install gulp-sweetjs.

For example, you can defined a building task like this :

var gulp = require('gulp'),
    sweetjs = require('gulp-sweetjs');

gulp.task('build', function () {
    return gulp.src('src/*.js')
            .pipe(sweetjs({
                modules: ['PATH_TO_SWEET_RAMDA/sweet-ramda']
            }))
            .pipe(gulp.dest('build'));
});

Macros

The number of macros is quite little for now, but it will grow and it will focus on providing syntaxic sugar over the most usefull functions of Ramda.

import_ramda

Because of SweetJS enfore hygiene, a little hack is needed to bind every macros to the Ramda library. When you want to use macros defined in sweet-ramda, you will need to use this import_ramda macro on the top of your file, like this :

import_ramda R from "ramda"

/* Use every macro you want here :) */

map

Usage : map f arr where "f" is a function and "arr" a list (see R.map )

Note : You can use also map f to create a new function, using the automatic currying of Ramda.

filter

Usage : filter pred arr where "pred" is a predicate function and "arr" a list (see R.filter )

Note : You can use also filter f to create a new function, using the automatic currying of Ramda.

compose

Usage : f .. g where "f" and "g" are functions. It will be replaced by R.compose(f, g) (see R.compose )

id

Usage : id value where "value" is a litteral (see R.identity )

Note : it will be soon extended to objects.

curry

Usage : curry f where f is a function (see R.curry )

Placeholder

Usage : _ corresponding to R.__ (see R.__ )

This is usefull combined with currying :

function minus (a, b) {
    return a - b;
}

var curriedMinus = curry minus

var minusOne = minus(_, 1)

map minusOne [1, 2, 3]

Contributing

If you find this project great but you absolutely need a macro for a specific function, or if some of the existing macros can be improved, don't hesitate to create a new issue, to make a PR or to contact me on Twitter.