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

ramda-dom-utilities

v0.3.1

Published

A DOM utilities library built with Ramda

Downloads

32

Readme

Ramda DOM Utilities

Maintainability Codacy Badge Known Vulnerabilities Test Coverage

A lightweight (4.5kb gzipped) collection of curried DOM manipulation functions, created with the help of Ramda.

//Instead of writing this

const element = document.getElementById('test-id')
element.textContent = 'Hello world'
element.id = 'new-id'
element.classList.add('foo')

//Write this: Compact and reusable
import * as Rdom from 'ramda-dom-utilities' //Or import as R, or any name you like

const element = R.pipe(
  Rdom.getElementById('test-id'),
  Rdom.setProp('textContent')('Hello world'),
  Rdom.setProp('id')('new-id'),
  Rdom.addClass('foo')
)(document)

Installation

With npm:

npm i ramda-dom-utilities

Or via CDN:

<script defer src="https://unpkg.com/browse/ramda-dom-utilities/dist/index.esm.js"></script>

<script defer src="https://unpkg.com/browse/ramda-dom-utilities/dist/index.cjs.js"></script>

Or directly include the script in you site:

<script defer src="/path/to/your/dir/index.esm.js"></script>

Then in the script where you want to use this library:

import * as Rdom from 'ramda-dom-utilities'

Features

  • All functions in this library return the mutated element, so that you can easily use them in a pipe

  • All functions in this library are curried, so that you can easily reuse them

  • For API functions that return undefined, the element being used as data (after mutated by the API) will be returned

List of curried functions

We try to keep the name of the curried function identical with the Web API, and have the same parameter orders, except you would put the element that uses the API functions to the very end, so as to follow Ramda's "data-last" pattern.

//Web API

element.setAttribute('id', 'test-id')

//Curried version provided by this library

setAttribute('id')('test-id')(element)
  • [x] addClass

  • [x] containsClass

  • [x] removeClass

  • [x] setAttribute

  • [x] removeAttribute

  • [x] hasAttribute

  • [x] hasAttributes

  • [x] getAttribute

  • [x] getAttributeName

  • [x] getAttributeNS

  • [x] before

  • [x] after

  • [x] append

  • [x] prepend

  • [x] remove

  • [x] replaceWith

  • [x] getElementById

  • [x] getElementsByClassName

  • [x] getElementsByName

  • [x] getElementsByTagNameNS

  • [x] getElementsByTagName

  • [x] querySelector

  • [x] querySelectorAll

  • [x] addEventListener

  • [x] removeEventListener

  • [x] matches

  • [x] contains

Other than these curried Web API version, we provide the following functions to help you put DOM manipulation in a pipe

R.setProp

element.textContent = 'Hello world'
element.id = 'test-id'

//Can be directly translated to:

R.pipe(
  setProp('textContent')('Hello world'),
  setProp('id')('test-id')
)(element)

R.readProp

const lastChild = element.lastElementChild

//Can be directly translated to:

const lastChild = R.readProp('lastElementChild')(element)

How to contribute?

  • Use gitmoji to write commit message

  • TODO