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

ramdasauce

v2.1.3

Published

Utilities for Ramda.

Downloads

80,908

Readme

Ramdasauce

Adds a few utilities based on the delicious Ramda library.

npm module

Installing

npm i ramdasauce --save

  • Depends on ramda 0.24.+.
  • Targets ES5.
  • Built with ES6.

Usage

Here's the quick list of functions and a simple example.

import RS from 'ramdasauce'

// --- Conversions ---
RS.toDate(1e12)             // a Number to a date Object
RS.toNumber('5')            // a String to a Number

// --- Object Shenanigans ---
const x = {a: 1, b: 2, c: {x: [5, 6]}}
RS.mapKeys(R.toUpper, x)    // transforms the keys of an object by the function
RS.dotPath('c.x.0', x)      // fetches a value from a nested object by a string path

// --- Generating Things ---
RS.rangeStep(2, 2, 10)      // generates a range of numbers with a step

// --- Finding Things ---
RS.findByProp('id', 'a', [{id: 'a', id: 'b'}])      // finds an object by propEq
RS.findIndexByProp('id', 'a', [{id: 'a', id: 'b'}]) // finds the index of an object by propEq

// --- Predicates ---
RS.isUndefined(qwerty)      // check if something is undefined
RS.isNotNil(null)           // check if something is not null or undefined
RS.isNilOrEmpty(null)       // checks if something is null, undefined or R.isEmpty
RS.isWithin(1, 2, 2)        // is the 3rd parameter within the range of 1st through 2nd?
RS.isNotWithin(1, 2, 100)   // is the 3rd parameter not within the range of 1st through 2nd?
RS.eqLength([1,2,3], 'abc') // tests 2 things to see if their length properties are the same

Prior Art

Most of these functions were lifted from stuff I wrote in real projects.

(leans in and whispers)

I did look at these tho:

  • https://github.com/Cottin/ramda-extras
  • https://github.com/mediasuitenz/ramda-extended
  • https://github.com/ramda/ramda/wiki/Cookbook
  • https://github.com/seancannon/prettycats

Philosophy

These helper functions target that sweet spot between:

Not right for ramda core.

and

Would never be used outside your app.

Functions being added here must be used in an app. Preferable more than once.

I hope this library won't turn into something like this:

RS.portmanteau('functor', 'wrecked')
RS.yearsForAnimalInAsianCalendars('monkey')

Feedback

Do you have any common ramda patterns you use frequently? Drop some issues or PRs in!

Release Notes

2.1.0 - Aug 12, 2017

  • upgrades to [email protected]
  • bumped all dev dependencies
  • marked previous mentioned functions with @deprecated in their comments

2.0.0 - May 29, 2017

  • DEPRECATIONS: startsWith and endsWith are flagged for removal in 3.0.0 (ramda has these now)
  • DEPRECATIONS: random and sample are flagged for removal in 3.0.0 (impure functions)
  • DEPRECATIONS: log and trace are flagged for removal in 3.0.0 (impure debug functions)
  • Upgrades to [email protected]
  • updates build process for much smaller bundle sizes

1.2.0 - February 6, 2017

  • Updates isWithin to play nice with Webpack - @hubciorz (#7)
  • Bumped dependencies - @skellock (#8)

1.1.1 - August 17th, 2016

1.1.0 - June 16th, 2016

1.0.0 - April 3rd, 2016

  • Initial Release